[Orxonox-commit 7578] r12183 - in code/branches/Merge_HS18: . data/levels src/libraries/tools

merholzl at orxonox.net merholzl at orxonox.net
Tue Dec 11 18:33:26 CET 2018


Author: merholzl
Date: 2018-12-11 18:33:26 +0100 (Tue, 11 Dec 2018)
New Revision: 12183

Added:
   code/branches/Merge_HS18/data/levels/BumpMap.oxw
Modified:
   code/branches/Merge_HS18/
   code/branches/Merge_HS18/data/levels/tutorial.oxw
   code/branches/Merge_HS18/src/libraries/tools/Mesh.cc
Log:
Shader merge

Index: code/branches/Merge_HS18
===================================================================
--- code/branches/Merge_HS18	2018-12-11 17:20:24 UTC (rev 12182)
+++ code/branches/Merge_HS18	2018-12-11 17:33:26 UTC (rev 12183)

Property changes on: code/branches/Merge_HS18
___________________________________________________________________
Modified: svn:mergeinfo
## -172,6 +172,7 ##
 /code/branches/rocket2:6953-6970
 /code/branches/script_trigger:1295-1953,1955
 /code/branches/sfxThilo:9691-9917
+/code/branches/shader_HS18:12034-12182
 /code/branches/shaders:9379-11072
 /code/branches/shaders_merge:11072-11079
 /code/branches/shipSelection:9038-9206
Copied: code/branches/Merge_HS18/data/levels/BumpMap.oxw (from rev 12182, code/branches/shader_HS18/data/levels/BumpMap.oxw)
===================================================================
--- code/branches/Merge_HS18/data/levels/BumpMap.oxw	                        (rev 0)
+++ code/branches/Merge_HS18/data/levels/BumpMap.oxw	2018-12-11 17:33:26 UTC (rev 12183)
@@ -0,0 +1,82 @@
+<!-- Author: Philip Wiese <wiesep at student.ethz.ch> -->
+<LevelInfo
+ name = "BumpMap"
+ description = "A demonstration of bump maps (created HS18)"
+ tags = "test, showcase"
+ screenshot = "bumpMap.png"
+/>
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+?>
+
+<?lua
+  include("templates/spaceshipEscort.oxt")
+?>
+
+<Level>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+  <?lua include("includes/notifications.oxi") ?>
+
+  <Scene
+    ambientlight = "0.5, 0.5, 0.5"
+    skybox       = "Orxonox/Starbox"
+  >
+
+
+  <!--
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+  -->
+
+    <Light type=point position="100,30,300" lookat="0,0,0" diffuse="0.8, 0.8, 0.8, 1.0" specular="0.5, 0.9, 0.9, 1.0"/>
+    <Model position="100,30,200" mesh="rocket.mesh" scale="3" lookat="0,0,0"/>
+
+    <Light type=point position="-20,-30,-200" lookat="0,0,0" diffuse="0.8, 0.8, 0.8, 1.0" specular="0.5, 0.5, 0.5, 1.0"/>
+    <Model position="-20,-30,-200" mesh="rocket.mesh" scale="3" lookat="0,0,0"/>
+    
+    <Light type=point position="20,200,20" lookat="0,0,0" diffuse="0.3, 0.3, 0.3, 1.0" specular="0.5, 0.5, 0.5, 1.0"/>
+    <Model position="20,200,20" mesh="rocket.mesh" scale="3" lookat="0,0,0"/>
+<!--
+    <Light type=point position="100,200,0" lookat="0,0,0" diffuse="0.8, 0.7, 0.7, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+    <Model position="100,200,0" mesh="Coordinates.mesh" scale="3" lookat="0,0,0"/>
+
+    <Light type=point position="20,-200,0" lookat="0,0,0" diffuse="0.8, 0.7, 0.7, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+    <Model position="20,-200,0" mesh="Coordinates.mesh" scale="3" lookat="0,0,0"/>
+
+    <Light type=point position="200,0,0" lookat="0,0,0" diffuse="0.8, 0.7, 0.7, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+    <Model position="200,0,0" mesh="Coordinates.mesh" scale="3" lookat="0,0,0"/>
+
+    <Light type=point position="-200,0,0" lookat="0,0,0" diffuse="0.8, 0.7, 0.7, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+    <Model position="-200,0,0" mesh="Coordinates.mesh" scale="3" lookat="0,0,0"/>
+-->
+    <SpawnPoint team=0 position="-80,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+    <!--<Model position="0, -50,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="Cube_Lava.mesh" />
+    <Model position="0, 0,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="Cube_Lava_Normal.mesh" />
+    <Model position="0, 12,0" yaw="90" pitch="-90" roll="0" scale="10" mesh="Cube_Lava_V2.mesh" />
+    <Model position="0, -12,0" yaw="90" pitch="-90" roll="0" scale="10" mesh="Cube_Lava_V2_Normal.mesh" />
+    -->
+
+    <MovableEntity position="0,0,40" rotationrate="30" rotationaxis="1,0,1">
+      <attached>
+          <Model position="0, 0,0" roll="45" scale="10" mesh="Cube_Lava.mesh" />
+      </attached>
+    </MovableEntity>
+
+    <MovableEntity position="0,0,0" rotationrate="30" rotationaxis="1,0,1">
+      <attached>
+          <Model position="0, 0,0" roll="45" scale="10" mesh="Cube_Lava_Normal.mesh" />
+      </attached>
+    </MovableEntity>
+    <MovableEntity position="0,0,-40" rotationrate="30" rotationaxis="1,0,1">
+      <attached>
+          <Model position="0, 0,0" roll="45" scale="10" mesh="Cube_Lava_Normal_Blank.mesh" />
+      </attached>
+    </MovableEntity>
+
+  </Scene>
+</Level>

