Permalink
Browse files

Room

  • Loading branch information...
borodust committed Apr 16, 2017
1 parent 3c90417 commit 369ad980d4e19fbaa87934cb8a46d3446827f5be
Showing with 18,630 additions and 18,558 deletions.
  1. +18,555 −18,550 assets/dude-and-mortar.brf
  2. +1 −0 mortar-combat.asd
  3. +2 −2 src/ball.lisp
  4. +1 −1 src/camera.lisp
  5. +1 −1 src/dude.lisp
  6. +8 −2 src/main.lisp
  7. +2 −2 src/mortar.lisp
  8. +60 −0 src/room.lisp

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -15,6 +15,7 @@
:components ((:file "packages")
(:file "utils")
(:file "camera")
(:file "room")
(:file "ball")
(:file "mortar")
(:file "dude")
@@ -21,7 +21,7 @@
(defmethod scene-pass ((this ball-mesh) (pass rendering-pass) input)
(with-slots (mesh-asset light program color) this
(with-slots (light program color) this
(with-active-shading-program (program)
(setf (program-uniform-variable program "modelViewProjection") (model-view-projection-matrix)
(program-uniform-variable program "normalTransform") (mat4->mat3 (mult *view-matrix*
@@ -41,7 +41,7 @@
(defmethod initialization-flow ((this ball-model) &key)
(with-slots (mesh program) this
(>> (resource-flow "Ball.0" (shading-program-resource-name "passthru-program"))
(>> (resource-flow "mesh.Ball" (shading-program-resource-name "passthru-program"))
(instantly (m p)
(setf mesh m
program p))
@@ -5,6 +5,6 @@
(defmethod scene-pass ((this player-camera) pass input)
(setf (transform-of this) (mult (translation-mat4 3 -4 -40)
(setf (transform-of this) (mult (translation-mat4 3 -4 -100)
(euler-angles->mat4 (vec3 (/ pi 4) (/ pi 8) 0))))
(call-next-method))
@@ -49,7 +49,7 @@
(defmethod initialization-flow ((this dude-model) &key)
(with-slots (mesh animation skeleton program animation-name) this
(>> (resource-flow "Dude.1" "Stickman" animation-name
(>> (resource-flow "mesh.Dude" "Stickman" animation-name
(shading-program-resource-name "dude-program"))
(instantly (m s a p)
(setf mesh m
@@ -20,13 +20,14 @@
(transform-node
((projection-node :aspect (/ 800 600))
(player-camera
(room-model)
(ball-model)
((transform-node :translation (vec3 -4.0 0.0 0.0))
(mortar-model)
((dude-model :color (vec3 0.4 0.4 0.9) :animation-name "Strafing.animation.1")))
((dude-model :color (vec3 0.4 0.4 0.9) :animation-name "animation.Strafing")))
((transform-node :translation (vec3 4.0 0.0 0.0))
(mortar-model)
((dude-model :color (vec3 0.9 0.4 0.4) :animation-name "Running.animation.0"))))))))
((dude-model :color (vec3 0.9 0.4 0.4) :animation-name "animation.Running"))))))))
(defmethod initialize-system :after ((this mortar-combat))
@@ -60,6 +61,11 @@
(shutdown))
(define-event-handler on-exit viewport-hiding-event (ev)
(in-new-thread-waiting
(stop)))
(defun main (args)
(start (merge-pathnames (second args) (uiop:getcwd)))
(mt:wait-for-latch *main-latch*))
@@ -47,8 +47,8 @@
(defmethod initialization-flow ((this mortar-model) &key)
(with-slots (mesh animation skeleton program) this
(>> (resource-flow "Mortar.2" "MortarSkeleton"
"MortarRest.animation.2"
(>> (resource-flow "mesh.Mortar" "MortarSkeleton"
"animation.MortarRest"
(shading-program-resource-name "dude-program"))
(instantly (m s a p)
(setf mesh m
@@ -0,0 +1,60 @@
(in-package :mortar-combat)
;;;
;;;
;;;
(defclass room-mesh (mesh-node)
((light :initform (make-directional-light-source
(vec3 -0.57735026 -0.57735026 -0.57735026)
(vec4 0.2 0.2 0.2 1.0)
(vec4 0.8 0.8 0.8 1.0)
"dLight"))
(color :initform (vec3 0.9 0.9 0.9))
(program :initarg :program)))
(defmethod make-node-mesh ((this room-mesh))
(with-disposable ((vbuf (make-array-buffer #2a((50.0 0.0 50.0)
(50.0 0.0 -50.0)
(-50.0 0.0 50.0)
(-50.0 0.0 -50.0))))
(nbuf (make-array-buffer #2a((0.0 1.0 0.0) (0.0 1.0 0.0)
(0.0 1.0 0.0) (0.0 1.0 0.0)))))
(let ((mesh (make-mesh 4 :triangle-strip)))
(attach-array-buffer vbuf mesh 0)
(attach-array-buffer nbuf mesh 1)
mesh)))
(defmethod scene-pass ((this room-mesh) (pass rendering-pass) input)
(with-slots (light program color) this
(with-active-shading-program (program)
(setf (program-uniform-variable program "modelViewProjection") (model-view-projection-matrix)
(program-uniform-variable program "normalTransform") (mat4->mat3 (mult *view-matrix*
*model-matrix*))
(program-uniform-variable program "baseColor") color)
(apply-light-source light program)
(call-next-method))))
;;;
;;;
;;;
(defclass room-model (model)
((mesh :initform nil)
(program :initform nil)))
(defmethod initialization-flow ((this room-model) &key)
(with-slots (program) this
(>> (resource-flow (shading-program-resource-name "passthru-program"))
(instantly (p)
(setf program p))
(call-next-method))))
(defmethod model-graph-assembly-flow ((this room-model))
(with-slots (program) this
(scenegraph
((room-mesh :program program)))))

0 comments on commit 369ad98

Please sign in to comment.