Skip to content
Permalink
Browse files

Clear workbench

  • Loading branch information
Shinmera committed Mar 10, 2020
1 parent 032abbd commit bcfef80a4ee212d3790e2c62bda40709d7a7b9c2
Showing with 2 additions and 35 deletions.
  1. +2 −35 workbench.lisp
@@ -12,44 +12,11 @@
(define-shader-subject grid (vertex-entity)
((vertex-array :initform (asset 'workbench 'grid))))

(define-asset (workbench rectangle) mesh
(make-rectangle 800 600 :align :bottomleft))

(define-shader-entity filler (vertex-entity colored-entity)
((vertex-array :initform (asset 'workbench 'rectangle))
(color :initform (vec 1 0 0 0.1))))

(defvar *clip-depth* 0)

(defmethod render :before ((workbench workbench) renderable)
(setf *clip-depth* 0))

(define-shader-subject clipper (vertex-entity scaled-entity located-entity colored-entity)
((vertex-array :initform (asset 'workbench 'rectangle))
(color :initform (vec 1 1 0 1))))

(defmethod paint :around ((clipper clipper) target)
(gl:stencil-op :keep :incr :incr)
(gl:stencil-func :lequal *clip-depth* #xFF)
(gl:color-mask NIL NIL NIL NIL)
(gl:depth-mask NIL)
(call-next-method)
(incf *clip-depth*)
(gl:stencil-op :keep :keep :keep)
(gl:stencil-func :lequal *clip-depth* #xFF)
(gl:color-mask T T T T)
(gl:depth-mask T))

(progn
(defmethod setup-scene ((workbench workbench) scene)
(disable :cull-face)
(enter (make-instance 'clipper :scaling (vec 0.5 0.5 1) :location (vec 100 100 0)) scene)
(enter (make-instance 'filler) scene)
(enter (make-instance 'clipper :scaling (vec 0.5 0.5 1) :location (vec 0 0 0)) scene)
(enter (make-instance 'filler) scene)
;; (enter (make-instance 'clipper :scaling (vec (/ (expt 1.1 i)) (/ (expt 1.1 i)) 1)) scene)
;; (enter (make-instance 'filler) scene)
(enter (make-instance '2d-camera) scene)
(enter (make-instance 'grid) scene)
(enter (make-instance 'editor-camera) scene)
(enter (make-instance 'render-pass) scene))

(maybe-reload-scene))

0 comments on commit bcfef80

Please sign in to comment.
You can’t perform that action at this time.