Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add room mesh wall geom
  • Loading branch information
borodust committed Apr 21, 2017
1 parent 3a8cd03 commit 723fe65
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 24 deletions.
38 changes: 38 additions & 0 deletions client/assets/dude-and-mortar.brf
@@ -1,4 +1,26 @@
(:BRF 1)
(:MESH :NAME "mesh.Room")
("mesh.Room" :TRANSFORM
(1.0 0.0 0.0 0.0 0.0 -4.371139e-8 1.0 0.0 0.0 -1.0 -4.371139e-8 0.0 0.0 0.0
0.0 1.0)
:ARRAYS
((0
((-100.0 0.0 -100.0) (-100.0 20.0 -100.0) (-100.0 20.0 100.0)
(-100.0 0.0 100.0) (100.0 20.0 -100.0) (100.0 0.0 -100.0) (100.0 0.0 100.0)
(100.0 20.0 100.0) (100.0 0.0 -100.0) (-100.0 0.0 -100.0)
(-100.0 0.0 100.0) (100.0 0.0 100.0) (-100.0 20.0 -100.0)
(-100.0 0.0 -100.0) (100.0 0.0 -100.0) (100.0 20.0 -100.0)
(100.0 20.0 100.0) (100.0 0.0 100.0) (-100.0 0.0 100.0)
(-100.0 20.0 100.0)))
(1
((1.0 0.0 0.0) (1.0 0.0 0.0) (1.0 0.0 0.0) (1.0 0.0 0.0) (-1.0 0.0 0.0)
(-1.0 0.0 0.0) (-1.0 0.0 0.0) (-1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 1.0 0.0)
(0.0 1.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0) (0.0 0.0 1.0) (0.0 0.0 1.0)
(0.0 0.0 1.0) (0.0 0.0 -1.0) (0.0 0.0 -1.0) (0.0 0.0 -1.0)
(0.0 0.0 -1.0))))
:FACE :TRIANGLES :INDEXES
(0 1 2 0 2 3 4 5 6 4 6 7 8 9 10 8 10 11 12 13 14 12 14 15 16 17 18 16 18 19)
:BONES NIL)
(:MESH :NAME "mesh.Ball")
("mesh.Ball" :TRANSFORM
(1.0 0.0 0.0 -2.4876626 0.0 -4.371139e-8 1.0 8.563471 0.0 -1.0 -4.371139e-8
Expand Down Expand Up @@ -59129,6 +59151,10 @@
(-0.9866536 -0.12473728 0.10466664 -0.0020728111 0.1628327 -0.7558205
0.63420886 0.02457428 -2.861443e-7 0.6427877 0.7660444 1.0901104 0.0 0.0
0.0 1.0))))
(:SKELETON :NAME "Room")
(("Room" :TRANSFORM
(1.0 0.0 0.0 0.0 0.0 -4.371139e-8 1.0 0.0 0.0 -1.0 -4.371139e-8 0.0 0.0 0.0
0.0 1.0)))
(:SKELETON :NAME "Ball")
(("Ball" :TRANSFORM
(1.0 0.0 0.0 -2.4876626 0.0 -4.371139e-8 1.0 8.563471 0.0 -1.0 -4.371139e-8
Expand Down Expand Up @@ -60081,6 +60107,9 @@
(-0.21358702 0.22595616 5.1437263) (0.99999994 0.9999999 0.99999994))
(0.6666666666666666d0 (0.133943 0.13090284 0.665474 0.72254276)
(-0.21358702 0.22595616 5.1437263) (0.9999998 0.9999999 0.9999999)))
(("animation.Running.Room.sequence" :BONE "Room")
(0.0d0 (0.7071068 -0.7071067 0.0 0.0) (0.0 0.0 0.0)
(1.0 0.99999994 0.99999994)))
(("animation.Running.Shoulder_L.sequence" :BONE "Shoulder_L")
(0.0d0 (0.20355004 0.35634956 -0.15908551 0.8979277)
(-1.1828574 3.6940973 -0.023341209) (0.9999998 0.9999997 0.9999998))
Expand Down Expand Up @@ -61281,6 +61310,9 @@
(-0.21358702 0.22595616 5.1437263) (0.99999994 0.99999994 0.9999999))
(0.6666666666666666d0 (0.133943 0.13090284 0.665474 0.72254276)
(-0.21358702 0.22595616 5.1437263) (0.9999998 0.9999999 0.9999999)))
(("animation.Strafing.Room.sequence" :BONE "Room")
(0.0d0 (0.7071068 -0.7071067 0.0 0.0) (0.0 0.0 0.0)
(1.0 0.99999994 0.99999994)))
(("animation.Strafing.Shoulder_L.sequence" :BONE "Shoulder_L")
(0.0d0 (0.19950241 0.34935212 -0.18519169 0.89658016)
(-1.1828574 3.6940973 -0.023341209) (0.9999999 0.9999998 0.9999998))
Expand Down Expand Up @@ -61507,6 +61539,9 @@
(("animation.Resting.Pelvis.sequence" :BONE "Pelvis")
(0.0d0 (0.133943 0.13090284 0.665474 0.72254276)
(-0.21358702 0.22595616 5.1437263) (0.9999998 0.9999999 0.9999999)))
(("animation.Resting.Room.sequence" :BONE "Room")
(0.0d0 (0.7071068 -0.7071067 0.0 0.0) (0.0 0.0 0.0)
(1.0 0.99999994 0.99999994)))
(("animation.Resting.Shoulder_L.sequence" :BONE "Shoulder_L")
(0.0d0 (0.21495673 0.3512968 -0.18399276 0.89248574)
(-1.1828574 3.6940973 -0.023341209) (0.99999976 0.99999976 0.9999999)))
Expand Down Expand Up @@ -61575,6 +61610,9 @@
(("animation.MortarRest.Pelvis.sequence" :BONE "Pelvis")
(0.0d0 (0.133943 0.13090284 0.665474 0.72254276)
(-0.21358702 0.22595616 5.1437263) (0.9999998 0.9999999 0.9999999)))
(("animation.MortarRest.Room.sequence" :BONE "Room")
(0.0d0 (0.7071068 -0.7071067 0.0 0.0) (0.0 0.0 0.0)
(1.0 0.99999994 0.99999994)))
(("animation.MortarRest.Shoulder_L.sequence" :BONE "Shoulder_L")
(0.0d0 (0.21495673 0.3512968 -0.18399276 0.89248574)
(-1.1828574 3.6940973 -0.023341209) (0.99999976 0.99999976 0.9999999)))
Expand Down
2 changes: 1 addition & 1 deletion client/src/main.lisp
Expand Up @@ -2,7 +2,7 @@


(define-constant +framestep+ 0.016)
(define-constant +player-speed+ 15.0)
(define-constant +player-speed+ 20.0)
(defvar *main-latch* (mt:make-latch))


Expand Down
46 changes: 23 additions & 23 deletions client/src/room.lisp
@@ -1,18 +1,24 @@
(in-package :mortar-combat)


(defclass floor-geom (collidable plane-geom) ())
(defclass wall-geom (collidable plane-geom) ())
(defclass room-floor (disposable)
(geom))
(walls))


