Преглед изворни кода

Merge pull request #1244 from seanpaultaylor/next

Added missing files from previous commit
Sean Taylor пре 12 година
родитељ
комит
d77a16d46e

BIN
samples/browser/res/png/duck.png


BIN
samples/browser/res/png/logo.png


BIN
samples/character/res/common/sample.gpb


+ 513 - 0
samples/character/res/common/sample.material

@@ -0,0 +1,513 @@
+material texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            
+            sampler u_diffuseTexture
+            {
+                mipmap = true
+                wrapS = CLAMP
+                wrapT = CLAMP
+                minFilter = LINEAR_MIPMAP_LINEAR
+                magFilter = LINEAR
+            }
+
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+            }
+        }
+    }
+}
+
+material texturedSpecular
+{
+    technique
+    {
+        pass
+        {
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+			defines = SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
+
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+            u_worldViewMatrix = WORLD_VIEW_MATRIX
+            u_cameraPosition = CAMERA_VIEW_POSITION
+            u_ambientColor = SCENE_AMBIENT_COLOR
+            u_specularExponent = 50
+
+            sampler u_diffuseTexture
+            {
+                mipmap = true
+                wrapS = CLAMP
+                wrapT = CLAMP
+                minFilter = LINEAR_MIPMAP_LINEAR
+                magFilter = LINEAR
+            }
+
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+            }
+        }
+    }
+}
+
+material texturedTransparent
+{
+    technique
+    {
+        pass
+        {
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
+
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+            
+            sampler u_diffuseTexture
+            {
+                mipmap = true
+                wrapS = CLAMP
+                wrapT = CLAMP
+                minFilter = LINEAR_MIPMAP_LINEAR
+                magFilter = LINEAR
+            }
+
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+	            blend = true
+                blendSrc = SRC_ALPHA
+                blendDst = ONE_MINUS_SRC_ALPHA
+            }
+        }
+    }
+}
+
+material colored
+{
+    technique
+    {
+        pass
+        {
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
+
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+            
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+            }
+        }
+    }
+}
+
+material boy : texturedTransparent
+{
+    technique
+    {
+        pass
+        {
+            defines = SKINNING;SKINNING_JOINT_COUNT 31;MODULATE_ALPHA;DIRECTIONAL_LIGHT_COUNT 1
+            u_matrixPalette = MATRIX_PALETTE
+            u_modulateAlpha = 1.0
+
+            sampler u_diffuseTexture
+            {
+                path = @character
+            }
+        }
+    }
+}
+
+material boyshadow : texturedTransparent
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @shadow
+            }
+        }
+    }
+}
+
+material floortiles : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @floortiles
+            }
+        }
+    }
+}
+
+material floor : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @floor
+            }
+        }
+    }
+}
+
+material wallwest : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @wallwest
+            }
+        }
+    }
+}
+
+material walleast : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @walleast
+            }
+        }
+    }
+}
+
+material wallnorth : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @wallnorth
+            }
+        }
+    }
+}
+
+material wallsouth : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @wallsouth
+            }
+        }
+    }
+}
+
+material walloverhang : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @walloverhang
+            }
+        }
+    }
+}
+
+material toybox : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @toybox
+            }
+        }
+    }
+}
+
+material green : colored
+{
+    technique
+    {
+        pass
+        {
+            u_diffuseColor = 0.65, 0.7, 0, 1
+        }
+    }
+}
+
+material lightblue : colored
+{
+    technique
+    {
+        pass
+        {
+            u_diffuseColor = 0.38, 0.72, 0.85, 1
+        }
+    }
+}
+
+material basketball : texturedSpecular
+{
+    technique
+    {
+        pass
+        {
+            u_specularExponent = 12
+
+            sampler u_diffuseTexture
+            {
+                path = @basketball
+                wrapS = REPEAT
+                wrapT = REPEAT
+            }
+        }
+    }
+}
+
+material playtable : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @playtable
+            }
+        }
+    }
+}
+
+material easel : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @easel
+            }
+        }
+    }
+}
+
+material door : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @door
+            }
+        }
+    }
+}
+
+material basketballnet : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @basketballnet
+            }
+        }
+    }
+}
+
+material backboard : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @backboard
+            }
+        }
+    }
+}
+
+material doorframe : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @doorframe
+            }
+        }
+    }
+}
+
+material windowledge : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @windowledge
+            }
+        }
+    }
+}
+
+material bookshelf : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @bookshelf
+            }
+        }
+    }
+}
+
+material book : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @book
+            }
+        }
+    }
+}
+
+material tabletop : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @tabletop
+            }
+        }
+    }
+}
+
+material tableleg1 : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @tableleg1
+            }
+        }
+    }
+}
+
+material tableleg2 : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @tableleg2
+            }
+        }
+    }
+}
+
+material tableleg3 : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @tableleg3
+            }
+        }
+    }
+}
+
+material tableleg4 : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @tableleg4
+            }
+        }
+    }
+}
+
+material storageorganizer : texturedUnlit
+{
+    technique
+    {
+        pass
+        {
+            sampler u_diffuseTexture
+            {
+                path = @storageorganizer
+            }
+        }
+    }
+}