Modified: code/branches/Merge_HS18/data/levels/tutorial.oxw
===================================================================
--- code/branches/Merge_HS18/data/levels/tutorial.oxw	2018-12-11 17:20:24 UTC (rev 12182)
+++ code/branches/Merge_HS18/data/levels/tutorial.oxw	2018-12-11 17:33:26 UTC (rev 12183)
@@ -54,10 +54,10 @@
       <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=shipselection />
     <?lua end ?>
 
-    <GlobalShader compositor="Bloom" visible=false>
+    <GlobalShader compositor="Bloom" visible=true>
       <events>
         <visibility>
-          <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+          <DistanceTrigger position="0,0,0" distance=300 target="Spectator" switch=false />
         </visibility>
       </events>
     </GlobalShader>

Modified: code/branches/Merge_HS18/src/libraries/tools/Mesh.cc
===================================================================
--- code/branches/Merge_HS18/src/libraries/tools/Mesh.cc	2018-12-11 17:20:24 UTC (rev 12182)
+++ code/branches/Merge_HS18/src/libraries/tools/Mesh.cc	2018-12-11 17:33:26 UTC (rev 12183)
@@ -34,6 +34,7 @@
 #include <OgreEntity.h>
 #include <OgreSubEntity.h>
 #include <OgreSceneManager.h>
+#include <OgreHardwareVertexBuffer.h>
 
 #include "util/Convert.h"
 #include "core/GameMode.h"
@@ -63,6 +64,7 @@
         if (this->entity_)
             this->scenemanager_->destroyEntity(this->entity_);
 
+
         if (GameMode::showsGraphics())
         {
             try
@@ -69,8 +71,24 @@
             {
                 this->entity_ = this->scenemanager_->createEntity("Mesh" + multi_cast<std::string>(Mesh::meshCounter_s++), meshsource);
                 this->entity_->setCastShadows(this->bCastShadows_);
-            }
-            catch (...)
+
+
+                unsigned short src, dest;
+                try
+                {
+                    if (!this->entity_->getMesh()->suggestTangentVectorBuildParams(Ogre::VertexElementSemantic::VES_TANGENT, src, dest))
+                    {
+                        orxout() << "Generate Tanget for \"" << meshsource << '"' << endl;
+                        this->entity_->getMesh()->buildTangentVectors(Ogre::VertexElementSemantic::VES_TANGENT, src, dest);
+                        // this version cleans mirrored and rotated UVs but requires quality models
+                        // mesh->buildTangentVectors(VES_TANGENT, src, dest, true, true);
+                    }
+                } catch (...)
+                {
+                    orxout(internal_warning) << "Couldn't generat tangets for \"" << meshsource << '"' << endl;
+                }
+
+            } catch (...)
             {
                 orxout(internal_error) << "Couldn't load mesh \"" << meshsource << '"' << endl;
                 this->entity_ = nullptr;
@@ -106,7 +124,7 @@
         {
                 this->entity_->getSubEntity(index)->setMaterialName(name);
         }
-        else 
+        else
             orxout() << "ERROR at Index " << index << endl;
     }
 



More information about the Orxonox-commit mailing list