Browse Source

Adjusted physics sample materials. Let the boxes fall a bit in the beginning.
Copy export header only if it has changed to prevent unnecessary engine rebuild.

Lasse Öörni 12 years ago
parent
commit
056a071ed2

+ 11 - 0
Bin/Data/Materials/StoneEnvMapSmall.xml

@@ -0,0 +1,11 @@
+<material>
+    <technique name="Techniques/DiffNormalPackedEnvCube.xml" quality="1" />
+    <technique name="Techniques/DiffEnvCube.xml" quality="0" />
+    <texture unit="diffuse" name="Textures/StoneDiffuse.dds" />
+    <texture unit="normal" name="Textures/StoneNormal.dds" />
+    <texture unit="environment" name="Textures/Skybox.xml" />
+    <parameter name="MatSpecColor" value="0.3 0.3 0.3 16" />
+    <parameter name="MatEnvMapColor" value="0.1 0.1 0.2" />
+    <parameter name="UOffset" value="0.125 0 0 0" />
+    <parameter name="VOffset" value="0 0.125 0 0" />
+</material>

+ 8 - 3
Source/CMakeLists.txt

@@ -159,9 +159,14 @@ endif ()
 
 # Generate platform specific export header file automatically
 set_target_properties (Urho3D PROPERTIES DEFINE_SYMBOL URHO3D_EXPORTS)
-generate_export_header (Urho3D EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Engine/Urho3D.h)
+generate_export_header (Urho3D EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Engine/Urho3D.h.new)
 
 # Append Urho3D license notice to the export header file
 file (READ ${CMAKE_SOURCE_DIR}/Engine/Urho3D.h.in LICENSE)
-file (READ ${CMAKE_BINARY_DIR}/Engine/Urho3D.h EXPORT_DEFINE)
-file (WRITE ${CMAKE_BINARY_DIR}/Engine/Urho3D.h ${LICENSE}${EXPORT_DEFINE})
+file (READ ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new EXPORT_DEFINE)
+file (WRITE ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new ${LICENSE}${EXPORT_DEFINE})
+
+# Copy the new export header file only if it is different to prevent unnecessary library rebuild
+execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new ${CMAKE_BINARY_DIR}/Engine/Urho3D.h)
+file (REMOVE ${CMAKE_BINARY_DIR}/Engine/Urho3D.h.new)
+

+ 3 - 3
Source/Samples/11_Physics/Physics.cpp

@@ -135,10 +135,10 @@ void Physics::CreateScene()
             for (int x = -y; x <= y; ++x)
             {
                 Node* boxNode = scene_->CreateChild("Box");
-                boxNode->SetPosition(Vector3((float)x, -(float)y + 7.5f, 0.0f));
+                boxNode->SetPosition(Vector3((float)x, -(float)y + 8.0f, 0.0f));
                 StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
                 boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-                boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMap.xml"));
+                boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMapSmall.xml"));
                 boxObject->SetCastShadows(true);
                 
                 // Create RigidBody and CollisionShape components like above. Give the RigidBody mass to make it movable
@@ -245,7 +245,7 @@ void Physics::SpawnObject()
     boxNode->SetScale(0.25f);
     StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
     boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-    boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMap.xml"));
+    boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMapSmall.xml"));
     boxObject->SetCastShadows(true);
     
     // Create physics components, use a smaller mass also