+ 74 - 0
samples/character/res/common/sample.physics

@@ -0,0 +1,74 @@
+collisionObject basketball
+{
+    type = RIGID_BODY
+    shape = SPHERE
+    mass = 1.0
+    friction = 0.5
+    restitution = 1.0
+    linearDamping = 0.1
+    angularDamping = 0.5
+}
+
+collisionObject chair
+{
+    type = RIGID_BODY
+    shape = BOX
+    mass = 5.0
+    friction = 1.0
+    restitution = 0.0
+    linearDamping = 0.9
+    angularDamping = 0.5
+}
+
+collisionObject table
+{
+    type = RIGID_BODY
+    shape = BOX
+    mass = 0.0
+    friction = 0.5
+    restitution = 0.75
+    linearDamping = 0.1
+    angularDamping = 0.5
+}
+
+collisionObject staticBox
+{
+    type = RIGID_BODY
+    shape = BOX
+    mass = 0.0
+    friction = 0.5
+    restitution = 0.75
+    linearDamping = 0.025
+    angularDamping = 0.16
+}
+
+collisionObject staticMesh
+{
+    type = RIGID_BODY
+    shape = MESH
+    mass = 0.0
+    friction = 0.5
+    restitution = 0.75
+    linearDamping = 0.025
+    angularDamping = 0.16
+}
+
+collisionObject boy
+{
+    type = CHARACTER
+    shape = CAPSULE  
+    radius = 1.2
+    height = 6.0
+    center = 0, 3.0, 0
+    centerAbsolute = true
+    mass = 20.0
+    maxStepHeight = 0
+    maxSlopeAngle = 0
+}
+
+collisionObject camera
+{
+    type = GHOST_OBJECT
+    shape = SPHERE
+    radius = 0.5
+}

+ 208 - 0
samples/character/res/common/sample.scene

