Browse files

Fix remaining uses of shader-subject where shader-entity should be us…

…ed instead.
  • Loading branch information...
Shinmera committed Aug 17, 2017
1 parent 70af691 commit 75aa6608f975567dca3c9d30e12f3668ae8dc396
Showing with 15 additions and 13 deletions.
  1. +2 −0 assets/texture.lisp
  2. +1 −1 scene-buffer.lisp
  3. +1 −1 selection-buffer.lisp
  4. +9 −9 shader-pass.lisp
  5. +1 −1 shader-subject.lisp
  6. +1 −1 skybox.lisp
@@ -94,6 +94,8 @@
(gl:bind-texture target texture)
(images-to-textures target images)
(unless (eql target :texture-2d-multisample)
;; FIXME: generating mipmaps for depth-stencil textures is apparently not
;; allowed on all drivers.
(when (find min-filter '(:linear-mipmap-linear :linear-mipmap-nearest
:nearest-mipmap-linear :nearest-mipmap-nearest))
(gl:generate-mipmap target))
@@ -16,7 +16,7 @@
(register (render-pass buffer) buffer)
(pack buffer))
(defmethod enter :after ((subject shader-subject) (buffer scene-buffer))
(defmethod enter :after ((subject shader-entity) (buffer scene-buffer))
(register-object-for-pass buffer subject))
(defmethod paint ((pass shader-pass) (buffer scene-buffer))
@@ -111,7 +111,7 @@ void main(){
color = selection_color;
(define-shader-subject selectable ()
(define-shader-entity selectable ()
((selection-color :initarg :selection-color :initform (find-new-selection-color) :accessor selection-color)))
(defun find-new-selection-color ()
@@ -113,7 +113,7 @@
;; Pass changed, recompile everything
(loop for class being the hash-keys of assets
do (refresh class)))
((and (typep subject-class 'shader-subject-class)
((and (typep subject-class 'shader-entity-class)
(not (typep subject-class 'shader-pass-class)))
;; Object changed, recompile it
(refresh subject-class))))))
@@ -122,7 +122,7 @@
(loop for v being the hash-values of (assets pass)
do (load v)))
(defmethod shader-program-for-pass ((pass per-object-pass) (subject shader-subject))
(defmethod shader-program-for-pass ((pass per-object-pass) (subject shader-entity))
(gethash (class-of subject) (assets pass)))
(defmethod coerce-pass-shader ((pass per-object-pass) class type spec)
@@ -132,22 +132,22 @@
(defmethod determine-effective-shader-class ((name symbol))
(determine-effective-shader-class (find-class name)))
(defmethod determine-effective-shader-class ((object shader-subject))
(defmethod determine-effective-shader-class ((object shader-entity))
(determine-effective-shader-class (class-of object)))
(defmethod determine-effective-shader-class ((class standard-class))
(defmethod determine-effective-shader-class ((class shader-subject-class))
(defmethod determine-effective-shader-class ((class shader-entity-class))
(if (direct-shaders class)
(let* ((effective-superclasses (list (find-class 'shader-subject))))
(let* ((effective-superclasses (list (find-class 'shader-entity))))
;; Loop through superclasses and push new, effective superclasses.
(loop for superclass in (c2mop:class-direct-superclasses class)
for effective-class = (determine-effective-shader-class superclass)
do (when (and effective-class (not (find effective-class effective-superclasses)))
(push effective-class effective-superclasses)))
;; If we have one or two --one always being the shader-subject class--
;; If we have one or two --one always being the shader-entity class--
;; then we just return the more specific of the two, as there's no class
;; combination happening that would produce new shaders.
(if (<= (length effective-superclasses) 2)
@@ -160,7 +160,7 @@
(for:for ((object over container))
(register-object-for-pass pass object)))
(defmethod register-object-for-pass ((pass per-object-pass) (class shader-subject-class))
(defmethod register-object-for-pass ((pass per-object-pass) (class shader-entity-class))
(let ((shaders ()))
(let ((effective-class (determine-effective-shader-class class)))
(unless (gethash effective-class (assets pass))
@@ -172,10 +172,10 @@
(make-asset 'shader-program shaders)))
(setf (gethash class (assets pass)) (gethash effective-class (assets pass))))))
(defmethod register-object-for-pass ((pass per-object-pass) (subject shader-subject))
(defmethod register-object-for-pass ((pass per-object-pass) (subject shader-entity))
(register-object-for-pass pass (class-of subject)))
(defmethod paint :around ((subject shader-subject) (pass per-object-pass))
(defmethod paint :around ((subject shader-entity) (pass per-object-pass))
(let ((program (shader-program-for-pass pass subject)))
(gl:use-program (resource program))
(prepare-pass-program pass program)
@@ -9,7 +9,7 @@
(defclass shader-subject-class (subject-class shader-entity-class)
(defclass shader-subject (subject)
(defclass shader-subject (subject shader-entity)
(:metaclass shader-subject-class))
@@ -6,7 +6,7 @@
(in-package #:org.shirakumo.fraf.trial)
(define-shader-subject skybox ()
(define-shader-entity skybox ()
((texture :initarg :texture :accessor texture)
(vertex-array :initform NIL :Accessor vertex-array))
(:default-initargs :texture (error "TEXTURE required.")))

0 comments on commit 75aa660

Please sign in to comment.