[Orxonox-commit 310] r2939 - branches/toonshader/src/orxonox/objects/worldentities

stefalie at orxonox.net stefalie at orxonox.net
Wed Apr 29 16:38:35 CEST 2009


Author: stefalie
Date: 2009-04-29 16:38:35 +0200 (Wed, 29 Apr 2009)
New Revision: 2939

Modified:
   branches/toonshader/src/orxonox/objects/worldentities/Model.cc
Log:
ugly hacks to get shaders up runnin

Modified: branches/toonshader/src/orxonox/objects/worldentities/Model.cc
===================================================================
--- branches/toonshader/src/orxonox/objects/worldentities/Model.cc	2009-04-29 14:10:35 UTC (rev 2938)
+++ branches/toonshader/src/orxonox/objects/worldentities/Model.cc	2009-04-29 14:38:35 UTC (rev 2939)
@@ -29,6 +29,7 @@
 #include "OrxonoxStableHeaders.h"
 
 #include <OgreEntity.h>
+#include <OgreMaterialManager.h>
 #include "Model.h"
 #include "core/GameMode.h"
 #include "core/CoreIncludes.h"
@@ -60,6 +61,31 @@
 
         XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
         XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
+
+        //HACK
+        if (true)//this->meshSrc_ == "assasdfff.mesh")
+        {
+            this->mesh_.getEntity()->setMaterialName("ToonShader");
+            static bool load = true;
+            
+            if (load)
+            {
+                Ogre::MaterialPtr matPtr = Ogre::MaterialManager::getSingleton().getByName("ToonShader");
+                if (!matPtr.isNull()) {
+                // is this necessary to do here? Someday try it without
+                    matPtr->compile();
+                    matPtr->load();
+                }
+                else
+                    COUT(0) << "frakking shader\n";
+                
+                COUT(0) << "shiiit\n";
+
+                //Ogre::MaterialManager& mm = Ogre::MaterialManager::getSingleton();
+               //Ogre::Material* m = Ogre::Material*(Ogre::MaterialManager::getSingleton().getByName("ToonShader"));
+                load = false;
+            }
+        }
     }
 
     void Model::registerVariables()
@@ -84,6 +110,10 @@
                 this->mesh_.setVisible(this->isVisible());
             }
         }
+        if (true)//this->meshSrc_ == "assasdfff.mesh")
+        {
+            this->mesh_.getEntity()->setMaterialName("ToonShader");
+        }
     }
 
     void Model::changedShadows()




More information about the Orxonox-commit mailing list