@@ -0,0 +1,208 @@
+scene
+{
+    path = res/common/sample.gpb
+
+    node boycharacter
+    {
+        collisionObject = res/common/sample.physics#boy
+    }
+
+    node boymesh
+    {
+        material = res/common/sample.material#boy
+        tags
+        {
+            dynamic
+        }
+    }
+
+    node boyshadow
+    {
+        material = res/common/sample.material#boyshadow
+        tags
+        {
+            transparent
+            dynamic
+        }
+    }
+
+    node camera
+    {
+        collisionObject = res/common/sample.physics#camera
+    }
+
+    node tabletop
+    {
+        material = res/common/sample.material#tabletop
+        collisionObject = res/common/sample.physics#table
+    }
+
+    node tableleg1
+    {
+        material = res/common/sample.material#tableleg1
+        collisionObject = res/common/sample.physics#table
+    }
+
+    node tableleg2
+    {
+        material = res/common/sample.material#tableleg2
+        collisionObject = res/common/sample.physics#table
+    }
+
+    node tableleg3
+    {
+        material = res/common/sample.material#tableleg3
+        collisionObject = res/common/sample.physics#table
+    }
+
+    node tableleg4
+    {
+        material = res/common/sample.material#tableleg4
+        collisionObject = res/common/sample.physics#table
+    }
+
+    node greenchair1
+    {
+        material = res/common/sample.material#green
+        collisionObject = res/common/sample.physics#chair
+        tags
+        {
+            dynamic
+        }
+    }
+    node greenchair2 : greenchair1 {}
+    node greenchair3 : greenchair1 {}
+
+    node bluechair1
+    {
+        material = res/common/sample.material#lightblue
+        collisionObject = res/common/sample.physics#chair
+        tags
+        {
+            dynamic
+        }
+    }
+    node bluechair2 : bluechair1 {}
+    node bluechair3 : bluechair1 {}
+
+    node playtable
+    {
+        material = res/common/sample.material#playtable
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node easel
+    {
+        material = res/common/sample.material#easel
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node storageorganizer
+    {
+        material = res/common/sample.material#storageorganizer
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node floor
+    {
+        material = res/common/sample.material#floor
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node wallwest
+    {
+        material = res/common/sample.material#wallwest
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node walleast
+    {
+        material = res/common/sample.material#walleast
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node wallnorth
+    {
+        material = res/common/sample.material#wallnorth
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node wallsouth
+    {
+        material = res/common/sample.material#wallsouth
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node walloverhang
+    {
+        material = res/common/sample.material#walloverhang
+        collisionObject = res/common/sample.physics#staticMesh
+    }
+
+    node windowledge
+    {
+        material = res/common/sample.material#windowledge
+    }
+
+    node door
+    {
+        material = res/common/sample.material#door
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node doorframe
+    {
+        material = res/common/sample.material#doorframe
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node bookshelf
+    {
+        material = res/common/sample.material#bookshelf
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node book
+    {
+        material = res/common/sample.material#book
+    }
+
+    node toybox
+    {
+        material = res/common/sample.material#toybox
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node floortiles
+    {
+        material = res/common/sample.material#floortiles
+    }
+
+    node basketball
+    {
+        material = res/common/sample.material#basketball
+        collisionObject = res/common/sample.physics#basketball
+        tags
+        {
+            dynamic
+        }
+    }
+
+    node basketballnet
+    {
+        material = res/common/sample.material#basketballnet
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    node backboard
+    {
+        material = res/common/sample.material#backboard
+        collisionObject = res/common/sample.physics#staticBox
+    }
+
+    physics
+    {
+        // TODO: Fixme Gravity is set to 3x normal gravity to compenate for larger scale of scene. Bug
+        gravity = 0.0, -29.4, 0.0
+    }
+}

BIN
samples/character/res/design/boy.png


BIN
samples/lua/res/lua-logo.png


BIN
samples/lua/res/lua.fbx


BIN
samples/lua/res/lua.gpb


+ 62 - 0
samples/lua/res/lua.material

@@ -0,0 +1,62 @@
+material cube
+{
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+            defines = SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
+            
+            // uniforms
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+            u_cameraPosition = CAMERA_WORLD_POSITION
+            u_ambientColor = SCENE_AMBIENT_COLOR
+            u_specularExponent = 50
+            
+            // samplers
+            sampler u_diffuseTexture
+            {
+                path = res/lua-logo.png
+                mipmap = true
+                wrapS = CLAMP
+                wrapT = CLAMP
+                minFilter = LINEAR_MIPMAP_LINEAR
+                magFilter = LINEAR
+            }
+
+            // render state
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+            }
+        }
+    }
+}
+
+material grid
+{
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
+			defines = VERTEX_COLOR
+
+             // uniforms
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            
+            // render state
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+            }
+        }
+    }
+}

BIN
samples/lua/res/lua.mb


BIN
samples/mesh/res/duck.png


BIN
samples/mesh/res/mesh.fbx


BIN
samples/mesh/res/mesh.gpb


+ 62 - 0
samples/mesh/res/mesh.material

@@ -0,0 +1,62 @@
+material duck
+{
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+            defines = SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
+            
+            // uniforms
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+            u_cameraPosition = CAMERA_WORLD_POSITION
+            u_ambientColor = 0.2, 0.2, 0.2
+            u_specularExponent = 50
+            
+            // samplers
+            sampler u_diffuseTexture
+            {
+                path = res/duck.png
+                mipmap = true
+                wrapS = CLAMP
+                wrapT = CLAMP
+                minFilter = NEAREST_MIPMAP_LINEAR
+                magFilter = LINEAR
+            }
+
+            // render state
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+            }
+        }
+    }
+}
+
+material grid
+{
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
+			defines = VERTEX_COLOR
+
+             // uniforms
+            u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+            
+            // render state
+            renderState
+            {
+                cullFace = true
+                depthTest = true
+            }
+        }
+    }
+}

BIN
samples/mesh/res/mesh.mb


+ 9 - 0
samples/mesh/res/mesh.scene

@@ -0,0 +1,9 @@
+scene
+{
+    path = res/mesh.gpb
+    
+    node duck
+    {
+        material = res/mesh.material#duck
+    }
+}

BIN
samples/racer/res/common/heightmap-combinedmap_0.png


BIN
samples/racer/res/common/racer.gpb


+ 142 - 0
samples/racer/res/common/racer.lua

@@ -0,0 +1,142 @@
+
+-- Move speed (m/s)
+MOVE_SPEED_NORMAL = 50
+MOVE_SPEED_FAST = 200
+
+-- Move flags
+MOVE_FORWARD = 1
+MOVE_BACKWARD = 2
+MOVE_RIGHT = 3
+MOVE_LEFT = 4
+
+_useScriptCamera = false
+_forwardSpeed = 0
+_sideSpeed = 0
+_touch = Vector2.new()
+_delta = Vector2.new()
+_move = Vector2.new()
+_moveFlags = { false, false, false, false }
+_yaw = 0
+_pitch = 0
+_shiftDown = false
+
+function setScene(scene)
+    _scene = scene
+    _cameraNode = scene:getActiveCamera():getNode()
+end
+
+function toggleCamera()
+    _useScriptCamera = not _useScriptCamera
+end
+
+function initialize()
+end
+
+function finalize()
+end
+
+function update(elapsedTime)
+
+    if not _useScriptCamera then
+        return
+    end
+
+    local secs = elapsedTime / 1000.0
+
+    _move:set(0,0)
+
+    -- Forward motion
+    if _moveFlags[MOVE_FORWARD] then
+        _move:y(1)
+    elseif _moveFlags[MOVE_BACKWARD] then
+        _move:y(-1)
+    end
+
+    -- Strafing
+    if _moveFlags[MOVE_LEFT] then
+        _move:x(1)
+    elseif _moveFlags[MOVE_RIGHT] then
+        _move:x(-1)
+    end
+
+    if not _move:isZero() then
+        local speed = MOVE_SPEED_NORMAL
+        if _shiftDown then
+            speed = MOVE_SPEED_FAST
+        end
+
+        _move:normalize():scale(secs * speed)
+
+        moveForward(_move:y());
+        moveRight(-_move:x());
+    end
+end
+
+function render(elapsedTime)
+end
+
+function keyEvent(evt, key)
+    if evt == Keyboard.KEY_PRESS then
+        if key == Keyboard.KEY_W or key == Keyboard.KEY_CAPITAL_W then
+            _moveFlags[MOVE_FORWARD] = true
+        elseif key == Keyboard.KEY_S or key == Keyboard.KEY_CAPITAL_S then
+            _moveFlags[MOVE_BACKWARD] = true
+        elseif key == Keyboard.KEY_A or key == Keyboard.KEY_CAPITAL_A then
+            _moveFlags[MOVE_LEFT] = true
+        elseif key == Keyboard.KEY_D or key == Keyboard.KEY_CAPITAL_D then
+            _moveFlags[MOVE_RIGHT] = true
+        elseif key == Keyboard.KEY_C then
+            _useScriptCamera = not _useScriptCamera
+        elseif key == Keyboard.KEY_SHIFT then
+            _shiftDown = true
+        end
+    elseif evt == Keyboard.KEY_RELEASE then
+        if key == Keyboard.KEY_W or key == Keyboard.KEY_CAPITAL_W then
+            _moveFlags[MOVE_FORWARD] = false
+        elseif key == Keyboard.KEY_S or key == Keyboard.KEY_CAPITAL_S then
+            _moveFlags[MOVE_BACKWARD] = false
+        elseif key == Keyboard.KEY_A or key == Keyboard.KEY_CAPITAL_A then
+            _moveFlags[MOVE_LEFT] = false
+        elseif key == Keyboard.KEY_D or key == Keyboard.KEY_CAPITAL_D then
+            _moveFlags[MOVE_RIGHT] = false
+        elseif key == Keyboard.KEY_SHIFT then
+            _shiftDown = false
+        end
+    end
+
+    return false
+end
+
+function touchEvent(evt, x, y, contactIndex)
+
+    if not _useScriptCamera then
+        return
+    end
+
+    if evt == Touch.TOUCH_PRESS then
+        _touch:set(x, y)
+    elseif evt == Touch.TOUCH_RELEASE then
+    elseif evt == Touch.TOUCH_MOVE then
+        _delta:set(x - _touch:x(), y - _touch:y())
+        _touch:set(x, y)
+        _pitch = _pitch + -math.rad(_delta:y() * 0.5)
+        _yaw = _yaw + math.rad(_delta:x() * 0.5)
+        _cameraNode:setRotation(Quaternion.identity())
+        _cameraNode:rotateY(-_yaw)
+        _cameraNode:rotateX(_pitch)
+    end
+
+    return false
+end
+
+function moveForward(by)
+    local v = _cameraNode:getForwardVector()
+    v:normalize():scale(by)
+    _cameraNode:translate(v)
+end
+
+function moveRight(by)
+    local v = _cameraNode:getRightVector()
+    v:normalize():scale(by)
+    _cameraNode:translate(v)
+end

+ 517 - 0
samples/racer/res/common/racer.material

@@ -0,0 +1,517 @@
+material textured
+{
+    // uniforms
+    u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+    u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+
+    // samplers
+    sampler u_diffuseTexture
+    {
+        mipmap = true
+        wrapS = REPEAT
+        wrapT = REPEAT
+        minFilter = LINEAR_MIPMAP_LINEAR
+        magFilter = LINEAR
+    }
+
+    // render state
+    renderState
+    {
+        cullFace = true
+        depthTest = true
+    }
+
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
+        }
+    }
+}
+
+material texturedUnlit
+{
+    // uniforms
+    u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+
+    // samplers
+    sampler u_diffuseTexture
+    {
+        mipmap = true
+        wrapS = REPEAT
+        wrapT = REPEAT
+        minFilter = LINEAR_MIPMAP_LINEAR
+        magFilter = LINEAR
+    }
+
+    // render state
+    renderState
+    {
+        cullFace = true
+        depthTest = true
+    }
+
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+        }
+    }
+}
+
+material textured-alphatest : texturedUnlit
+{
+    technique
+    {
+        pass 0
+        {
+            defines = TEXTURE_DISCARD_ALPHA
+        }
+    }
+}
+
+material colored
+{
+    // uniforms
+    u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+    u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+
+    // render state
+    renderState
+    {
+        cullFace = true
+        depthTest = true
+    }
+
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
+        }
+    }
+}
+
+material coloredUnlit
+{
+    // uniforms
+    u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
+    
+    // render state
+    renderState
+    {
+        cullFace = true
+        depthTest = true
+    }
+
+    technique
+    {
+        pass 0
+        {
+            // shaders
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
+        }
+    }
+}
+
+material car : textured
+{
+    sampler u_diffuseTexture
+    {
+        path = @car
+    }
+}
+
+material tile : texturedUnlit
+{
+}
+
+material tile1 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_1
+    }
+}
+
+material tile2 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_2
+    }
+}
+
+material tile3 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_3
+    }
+}
+
+material tile4 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_4
+    }
+}
+
+material tile5 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_5
+    }
+}
+
+material tile6 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_6
+    }
+}
+
+material tile7 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_7
+    }
+}
+
+material tile8 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_8
+    }
+}
+
+material tile9 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_9
+    }
+}
+
+material tile10 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_10
+    }
+}
+
+material tile11 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_11
+    }
+}
+
+material tile12 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_12
+    }
+}
+
+material tile13 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_13
+    }
+}
+
+material tile14 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_14
+    }
+}
+
+material tile15 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_15
+    }
+}
+
+material tile16 : tile
+{
+    sampler u_diffuseTexture
+    {
+        path = @panel_16
+    }
+}
+
+material track : texturedUnlit
+{
+    sampler u_diffuseTexture
+    {
+        path = @gravel_2
+    }
+
+    sampler u_lightmapTexture
+    {
+        path = @track_1
+        mipmap = true
+        wrapS = REPEAT
+        wrapT = REPEAT
+        minFilter = LINEAR_MIPMAP_LINEAR
+        magFilter = LINEAR
+    }
+
+    technique
+    {
+        pass 0
+        {
+            defines = LIGHTMAP;TEXCOORD1
+        }
+    }
+}
+
+material pillar : textured
+{
+    sampler u_diffuseTexture
+    {
+        path = @textures_8
+    }
+}
+
+material rail : texturedUnlit
+{
+    sampler u_diffuseTexture
+    {
+        path = @rails
+    }
+
+    renderState
+    {
+        cullFace = false
+        blend = true
+        srcBlend = SRC_ALPHA
+        dstBlend = ONE_MINUS_SRC_ALPHA
+    }
+}
+
+material tree : textured-alphatest
+{
+    renderState
+    {
+        cullFace = false
+    }
+}
+
+material treepine : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @tree_3
+    }
+}
+
+material treelightgreen : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @tree_7
+    }
+}
+
+material treebig : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @tree_4
+    }
+}
+
+material treebrown : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @tree_2
+    }
+}
+
+material treetall : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @tree
+    }
+}
+
+material treetallpine : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @tree_5
+    }
+}
+
+material treewhitepine : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @tree_6
+    }
+}
+
+material treedetailed : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @d_tree
+    }
+}
+
+material shrublightgreen : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @shrub_1
+    }
+}
+
+material shrubdark : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @shrub_2
+    }
+}
+
+material shruborange : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @shrub_3
+    }
+}
+
+material grassgreen : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @grassbunch_1
+    }
+}
+
+material grassred : tree
+{
+    sampler u_diffuseTexture
+    {
+        path = @grassbunch_2
+    }
+}
+
+material trunk : textured
+{
+    sampler u_diffuseTexture
+    {
+        path = @trunk_1
+    }
+}
+
+material trunk2 : textured
+{
+    sampler u_diffuseTexture
+    {
+        path = @trunk_2
+    }
+}
+
+material chain : textured-alphatest
+{
+    sampler u_diffuseTexture
+    {
+        path = @chain_fence_1
+    }
+
+    renderState
+    {
+        cullFace = false
+    }
+}
+
+material wall : texturedUnlit
+{
+    sampler u_diffuseTexture
+    {
+        path = @design_11
+    }
+}
+
+material lightpost : colored
+{
+    u_diffuseColor = 0.1, 0.1, 0.1, 1.0
+}
+
+material lightbulb : coloredUnlit
+{
+    u_diffuseColor = 1, 1, 0.815, 1
+}
+
+material water : colored
+{
+    u_diffuseColor = 0.75, 0.9, 0.95, 0.85
+
+    renderState
+    {
+        blend = true
+        srcBlend = SRC_ALPHA
+        dstBlend = ONE_MINUS_SRC_ALPHA
+    }
+}
+
+material mountains : texturedUnlit
+{
+    sampler u_diffuseTexture
+    {
+        path = @panorama_2
+    }
+
+    renderState
+    {
+        cullFace = false
+        depthWrite = false
+        blend = true
+        srcBlend = SRC_ALPHA
+        dstBlend = ONE_MINUS_SRC_ALPHA
+    }
+}
+
+material skydome : texturedUnlit
+{
+    sampler u_diffuseTexture
+    {
+        path = @panorama_3
+    }
+
+    renderState
+    {
+        cullFace = false
+    }
+}

