Browse Source

New stone texture.
Save each example scene with an unique name.
Update terrain batch LOD always in the main thread to avoid overhead of firing threaded work items, if there is no more CPU-consuming geometry updates (such as skinning) to be done.

Lasse Öörni 13 years ago
parent
commit
21c6bfd098

+ 2 - 2
Bin/Data/Materials/StoneSmall.xml

@@ -4,6 +4,6 @@
     <texture unit="diffuse" name="Textures/StoneDiffuse.dds" />
     <texture unit="normal" name="Textures/StoneNormal.dds" />
     <parameter name="MatSpecColor" value="0.5 0.5 0.5 16" />
-    <parameter name="UOffset" value="0.25 0 0 0" />
-    <parameter name="VOffset" value="0 0.25 0 0" />
+    <parameter name="UOffset" value="0.125 0 0 0" />
+    <parameter name="VOffset" value="0 0.125 0 0" />
 </material>

+ 9 - 0
Bin/Data/Materials/StoneTiled.xml

@@ -0,0 +1,9 @@
+<material>
+    <technique name="Techniques/DiffNormal.xml" quality="1" />
+    <technique name="Techniques/Diff.xml" quality="0" />
+    <texture unit="diffuse" name="Textures/StoneDiffuse.dds" />
+    <texture unit="normal" name="Textures/StoneNormal.dds" />
+    <parameter name="MatSpecColor" value="0.5 0.5 0.5 16" />
+    <parameter name="UOffset" value="4 0 0 0" />
+    <parameter name="VOffset" value="0 4 0 0" />
+</material>

+ 0 - 0
Bin/Data/Materials/StoneLargeH.xml → Bin/Data/Materials/StoneTiledH.xml


+ 5 - 5
Bin/Data/Scripts/Terrain.as

@@ -130,7 +130,7 @@ void InitScene()
 
     Node@ zoneNode = testScene.CreateChild("Zone");
     Zone@ zone = zoneNode.CreateComponent("Zone");
-    zone.ambientColor = Color(0.1, 0.1, 0.1);
+    zone.ambientColor = Color(0.2, 0.2, 0.2);
     zone.fogColor = Color(0.5, 0.5, 0.7);
     zone.fogStart = 500.0;
     zone.fogEnd = 1000.0;
@@ -308,13 +308,13 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
 
         if (key == KEY_F5)
         {
-            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_WRITE);
+            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Terrain.xml", FILE_WRITE);
             testScene.SaveXML(xmlFile);
         }
 
         if (key == KEY_F7)
         {
-            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_READ);
+            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Terrain.xml", FILE_READ);
             if (xmlFile.open)
                 testScene.LoadXML(xmlFile);
         }
@@ -402,8 +402,8 @@ void HandleSpawnBox(StringHash eventType, VariantMap& eventData)
     body.mass = 1.0;
     body.friction = 1.0;
     body.linearVelocity = rotation * Vector3(0.0, 1.0, 10.0);
-    body.ccdRadius = 0.25;
-    body.ccdMotionThreshold = 0.5;
+    body.ccdRadius = 0.15;
+    body.ccdMotionThreshold = 0.2;
 
     CollisionShape@ shape = newNode.CreateComponent("CollisionShape");
     shape.SetBox(Vector3(1, 1, 1));

+ 6 - 6
Bin/Data/Scripts/TestScene.as

@@ -129,7 +129,7 @@ void InitScene()
 
     Node@ zoneNode = testScene.CreateChild("Zone");
     Zone@ zone = zoneNode.CreateComponent("Zone");
-    zone.ambientColor = Color(0.1, 0.1, 0.1);
+    zone.ambientColor = Color(0.2, 0.2, 0.2);
     zone.fogColor = Color(0.5, 0.5, 0.7);
     zone.fogStart = 100.0;
     zone.fogEnd = 300.0;