(defmethod initialize-instance :after ((this room-floor) &key)
(with-slots (geom) this
(setf geom (make-instance 'floor-geom :normal (vec3 0.0 1.0 0.0)))))
(with-slots (walls) this
(setf walls (list (make-instance 'wall-geom :normal (vec3 0.0 1.0 0.0))

(make-instance 'wall-geom :normal (vec3 0.0 0.0 -1.0) :offset -100.0)
(make-instance 'wall-geom :normal (vec3 -1.0 0.0 0.0) :offset -100.0)
(make-instance 'wall-geom :normal (vec3 0.0 0.0 1.0) :offset -100.0)
(make-instance 'wall-geom :normal (vec3 1.0 0.0 0.0) :offset -100.0)))))

(define-destructor room-floor (geom)
(dispose geom))

(define-destructor room-floor (walls)
(dolist (geom walls)
(dispose geom)))



Expand All @@ -21,25 +27,18 @@
;;;
(defclass room-mesh (mesh-node)
((light :initform (make-directional-light-source
(vec3 -0.57735026 -0.57735026 -0.57735026)
(vec3 -0.21821788 -0.8728715 0.43643576)
(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))
(mesh-asset :initarg :mesh)
(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)))
(with-slots (mesh-asset) this
(mesh-asset-mesh mesh-asset)))


(defmethod scene-pass ((this room-mesh) (pass rendering-pass) input)
Expand All @@ -62,10 +61,11 @@


(defmethod initialization-flow ((this room-model) &key)
(with-slots (program floor) this
(>> (resource-flow (shading-program-resource-name "passthru-program"))
(instantly (p)
(setf program p))
(with-slots (program floor mesh) this
(>> (resource-flow "mesh.Room" (shading-program-resource-name "passthru-program"))
(instantly (m p)
(setf program p
mesh m))
(-> ((physics)) ()
(setf floor (make-instance 'room-floor)))
(call-next-method))))
Expand All @@ -77,6 +77,6 @@


(defmethod model-graph-assembly-flow ((this room-model))
(with-slots (program) this
(with-slots (program mesh) this
(scenegraph
((room-mesh :program program)))))
((room-mesh :program program :mesh mesh)))))

0 comments on commit 723fe65

Please sign in to comment.