فهرست منبع

Revert "Modified character sample to test support for non-flat terrain in PhysicsCharacter."

This reverts commit 94ae6f9ede85cec0eb18a98ba697069622908c8b.

To test the support for non-flat terrain, simply checkout the commit previous to this revert commit.
Ken Whatmough 12 سال پیش
والد
کامیت
c0228cf867

+ 2 - 27
samples/character/res/common/sample.scene

@@ -124,7 +124,7 @@ scene
     node wallnorth
     {
         material = res/common/sample.material#wallnorth
-        collisionObject = res/common/sample.physics#staticMesh
+        collisionObject = res/common/sample.physics#staticBox
     }
 
     node wallsouth
@@ -153,7 +153,7 @@ scene
     node doorframe
     {
         material = res/common/sample.material#doorframe
-        collisionObject = res/common/sample.physics#staticMesh
+        collisionObject = res/common/sample.physics#staticBox
     }
 
     node bookshelf
@@ -200,31 +200,6 @@ scene
         collisionObject = res/common/sample.physics#staticBox
     }
 
-	node terrain
-	{
-		terrain = res/common/terrain/sample.terrain
-
-        translate = -2500,-430,2500
-
-		collisionObject
-		{
-			type = RIGID_BODY
-			shape = HEIGHTFIELD
-			mass = 0
-			kinematic = true
-		}
-	}
-
-    node sky
-    {
-        url = res/common/terrain/sky.gpb#sphere
-
-        material = res/common/terrain/sky.material
-
-        scale = 30000,30000,30000
-        translate = 0,25000,0
-    }
-
     physics
     {
         // TODO: Fixme Gravity is set to 3x normal gravity to compenate for larger scale of scene. Bug

BIN
samples/character/res/common/terrain/dirt.dds


+ 0 - 19
samples/character/res/common/terrain/encode.bat

@@ -1,19 +0,0 @@
-@echo off
-
-set encoder="..\..\..\..\bin\windows\gameplay-encoder.exe"
-
-REM ====================================================================
-REM Generate sky model
-REM ====================================================================
-%encoder% sky.fbx
-
-REM ====================================================================
-REM Generate normal map for terrain.
-REM NOTE: Encoder currently expects a .raw format, so temporarily rename
-REM .r16 to .raw for normal map generation.
-REM ====================================================================
-copy /Y heightmap.r16 heightmap.raw
-%encoder% -n -w 10000,4000,10000 -s 256,256 heightmap.raw normalmap.png
-del /Q heightmap.raw
-
-pause

BIN
samples/character/res/common/terrain/grass.dds


BIN
samples/character/res/common/terrain/heightmap.r16


BIN
samples/character/res/common/terrain/normalmap.dds


BIN
samples/character/res/common/terrain/rock.dds


+ 0 - 66
samples/character/res/common/terrain/sample.scene

@@ -1,66 +0,0 @@
-scene terrainSampleScene
-{
-	node terrain
-	{
-		terrain = res/common/terrain/sample.terrain
-
-		collisionObject
-		{
-			type = RIGID_BODY
-			shape = HEIGHTFIELD
-			mass = 0
-			kinematic = true
-		}
-	}
-
-    node sky
-    {
-        url = res/common/terrain/sky.gpb#sphere
-
-        material = res/common/terrain/sky.material
-
-        scale = 30000,30000,30000
-        translate = 0,25000,0
-    }
-
-    node directionalLight
-    {
-        light
-        {
-            type = DIRECTIONAL
-            color = 1,1,1
-        }
-
-        rotate = 1,0,0, -45
-    }
-
-	node camera
-	{
-		camera
-		{
-			type = PERSPECTIVE
-			nearPlane = 1.0
-			farPlane = 100000
-		}
-
-        // Starting position on ground
-		translate = 3095, 369, -4393
-		rotate = 0,1,0, 148
-
-        // Screenshot position in air (screenshots)
-        //translate = 3824, 1466, -3622
-        //rotate = 0, 1.0, 0, 142
-	}
-
-	// Basic scene lighting properties
-	ambientColor = 0.2, 0.2, 0.2
-
-	// Set active camera
-	activeCamera = camera
-
-    physics
-    {
-        // Bump up gravity force for this sample since our units are larger than normal
-        gravity = 0, -90, 0
-    }
-}

+ 0 - 56
samples/character/res/common/terrain/sample.terrain

@@ -1,56 +0,0 @@
-terrain
-{
-    material = res/common/terrain/terrain.material
-
-	heightmap
-	{
-		path = res/common/terrain/heightmap.r16
-		size = 256, 256
-	}
-
-	size = 10000, 4000, 10000
-	patchSize = 32
-	detailLevels = 3
-	skirtScale = 0.1
-
-    normalMap = res/common/terrain/normalmap.dds
-
-	layer rock
-	{
-		texture
-		{
-			path = res/common/terrain/rock.dds
-			repeat = 30,30
-		}
-	}
-
-    layer dirt
-    {
-		texture
-		{
-			path = res/common/terrain/dirt.dds
-			repeat = 750,750
-		}
-
-		blend
-		{
-            path = res/common/terrain/dirt.dds
-            channel = 3
-		}
-    }
-
-    layer grass
-	{
-		texture
-		{
-			path = res/common/terrain/grass.dds
-			repeat = 500,500
-		}
-
-		blend
-		{
-            path = res/common/terrain/grass.dds
-            channel = 3
-		}
-	}
-}

+ 0 - 50
samples/character/res/common/terrain/shapes.material

@@ -1,50 +0,0 @@
-material textured
-{
-    u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
-    u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
-
-    u_ambientColor = SCENE_AMBIENT_COLOR
-    u_directionalLightDirection[0] = LIGHT_DIRECTION_0
-    u_directionalLightColor[0] = LIGHT_COLOR_0
-
-    sampler u_diffuseTexture
-    {
-        mipmap = true
-        wrapS = CLAMP
-        wrapT = CLAMP
-        minFilter = LINEAR_MIPMAP_LINEAR
-        magFilter = LINEAR
-    }
-
-    renderState
-    {
-        cullFace = true
-        depthTest = true
-    }
-
-    technique
-    {
-        pass
-        {
-            vertexShader = res/shaders/textured.vert
-            fragmentShader = res/shaders/textured.frag
-            defines = DIRECTIONAL_LIGHT_COUNT 1
-        }
-    }
-}
-
-material sphere : textured
-{
-    sampler u_diffuseTexture
-    {
-        path = res/png/dirt.png
-    }
-}
-
-material box : textured
-{
-    sampler u_diffuseTexture
-    {
-        path = res/png/crate.png
-    }
-}

BIN
samples/character/res/common/terrain/sky.dds


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 286
samples/character/res/common/terrain/sky.fbx


BIN
samples/character/res/common/terrain/sky.gpb


+ 0 - 29
samples/character/res/common/terrain/sky.material

@@ -1,29 +0,0 @@
-material sky
-{
-    u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
-
-    sampler u_diffuseTexture
-    {
-        path = res/common/terrain/sky.dds
-        mipmap = true
-        wrapS = REPEAT
-        wrapT = REPEAT
-        minFilter = LINEAR_MIPMAP_LINEAR
-        magFilter = LINEAR
-    }
-
-    renderState
-    {
-        cullFace = true
-        depthTest = true
-    }
-
-    technique
-    {
-        pass
-        {
-            vertexShader = res/shaders/textured.vert
-            fragmentShader = res/shaders/textured.frag
-        }
-    }
-}

+ 0 - 154
samples/character/res/common/terrain/terrain.form

@@ -1,154 +0,0 @@
-form terrainForm
-{
-    theme = res/common/default.theme
-
-    style = Container
-    autoWidth = true
-    autoHeight = true
-    consumeInputEvents = false
-
-    padding
-    {
-        left = 5
-        top = 5
-        right = 50
-        bottom = 5
-    }
-
-    container main
-    {
-        style = Form
-        width = 230
-        height = 395
-        consumeInputEvents = false
-
-        padding
-        {
-            top = -5
-            left = -5
-        }
-
-        button plusButton
-        {
-            style = plus
-            width = 40
-            height = 40
-            visible = false
-        }
-
-        button minusButton
-        {
-            style = minus
-            width = 40
-            height = 40
-        }
-
-        container settings
-        {
-            autoWidth = true
-            autoHeight = true
-            consumeInputEvents = false
-
-            checkbox wireframe
-		    {
-			    imageSize = 35, 35
-			    size = 200, 40
-                position = 10, 50
-			    text = Wireframe (1)
-                textAlignment = ALIGN_VCENTER_LEFT
-                fontSize = 16
-                checked = false
-		    }
-
-            checkbox patches : wireframe
-		    {
-                position = 10, 90
-			    text = Debug Patches (2)
-                checked = false
-		    }
-
-            checkbox physics : wireframe
-            {
-                position = 10, 130
-			    text = Debug Physics (3)
-                checked = false
-            }
-
-            checkbox lod : wireframe
-		    {
-                position = 10, 170
-			    text = Level of Detail (4)
-                checked = true
-		    }
-
-            checkbox culling : wireframe
-		    {
-                position = 10, 210
-			    text = Frustum Culling (5)
-                checked = true
-		    }
-
-            checkbox snapToGround : wireframe
-		    {
-                position = 10, 250
-			    text = Snap To Ground (6)
-                checked = true
-		    }
-        }
-    }
-
-    container physicsSettings
-    {
-        style = Form
-        position = 0, 395
-        width = 230
-        height = 165
-        layout = LAYOUT_VERTICAL
-        consumeInputEvents = false
-
-        padding
-        {
-            top = 5
-            left = 5
-            right = 5
-            bottom = 5
-        }
-
-        button dropSphere
-        {
-            autoWidth = true
-            text = Drop Sphere
-            height = 45
-        }
-
-        button dropBox : dropSphere
-        {
-            text = Drop Box
-        }
-
-        button clearAll : dropSphere
-        {
-            text = Remove All
-        }
-    }
-
-    container messageBox
-    {
-        style = Form
-        alignment = ALIGN_VCENTER_HCENTER
-        width = 500
-        height = 50
-        consumeInputEvents = false
-        visible = false
-
-        label message
-        {
-            consumeInputEvents = false
-            autoWidth = true
-            autoHeight = true
-            font = res/ui/arial.gpb
-            fontSize = 24
-            textAlignment = ALIGN_VCENTER_HCENTER
-        }
-    }
-}

+ 0 - 29
samples/character/res/common/terrain/terrain.material

@@ -1,29 +0,0 @@
-
-material terrain
-{
-    u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
-
-    u_normalMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
-    u_normalMap = TERRAIN_NORMAL_MAP
-    u_surfaceLayerMaps = TERRAIN_LAYER_MAPS
-
-    u_ambientColor = SCENE_AMBIENT_COLOR
-    u_directionalLightDirection[0] = LIGHT_DIRECTION_0
-    u_directionalLightColor[0] = LIGHT_COLOR_0
-
-    renderState
-    {
-        cullFace = true
-        depthTest = true
-    }
-
-    technique
-    {
-        pass
-        {
-            vertexShader = res/shaders/terrain.vert
-            fragmentShader = res/shaders/terrain.frag
-            defines = DIRECTIONAL_LIGHT_COUNT 1
-        }
-    }
-}

+ 4 - 10
samples/character/src/CharacterGame.cpp

@@ -58,8 +58,6 @@ void CharacterGame::initialize()
     rbParams.angularDamping = 0.16f;
     ceiling->setCollisionObject(PhysicsCollisionObject::RIGID_BODY, PhysicsCollisionShape::box(Vector3(49.5f, 1.0f, 49.5f)), &rbParams);
 
-    _scene->removeNode(_scene->findNode("door"));
-
     // Initialize scene.
     _scene->visit(this, &CharacterGame::initializeScene);
 
@@ -98,7 +96,6 @@ void CharacterGame::initializeCharacter()
     
     // Store the physics character object.
     _character = static_cast<PhysicsCharacter*>(node->getCollisionObject());
-    _character->setMaxSlopeAngle(20.0f);
     
     // Store character nodes.
     _characterNode = node->findNode("boyScale");
@@ -149,14 +146,7 @@ void CharacterGame::drawSplash(void* param)
 bool CharacterGame::drawScene(Node* node, bool transparent)
 {
     if (node->getModel() && (transparent == node->hasTag("transparent")))
-    {
         node->getModel()->draw(_wireframe);
-    }
-    else if (node->getTerrain())
-    {
-        Terrain* terrain = node->getTerrain();
-        terrain->draw(_wireframe);
-    }
 
     return true;
 }
@@ -646,6 +636,8 @@ void CharacterGame::grabBall()
     Node* boy = _character->getNode();
     boy->setCollisionObject(PhysicsCollisionObject::CHARACTER, PhysicsCollisionShape::capsule(2.9f, 6.0f, Vector3(0.0f, 3.0f, 0.0f), true), &rbParams);
     _character = static_cast<PhysicsCharacter*>(boy->getCollisionObject());
+    _character->setMaxSlopeAngle(0.0f);
+    _character->setMaxStepHeight(0.0f);
     _character->setVelocity(currentVelocity);
 }
 
@@ -659,6 +651,8 @@ void CharacterGame::releaseBall()
     boy->setCollisionObject(PhysicsCollisionObject::CHARACTER, PhysicsCollisionShape::capsule(1.2f, 6.0f, Vector3(0.0f, 3.0f, 0.0f), true), &rbParams);
     _character = static_cast<PhysicsCharacter*>(boy->getCollisionObject());
     _character->setVelocity(velocity);
+    _character->setMaxSlopeAngle(0.0f);
+    _character->setMaxStepHeight(0.0f);
     
     PhysicsRigidBody* basketball = (PhysicsRigidBody*) _basketballNode->getCollisionObject();
     basketball->setEnabled(true);

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است