@@ -137,7 +137,7 @@ void InitScene()
 
     {
         Node@ lightNode = testScene.CreateChild("GlobalLight");
-        lightNode.direction = Vector3(0.5, -0.5, 0.5);
+        lightNode.direction = Vector3(0.4, -0.5, 0.3);
 
         Light@ light = lightNode.CreateComponent("Light");
         light.lightType = LIGHT_DIRECTIONAL;
@@ -154,7 +154,7 @@ void InitScene()
 
         StaticModel@ object = objectNode.CreateComponent("StaticModel");
         object.model = cache.GetResource("Model", "Models/Box.mdl");
-        object.material = cache.GetResource("Material", "Materials/Stone.xml");
+        object.material = cache.GetResource("Material", "Materials/StoneTiled.xml");
         object.occluder = true;
 
         RigidBody@ body = objectNode.CreateComponent("RigidBody");
@@ -170,7 +170,7 @@ void InitScene()
 
         StaticModel@ object = objectNode.CreateComponent("StaticModel");
         object.model = cache.GetResource("Model", "Models/Box.mdl");
-        object.material = cache.GetResource("Material", "Materials/StoneSmall.xml");
+        object.material = cache.GetResource("Material", "Materials/Stone.xml");
         object.castShadows = true;
 
         RigidBody@ body = objectNode.CreateComponent("RigidBody");
@@ -357,13 +357,13 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
 
         if (key == KEY_F5)
         {
-            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_WRITE);
+            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/TestScene.xml", FILE_WRITE);
             testScene.SaveXML(xmlFile);
         }
 
         if (key == KEY_F7)
         {
-            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_READ);
+            File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/TestScene.xml", FILE_READ);
             if (xmlFile.open)
                 testScene.LoadXML(xmlFile);
         }

+ 3 - 3
Bin/Data/Scripts/TestSceneOld.as

@@ -106,7 +106,7 @@ void InitScene()
 
         StaticModel@ object = newNode.CreateComponent("StaticModel");
         object.model = cache.GetResource("Model", "Models/Box.mdl");
-        object.material = cache.GetResource("Material", "Materials/StoneLargeH.xml");
+        object.material = cache.GetResource("Material", "Materials/StoneTiledH.xml");
         object.castShadows = true;
         object.occluder = true;
     }
@@ -456,13 +456,13 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
 
         if (key == KEY_F5)
         {
-            File@ xmlFile = File("Data/Scenes/SceneOld.xml", FILE_WRITE);
+            File@ xmlFile = File("Data/Scenes/TestSceneOld.xml", FILE_WRITE);
             testScene.SaveXML(xmlFile);
         }
 
         if (key == KEY_F7)
         {
-            File@ xmlFile = File("Data/Scenes/SceneOld.xml", FILE_READ);
+            File@ xmlFile = File("Data/Scenes/TestSceneOld.xml", FILE_READ);
             if (xmlFile.open)
             {
                 testScene.LoadXML(xmlFile);

BIN
Bin/Data/Textures/StoneDiffuse.dds


BIN
Bin/Data/Textures/StoneNormal.dds


+ 1 - 1
Docs/GettingStarted.dox

@@ -588,7 +588,7 @@ Now you should be ready to compile HelloWorld.cpp. The resulting executable will
 
 The Urho3D scene editor is a script application that can be run with the Urho3D main executable. To start, execute either of these commands: (in the Bin directory) Editor.bat or Urho3D.exe Scripts/Editor.as
 
-Hint: to get some content to look at, run the TestScene example, and press F5. This saves a scene file called Scene.xml into the Data/Scenes subdirectory, which can be loaded in the editor. The NinjaSnowWar scene also exists in the Data/Scenes subdirectory, and the NinjaSnowWar object "prefabs" are in the Data/Objects subdirectory.
+Hint: to get some content to look at, run the TestScene example, and press F5. This saves a scene file called TestScene.xml into the Data/Scenes subdirectory, which can be loaded in the editor. The NinjaSnowWar scene also exists in the Data/Scenes subdirectory, and the NinjaSnowWar object "prefabs" are in the Data/Objects subdirectory.
 
 \section EditorInstructions_Controls Controls
 

+ 3 - 4
Engine/Graphics/TerrainPatch.cpp

@@ -162,10 +162,9 @@ void TerrainPatch::UpdateGeometry(const FrameInfo& frame)
 
 UpdateGeometryType TerrainPatch::GetUpdateGeometryType()
 {
-    if (vertexBuffer_->IsDataLost())
-        return UPDATE_MAIN_THREAD;
-    else 
-        return UPDATE_WORKER_THREAD;
+    // Because there is a latency in starting worker thread updates, and the update of terrain patch LOD should not take
+    // much time, always update in the main thread
+    return UPDATE_MAIN_THREAD;
 }
 
 Geometry* TerrainPatch::GetLodGeometry(unsigned batchIndex, unsigned level)