+ 180 - 0
samples/racer/res/common/racer.physics

@@ -0,0 +1,180 @@
+collisionObject static_box
+{
+    type = RIGID_BODY
+    shape = BOX
+    mass = 0.0
+}
+
+collisionObject static_mesh
+{
+    type = RIGID_BODY
+    shape = MESH
+    mass = 0.0
+}
+
+collisionObject car
+{
+    type = VEHICLE
+
+    shape = BOX
+    mass = 800.0
+    friction = 0.5
+    restitution = 0.01
+    linearDamping = 0.025
+    angularDamping = 0.6
+
+    steeringGain = 0.4
+    brakingForce = 350.0
+    drivingForce = 2000.0
+
+    steerdownSpeed = 87
+    steerdownGain = 0.22
+    brakedownStart = 100
+    brakedownFull = 170
+    drivedownStart = 105
+    drivedownFull = 180
+    boostSpeed = 74
+    boostGain = 2.6
+    downforce = 4.5
+}
+
+collisionObject carWheel
+{
+    type = VEHICLE_WHEEL
+
+    shape = MESH
+    mass = 1.0
+    friction = 0.5
+    restitution = 0.01
+    linearDamping = 0.025
+    angularDamping = 0.16
+
+    wheelDirection = 0, -1, 0
+    wheelAxle = -1, 0, 0
+
+    strutRestLength = 0.6
+    strutStiffness = 25.0
+    strutDampingCompression = 5.1
+    strutDampingRelaxation = 2.3
+    frictionBreakout = 1000.0
+    wheelRadius = 0.5
+    rollInfluence = 0.1
+    strutConnectionOffset = 0.0, 0.0, 1.4
+}
+
+collisionObject carWheelFrontLeft : carWheel
+{
+    steerable = true
+}
+
+collisionObject carWheelFrontRight : carWheel
+{
+    steerable = true
+}
+
+collisionObject carWheelBackLeft : carWheel
+{
+    steerable = false
+}
+
+collisionObject carWheelBackRight : carWheel
+{
+    steerable = false
+}
+
+collisionObject heightfield
+{
+    type = RIGID_BODY
+    shape = HEIGHTFIELD
+    image = res/common/heightmap_combinedmap_0.png
+    kinematic = true
+}
+
+collisionObject ghost_box
+{
+	type = GHOST_OBJECT
+	shape = BOX
+	extents = 1.0, 1.0, 1.0
+}
+
+collisionObject guard_rail
+{
+    type = RIGID_BODY
+    shape = MESH
+    mass = 0.0
+    restitution = 0.01
+}
+
+collisionObject roadway
+{
+    type = RIGID_BODY
+    shape = MESH
+    mass = 0.0
+    restitution = 0.01
+}
+
+collisionObject treetall
+{
+    type = RIGID_BODY
+    shape = CAPSULE
+    radius = 1.0
+    height = 24
+    center = 0, 10, 0
+    centerAbsolute = true
+    mass = 0.0
+}
+
+collisionObject treelightgreen
+{
+    type = RIGID_BODY
+    shape = CAPSULE
+    radius = 0.75
+    height = 24
+    center = 0, 10, 0
+    centerAbsolute = true
+    mass = 0.0
+}
+
+collisionObject treebrown
+{
+    type = RIGID_BODY
+    shape = CAPSULE
+    radius = 3.0
+    height = 24
+    center = 0, 10, 0
+    centerAbsolute = true
+    mass = 0.0
+}
+
+collisionObject treebig
+{
+    type = RIGID_BODY
+    shape = CAPSULE
+    radius = 5
+    height = 30
+    center = 0, 10, 0
+    centerAbsolute = true
+    mass = 0.0
+}
+
+collisionObject treepine
+{
+    type = RIGID_BODY
+    shape = CAPSULE
+    radius = 5
+    height = 30
+    center = 0, 8, 0
+    centerAbsolute = true
+    mass = 0.0
+}
+
+collisionObject treetallpine
+{
+    type = RIGID_BODY
+    shape = CAPSULE
+    radius = 1.5
+    height = 30
+    center = 0, 12, 0
+    centerAbsolute = true
+    mass = 0.0
+}

