Initial commit for a test game using stoe
This commit is contained in:
commit
a51068c2cb
14 changed files with 998 additions and 0 deletions
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
*.fasl
|
||||
*.dx32fsl
|
||||
*.dx64fsl
|
||||
*.lx32fsl
|
||||
*.lx64fsl
|
||||
*.x86f
|
||||
*~
|
||||
.#*
|
||||
17
README.md
Normal file
17
README.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Stoe-Game - SaintOEngine Game - A test game using stoe
|
||||
|
||||
## Usage
|
||||
|
||||
## Installation
|
||||
|
||||
## Author
|
||||
|
||||
* Renaud Casenave-Péré (renaud@casenave-pere.fr)
|
||||
|
||||
## Copyright
|
||||
|
||||
Copyright (c) 2015 Renaud Casenave-Péré (renaud@casenave-pere.fr)
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the LLGPL License.
|
||||
19
README.org
Normal file
19
README.org
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
* Stoe-Game - SaintOEngine Game - A test game using stoe
|
||||
|
||||
** Usage
|
||||
|
||||
** Dependencies
|
||||
|
||||
** Installation
|
||||
|
||||
** Author
|
||||
|
||||
+ Renaud Casenave-Péré (renaud@casenave-pere.fr)
|
||||
|
||||
** Copyright
|
||||
|
||||
Copyright (c) 2015 Renaud Casenave-Péré (renaud@casenave-pere.fr)
|
||||
|
||||
** License
|
||||
|
||||
Licensed under the LLGPL License.
|
||||
1
VERSION
Normal file
1
VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
"0.1"
|
||||
524
data/TieFighter.dae
Normal file
524
data/TieFighter.dae
Normal file
File diff suppressed because one or more lines are too long
BIN
data/TieFighter_Upload.blend
Normal file
BIN
data/TieFighter_Upload.blend
Normal file
Binary file not shown.
199
data/cube.dae
Normal file
199
data/cube.dae
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Blender User</author>
|
||||
<authoring_tool>Blender 2.75.0 commit date:2015-07-07, commit time:14:56, hash:c27589e</authoring_tool>
|
||||
</contributor>
|
||||
<created>2015-08-19T17:43:33</created>
|
||||
<modified>2015-08-19T17:43:33</modified>
|
||||
<unit name="meter" meter="1"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_cameras>
|
||||
<camera id="Camera-camera" name="Camera">
|
||||
<optics>
|
||||
<technique_common>
|
||||
<perspective>
|
||||
<xfov sid="xfov">49.13434</xfov>
|
||||
<aspect_ratio>1.777778</aspect_ratio>
|
||||
<znear sid="znear">0.1</znear>
|
||||
<zfar sid="zfar">100</zfar>
|
||||
</perspective>
|
||||
</technique_common>
|
||||
</optics>
|
||||
<extra>
|
||||
<technique profile="blender">
|
||||
<YF_dofdist>0</YF_dofdist>
|
||||
<shiftx>0</shiftx>
|
||||
<shifty>0</shifty>
|
||||
</technique>
|
||||
</extra>
|
||||
</camera>
|
||||
</library_cameras>
|
||||
<library_lights>
|
||||
<light id="Lamp-light" name="Lamp">
|
||||
<technique_common>
|
||||
<point>
|
||||
<color sid="color">1 1 1</color>
|
||||
<constant_attenuation>1</constant_attenuation>
|
||||
<linear_attenuation>0</linear_attenuation>
|
||||
<quadratic_attenuation>0.00111109</quadratic_attenuation>
|
||||
</point>
|
||||
</technique_common>
|
||||
<extra>
|
||||
<technique profile="blender">
|
||||
<adapt_thresh>0.000999987</adapt_thresh>
|
||||
<area_shape>1</area_shape>
|
||||
<area_size>0.1</area_size>
|
||||
<area_sizey>0.1</area_sizey>
|
||||
<area_sizez>1</area_sizez>
|
||||
<atm_distance_factor>1</atm_distance_factor>
|
||||
<atm_extinction_factor>1</atm_extinction_factor>
|
||||
<atm_turbidity>2</atm_turbidity>
|
||||
<att1>0</att1>
|
||||
<att2>1</att2>
|
||||
<backscattered_light>1</backscattered_light>
|
||||
<bias>1</bias>
|
||||
<blue>1</blue>
|
||||
<buffers>1</buffers>
|
||||
<bufflag>0</bufflag>
|
||||
<bufsize>2880</bufsize>
|
||||
<buftype>2</buftype>
|
||||
<clipend>30.002</clipend>
|
||||
<clipsta>1.000799</clipsta>
|
||||
<compressthresh>0.04999995</compressthresh>
|
||||
<dist sid="blender_dist">29.99998</dist>
|
||||
<energy sid="blender_energy">1</energy>
|
||||
<falloff_type>2</falloff_type>
|
||||
<filtertype>0</filtertype>
|
||||
<flag>0</flag>
|
||||
<gamma sid="blender_gamma">1</gamma>
|
||||
<green>1</green>
|
||||
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
|
||||
<horizon_brightness>1</horizon_brightness>
|
||||
<mode>8192</mode>
|
||||
<ray_samp>1</ray_samp>
|
||||
<ray_samp_method>1</ray_samp_method>
|
||||
<ray_samp_type>0</ray_samp_type>
|
||||
<ray_sampy>1</ray_sampy>
|
||||
<ray_sampz>1</ray_sampz>
|
||||
<red>1</red>
|
||||
<samp>3</samp>
|
||||
<shadhalostep>0</shadhalostep>
|
||||
<shadow_b sid="blender_shadow_b">0</shadow_b>
|
||||
<shadow_g sid="blender_shadow_g">0</shadow_g>
|
||||
<shadow_r sid="blender_shadow_r">0</shadow_r>
|
||||
<sky_colorspace>0</sky_colorspace>
|
||||
<sky_exposure>1</sky_exposure>
|
||||
<skyblendfac>1</skyblendfac>
|
||||
<skyblendtype>1</skyblendtype>
|
||||
<soft>3</soft>
|
||||
<spotblend>0.15</spotblend>
|
||||
<spotsize>75</spotsize>
|
||||
<spread>1</spread>
|
||||
<sun_brightness>1</sun_brightness>
|
||||
<sun_effect_type>0</sun_effect_type>
|
||||
<sun_intensity>1</sun_intensity>
|
||||
<sun_size>1</sun_size>
|
||||
<type>0</type>
|
||||
</technique>
|
||||
</extra>
|
||||
</light>
|
||||
</library_lights>
|
||||
<library_images/>
|
||||
<library_effects>
|
||||
<effect id="Material-effect">
|
||||
<profile_COMMON>
|
||||
<technique sid="common">
|
||||
<phong>
|
||||
<emission>
|
||||
<color sid="emission">0 0 0 1</color>
|
||||
</emission>
|
||||
<ambient>
|
||||
<color sid="ambient">0 0 0 1</color>
|
||||
</ambient>
|
||||
<diffuse>
|
||||
<color sid="diffuse">0.64 0.64 0.64 1</color>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<color sid="specular">0.5 0.5 0.5 1</color>
|
||||
</specular>
|
||||
<shininess>
|
||||
<float sid="shininess">50</float>
|
||||
</shininess>
|
||||
<index_of_refraction>
|
||||
<float sid="index_of_refraction">1</float>
|
||||
</index_of_refraction>
|
||||
</phong>
|
||||
</technique>
|
||||
</profile_COMMON>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="Material-material" name="Material">
|
||||
<instance_effect url="#Material-effect"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="Cube-mesh" name="Cube">
|
||||
<mesh>
|
||||
<source id="Cube-mesh-positions">
|
||||
<float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#Cube-mesh-positions-array" count="8" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="Cube-mesh-normals">
|
||||
<float_array id="Cube-mesh-normals-array" count="36">0 0 -1 0 0 1 1 -5.96046e-7 3.27825e-7 -4.76837e-7 -1 0 -1 2.38419e-7 -1.19209e-7 2.08616e-7 1 0 0 0 -1 0 0 1 1 0 -2.38419e-7 0 -1 -4.76837e-7 -1 2.38419e-7 -1.49012e-7 2.68221e-7 1 2.38419e-7</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#Cube-mesh-normals-array" count="12" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="Cube-mesh-vertices">
|
||||
<input semantic="POSITION" source="#Cube-mesh-positions"/>
|
||||
</vertices>
|
||||
<polylist material="Material-material" count="12">
|
||||
<input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
|
||||
<vcount>3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
|
||||
<p>0 0 1 0 2 0 7 1 6 1 5 1 4 2 5 2 1 2 5 3 6 3 2 3 2 4 6 4 7 4 0 5 3 5 7 5 3 6 0 6 2 6 4 7 7 7 5 7 0 8 4 8 1 8 1 9 5 9 2 9 3 10 2 10 7 10 4 11 0 11 7 11</p>
|
||||
</polylist>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_controllers/>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="Scene" name="Scene">
|
||||
<node id="Camera" name="Camera" type="NODE">
|
||||
<matrix sid="transform">0.6858805 -0.3173701 0.6548619 7.481132 0.7276338 0.3124686 -0.6106656 -6.50764 -0.01081678 0.8953432 0.4452454 5.343665 0 0 0 1</matrix>
|
||||
<instance_camera url="#Camera-camera"/>
|
||||
</node>
|
||||
<node id="Lamp" name="Lamp" type="NODE">
|
||||
<matrix sid="transform">-0.2908646 -0.7711008 0.5663932 4.076245 0.9551712 -0.1998834 0.2183912 1.005454 -0.05518906 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
|
||||
<instance_light url="#Lamp-light"/>
|
||||
</node>
|
||||
<node id="Cube" name="Cube" type="NODE">
|
||||
<matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
|
||||
<instance_geometry url="#Cube-mesh" name="Cube">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="Material-material" target="#Material-material"/>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#Scene"/>
|
||||
</scene>
|
||||
</COLLADA>
|
||||
65
data/cube.lisp
Normal file
65
data/cube.lisp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
(:name "cube"
|
||||
:streams ((:program simple-shader
|
||||
:vertex-buffer ((position :float 3
|
||||
#(0.5 0.5 0.5
|
||||
0.5 -0.5 0.5
|
||||
-0.5 -0.5 0.5
|
||||
-0.5 0.5 0.5
|
||||
0.5 0.5 0.5
|
||||
-0.5 0.5 0.5
|
||||
-0.5 0.5 -0.5
|
||||
0.5 0.5 -0.5
|
||||
0.5 0.5 0.5
|
||||
0.5 0.5 -0.5
|
||||
0.5 -0.5 -0.5
|
||||
0.5 -0.5 0.5
|
||||
0.5 0.5 -0.5
|
||||
-0.5 0.5 -0.5
|
||||
-0.5 -0.5 -0.5
|
||||
0.5 -0.5 -0.5
|
||||
0.5 -0.5 0.5
|
||||
0.5 -0.5 -0.5
|
||||
-0.5 -0.5 -0.5
|
||||
-0.5 -0.5 0.5
|
||||
-0.5 0.5 0.5
|
||||
-0.5 -0.5 0.5
|
||||
-0.5 -0.5 -0.5
|
||||
-0.5 0.5 -0.5))
|
||||
(color :float 4
|
||||
#(0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
0.0 1.0 1.0 1.0
|
||||
0.0 1.0 1.0 1.0
|
||||
0.0 1.0 1.0 1.0
|
||||
0.0 1.0 1.0 1.0
|
||||
1.0 0.0 1.0 1.0
|
||||
1.0 0.0 1.0 1.0
|
||||
1.0 0.0 1.0 1.0
|
||||
1.0 0.0 1.0 1.0)))
|
||||
:index-buffer (:unsigned-short :triangles
|
||||
#(0 1 2
|
||||
2 3 0
|
||||
4 5 6
|
||||
6 7 4
|
||||
8 9 10
|
||||
10 11 8
|
||||
12 13 14
|
||||
14 15 12
|
||||
16 17 18
|
||||
18 19 16
|
||||
20 21 22
|
||||
22 23 20)))))
|
||||
11
data/cube.mtl
Normal file
11
data/cube.mtl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Blender MTL File: 'None'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material
|
||||
Ns 96.078431
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
26
data/cube.obj
Normal file
26
data/cube.obj
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Blender v2.75 (sub 0) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib cube.mtl
|
||||
o Cube
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 -0.999999
|
||||
v 0.999999 1.000000 1.000001
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn -0.000000 -0.000000 1.000000
|
||||
vn -1.000000 -0.000000 -0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 1//1 2//1 3//1 4//1
|
||||
f 5//2 8//2 7//2 6//2
|
||||
f 1//3 5//3 6//3 2//3
|
||||
f 2//4 6//4 7//4 3//4
|
||||
f 3//5 7//5 8//5 4//5
|
||||
f 5//6 1//6 4//6 8//6
|
||||
12
data/triangle.lisp
Normal file
12
data/triangle.lisp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(:name "triangle"
|
||||
:streams ((:program simple-shader
|
||||
:vertex-buffer ((position :float 3
|
||||
#(0.25 0.25 0.0
|
||||
0.25 -0.25 0.0
|
||||
-0.25 -0.25 0.0))
|
||||
(color :float 4
|
||||
#(0.0 0.0 1.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0)))
|
||||
:index-buffer (:unsigned-short :triangles
|
||||
#(0 1 2)))))
|
||||
44
stoe-game.asd
Normal file
44
stoe-game.asd
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#|
|
||||
This file is a part of stoe-game project.
|
||||
Copyright (c) 2015 Renaud Casenave-Péré (renaud@casenave-pere.fr)
|
||||
|#
|
||||
|
||||
#|
|
||||
SaintOEngine Game - A test game using stoe
|
||||
|
||||
Author: Renaud Casenave-Péré (renaud@casenave-pere.fr)
|
||||
|#
|
||||
|
||||
(in-package :cl-user)
|
||||
(defpackage stoe-game-asd
|
||||
(:use :cl :asdf))
|
||||
(in-package :stoe-game-asd)
|
||||
|
||||
(defsystem stoe-game
|
||||
:version (:read-file-form "VERSION")
|
||||
:author "Renaud Casenave-Péré"
|
||||
:license "LLGPL"
|
||||
:description "SaintOEngine Game - A test game using stoe"
|
||||
:long-description
|
||||
#.(with-open-file (stream (merge-pathnames
|
||||
#p"README.md"
|
||||
(or *load-pathname* *compile-file-pathname*))
|
||||
:if-does-not-exist nil
|
||||
:direction :input)
|
||||
(when stream
|
||||
(let ((seq (make-array (file-length stream)
|
||||
:element-type 'character
|
||||
:fill-pointer t)))
|
||||
(setf (fill-pointer seq) (read-sequence seq stream))
|
||||
seq)))
|
||||
:defsystem-depends-on (:asdf-package-system)
|
||||
:class :package-inferred-system
|
||||
:around-compile (lambda (thunk)
|
||||
(proclaim '(optimize (debug 3) (safety 3) (speed 0)))
|
||||
(funcall thunk))
|
||||
:depends-on ("stoe")
|
||||
:components ((:file "stoe-game"))
|
||||
:in-order-to ((test-op (load-op stoe-game/test))))
|
||||
|
||||
(defsystem stoe-game/test
|
||||
:depends-on ("prove" "stoe-game/test/all"))
|
||||
58
stoe-game.lisp
Normal file
58
stoe-game.lisp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#|
|
||||
This file is a part of stoe project.
|
||||
Copyright (c) 2015 Renaud Casenave-Péré (renaud@casenave-pere.fr)
|
||||
|#
|
||||
|
||||
(uiop:define-package :stoe-game
|
||||
(:use :cl :stoe))
|
||||
(in-package :stoe-game)
|
||||
|
||||
(defun load-cube ()
|
||||
(with-lock-held ((scene-lock (get-world)))
|
||||
(with-accessors ((scene world-scene) (camera world-camera) (scenes scenes)) (get-world)
|
||||
(push (import-graphic-assets #P"data/cube.dae") scenes)
|
||||
(setf scene (first scenes))
|
||||
(setf camera (make-camera 90 (/ 16 9) 1.0 1000.0)))))
|
||||
|
||||
(defun load-tie ()
|
||||
(with-lock-held ((scene-lock (get-world)))
|
||||
(with-accessors ((scene world-scene) (camera world-camera) (scenes scenes)) (get-world)
|
||||
(push (import-graphic-assets #P"data/TieFighter.dae") scenes)
|
||||
(setf scene (first scenes))
|
||||
(setf camera (make-camera 90 (/ 16 9) 1.0 1000.0)))))
|
||||
|
||||
(defun setup-input ()
|
||||
(global-set-key :escape #'quit)
|
||||
(global-set-key (:e :continuous) (lambda () (move (get-current-camera) :dz -0.1)))
|
||||
(global-set-key (:j :continuous) (lambda () (move (get-current-camera) :dz 0.1)))
|
||||
(global-set-key (:q :continuous) (lambda () (move (get-current-camera) :dx -0.1)))
|
||||
(global-set-key (:k :continuous) (lambda () (move (get-current-camera) :dx 0.1)))
|
||||
(global-set-key (:o :continuous) (lambda () (rotate (get-current-camera) :dz -2)))
|
||||
(global-set-key (:u :continuous) (lambda () (rotate (get-current-camera) :dz 2)))
|
||||
(let (freelook-mode)
|
||||
(flet ((set-freelook (enable)
|
||||
(setf freelook-mode enable))
|
||||
(freelook-move (dx dy)
|
||||
(when freelook-mode
|
||||
(rotate (get-current-camera) :dx (- dx) :dy dy))))
|
||||
(global-set-key 3 #'set-freelook t)
|
||||
(global-set-key (3 :release) #'set-freelook nil)
|
||||
(global-set-motion #'freelook-move :dx :dy))))
|
||||
|
||||
(defun initialize (&optional argv)
|
||||
(declare (ignore argv))
|
||||
(setup-input)
|
||||
(world-initialize)
|
||||
(load-cube))
|
||||
|
||||
(defun finalize ())
|
||||
|
||||
(defun update (delta-time)
|
||||
(declare (ignore delta-time))
|
||||
(unless (null (get-world))
|
||||
(with-lock-held ((scene-lock (get-world)))
|
||||
(when (get-current-camera)
|
||||
(update-view (get-current-camera))))))
|
||||
|
||||
(defmodule stoe-game :game)
|
||||
|
||||
14
test/stoe-game.lisp
Normal file
14
test/stoe-game.lisp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage stoe-game-test
|
||||
(:use :cl
|
||||
:stoe-game
|
||||
:prove))
|
||||
(in-package :stoe-game-test)
|
||||
|
||||
;; NOTE: To run this test file, execute `(asdf:test-system :stoe-game)' in your Lisp.
|
||||
|
||||
(plan nil)
|
||||
|
||||
;; blah blah blah.
|
||||
|
||||
(finalize)
|
||||
Loading…
Add table
Reference in a new issue