[Orxonox-commit 2788] r7491 - code/trunk/src/orxonox/graphics

dafrick at orxonox.net dafrick at orxonox.net
Sun Sep 26 21:48:42 CEST 2010


Author: dafrick
Date: 2010-09-26 21:48:42 +0200 (Sun, 26 Sep 2010)
New Revision: 7491

Modified:
   code/trunk/src/orxonox/graphics/Billboard.cc
   code/trunk/src/orxonox/graphics/Billboard.h
Log:
Implemented Billboard rotation. If there is a reason why it wasn't implemented, yet and that reason is because it doesn't work, in some instances, then please feel free to revert the changes.
For me it works, though.


Modified: code/trunk/src/orxonox/graphics/Billboard.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Billboard.cc	2010-09-26 16:41:19 UTC (rev 7490)
+++ code/trunk/src/orxonox/graphics/Billboard.cc	2010-09-26 19:48:42 UTC (rev 7491)
@@ -28,6 +28,9 @@
 
 #include "Billboard.h"
 
+#include "OgreBillboard.h"
+#include "OgreBillboardSet.h"
+
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
 #include "core/XMLPort.h"
@@ -42,7 +45,7 @@
         RegisterObject(Billboard);
 
         this->colour_ = ColourValue::White;
-//        this->rotation_ = 0;
+        this->rotation_ = 0;
 
         this->registerVariables();
     }
@@ -62,14 +65,14 @@
 
         XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
         XMLPortParam(Billboard, "colour",   setColour,   getColour,   xmlelement, mode).defaultValues(ColourValue::White);
-//        XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
+        XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
     }
 
     void Billboard::registerVariables()
     {
         registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
         registerVariable(this->colour_,   VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
-//        registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
+        registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
     }
 
     void Billboard::changedMaterial()
@@ -85,7 +88,7 @@
                 if (this->billboard_.getBillboardSet())
                      this->attachOgreObject(this->billboard_.getBillboardSet());
                 this->billboard_.setVisible(this->isVisible());
-//                this->changedRotation();
+                this->changedRotation();
             }
         }
         else
@@ -110,13 +113,19 @@
             this->billboard_.setColour(this->colour_);
     }
 
-/*
     void Billboard::changedRotation()
     {
         if (this->billboard_.getBillboardSet())
-            this->billboard_.getBillboardSet()->setRotation(this->rotation_);
+        {
+            Ogre::BillboardSet* set = this->billboard_.getBillboardSet();
+            set->setBillboardRotationType(Ogre::BBR_VERTEX);
+            unsigned int size = set->getPoolSize();
+            for(unsigned int i = 0; i < size; i++)
+            {
+                set->getBillboard(i)->setRotation(this->rotation_);
+            }
+        }
     }
-*/
 
     void Billboard::changedVisibility()
     {

Modified: code/trunk/src/orxonox/graphics/Billboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/Billboard.h	2010-09-26 16:41:19 UTC (rev 7490)
+++ code/trunk/src/orxonox/graphics/Billboard.h	2010-09-26 19:48:42 UTC (rev 7491)
@@ -60,12 +60,12 @@
                 { this->colour_ = colour; this->changedColour(); }
             inline const ColourValue& getColour() const
                 { return this->colour_; }
-/*
+
             inline void setRotation(const Radian& rotation)
                 { this->rotation_ = rotation; this->changedRotation(); }
             inline const Radian& getRotation() const
                 { return this->rotation_; }
-*/
+
             virtual void setTeamColour(const ColourValue& colour)
                 { this->setColour(colour); }
 
@@ -78,12 +78,12 @@
         private:
             void registerVariables();
             void changedMaterial();
-//            void changedRotation();
+            void changedRotation();
 
             BillboardSet billboard_;
             std::string material_;
             ColourValue colour_;
-//            Radian rotation_;
+            Radian rotation_;
     };
 }
 




More information about the Orxonox-commit mailing list