+ 392 - 0
samples/racer/res/common/racer.scene

@@ -0,0 +1,392 @@
+scene main
+{
+    path = res/common/racer.gpb
+
+    activeCamera = camera1
+
+    node carbody
+    {
+        url = car_top
+        material = res/common/racer.material#car
+        collisionObject = res/common/racer.physics#car
+    }
+
+    node wheelFrontLeft
+    {
+        url = Left_top
+        material = res/common/racer.material#car
+        collisionObject = res/common/racer.physics#carWheelFrontLeft
+    }
+
+    node wheelFrontRight
+    {
+        url = Right_top
+        material = res/common/racer.material#car
+        collisionObject = res/common/racer.physics#carWheelFrontRight
+    }
+
+    node wheelBackLeft
+    {
+        url = Left_bottom
+        material = res/common/racer.material#car
+        collisionObject = res/common/racer.physics#carWheelBackLeft
+    }
+
+    node wheelBackRight
+    {
+        url = Right_bottom
+        material = res/common/racer.material#car
+        collisionObject = res/common/racer.physics#carWheelBackRight
+    }
+
+    node mapplane_1
+    {
+        material = res/common/racer.material#tile1
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_2
+    {
+        material = res/common/racer.material#tile2
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_3
+    {
+        material = res/common/racer.material#tile3
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_4
+    {
+        material = res/common/racer.material#tile4
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_5
+    {
+        material = res/common/racer.material#tile5
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_6
+    {
+        material = res/common/racer.material#tile6
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_7
+    {
+        material = res/common/racer.material#tile7
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_8
+    {
+        material = res/common/racer.material#tile8
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_9
+    {
+        material = res/common/racer.material#tile9
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_10
+    {
+        material = res/common/racer.material#tile10
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_11
+    {
+        material = res/common/racer.material#tile11
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_12
+    {
+        material = res/common/racer.material#tile12
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_13
+    {
+        material = res/common/racer.material#tile13
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_14
+    {
+        material = res/common/racer.material#tile14
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_15
+    {
+        material = res/common/racer.material#tile15
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node mapplane_16
+    {
+        material = res/common/racer.material#tile16
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node overhang_1
+    {
+        material = res/common/racer.material#tile3
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node overhang_2
+    {
+        material = res/common/racer.material#tile3
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node overhang_3
+    {
+        material = res/common/racer.material#tile11
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node overhang_4
+    {
+        material = res/common/racer.material#tile12
+        collisionObject = res/common/racer.physics#static_mesh
+    }
+
+    node track_0
+    {
+        material = res/common/racer.material#track
+        collisionObject = res/common/racer.physics#roadway
+    }
+
+    node pillar
+    {
+        url = pillar_*
+        material = res/common/racer.material#pillar
+    }
+
+    node rail_1
+    {
+        material = res/common/racer.material#rail
+        collisionObject = res/common/racer.physics#guard_rail
+        tags
+        {
+            transparent
+        }
+    }
+
+    node rail_2
+    {
+        material = res/common/racer.material#rail
+        collisionObject = res/common/racer.physics#guard_rail
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treepine
+    {
+        url = treepine_*
+        material = res/common/racer.material#treepine
+        collisionObject = res/common/racer.physics#treepine
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treelightgreen
+    {
+        url = treelightgreen_*
+        material[0] = res/common/racer.material#treelightgreen
+        material[1] = res/common/racer.material#trunk
+        collisionObject = res/common/racer.physics#treelightgreen
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treebig
+    {
+        url = treebig_*
+        material[0] = res/common/racer.material#treebig
+        material[1] = res/common/racer.material#trunk
+        collisionObject = res/common/racer.physics#treebig
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treebrown
+    {
+        url = treebrown_*
+        material[1] = res/common/racer.material#treebrown
+        material[0] = res/common/racer.material#trunk
+        collisionObject = res/common/racer.physics#treebrown
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treetall
+    {
+        url = treetall_*
+        material[0] = res/common/racer.material#treetall
+        material[1] = res/common/racer.material#trunk
+        collisionObject = res/common/racer.physics#treetall
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treetallpine
+    {
+        url = treetallpine*
+        material = res/common/racer.material#treetallpine
+        collisionObject = res/common/racer.physics#treetallpine
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treewhitepine
+    {
+        url = treewhitepine*
+        material = res/common/racer.material#treewhitepine
+        collisionObject = res/common/racer.physics#treepine
+        tags
+        {
+            transparent
+        }
+    }
+
+    node treedetailed
+    {
+        url = treedetailed*
+        material[0] = res/common/racer.material#trunk2
+        material[1] = res/common/racer.material#treedetailed
+        collisionObject = res/common/racer.physics#static_mesh
+        tags
+        {
+            transparent
+        }
+    }
+
+    node shrublightgreen
+    {
+        url = shrublightgreen_*
+        material = res/common/racer.material#shrublightgreen
+        tags
+        {
+            transparent
+        }
+    }
+
+    node shrubdark
+    {
+        url = shrubdark_*
+        material = res/common/racer.material#shrubdark
+        tags
+        {
+            transparent
+        }
+    }
+
+    node shruborange
+    {
+        url = shruborange_*
+        material = res/common/racer.material#shruborange
+        tags
+        {
+            transparent
+        }
+    }
+
+    node shrubyellow
+    {
+        url = shrubyellow_*
+        material = res/common/racer.material#shruborange
+        tags
+        {
+            transparent
+        }
+    }
+
+    node grassdrygreen
+    {
+        url = grassdrygreen*
+        material = res/common/racer.material#grassgreen
+        tags
+        {
+            transparent
+        }
+    }
+
+    node grassdryred
+    {
+        url = grassdryred*
+        material = res/common/racer.material#grassred
+        tags
+        {
+            transparent
+        }
+    }
+
+    node chainfence_0
+    {
+        material[0] = res/common/racer.material#chain
+        material[1] = res/common/racer.material#wall
+        collisionObject = res/common/racer.physics#static_mesh
+        tags
+        {
+            transparent
+        }
+    }
+
+    node light
+    {
+        url = light_*
+        material[0] = res/common/racer.material#lightpost
+        material[1] = res/common/racer.material#lightbulb
+    }
+
+    node water
+    {
+        material = res/common/racer.material#water
+        tags
+        {
+            transparent
+        }
+    }
+
+    node mountains_0
+    {
+        material = res/common/racer.material#mountains
+        tags
+        {
+            transparent
+        }
+    }
+
+    node skydome_0
+    {
+        material = res/common/racer.material#skydome
+    }
+
+    physics
+    {
+        gravity = 0.0, -9.8, 0.0
+    }
+}