[Orxonox-commit 3930] r8604 - in code/branches/spaceboundaries2: data/levels doc/api src/orxonox/graphics src/orxonox/worldentities

kmaurus at orxonox.net kmaurus at orxonox.net
Thu May 26 16:35:19 CEST 2011


Author: kmaurus
Date: 2011-05-26 16:35:18 +0200 (Thu, 26 May 2011)
New Revision: 8604

Modified:
   code/branches/spaceboundaries2/data/levels/myTestLevel.oxw
   code/branches/spaceboundaries2/doc/api/Groups.dox
   code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.cc
   code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.h
   code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc
   code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h
Log:


Modified: code/branches/spaceboundaries2/data/levels/myTestLevel.oxw
===================================================================
--- code/branches/spaceboundaries2/data/levels/myTestLevel.oxw	2011-05-26 14:34:54 UTC (rev 8603)
+++ code/branches/spaceboundaries2/data/levels/myTestLevel.oxw	2011-05-26 14:35:18 UTC (rev 8604)
@@ -29,9 +29,9 @@
   >
 
     <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"/>
-    <SpawnPoint team=0 position="0,0,0" lookat="2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint team=0 position="0,0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     
-    <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" reactionMode="2" healthDecrease="0.9" position="0,0,0"/>
+    <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" reactionMode="0" healthDecrease="0.9" position="0,0,0"/>
     
     <Billboard position="0,0,0" colour="1.0,1.0,1.0" material="Flares/backlightflare" scale=1 />
     

Modified: code/branches/spaceboundaries2/doc/api/Groups.dox
===================================================================
--- code/branches/spaceboundaries2/doc/api/Groups.dox	2011-05-26 14:34:54 UTC (rev 8603)
+++ code/branches/spaceboundaries2/doc/api/Groups.dox	2011-05-26 14:35:18 UTC (rev 8604)
@@ -160,8 +160,3 @@
     @defgroup Weapons Weapons
     @ingroup Modules
 */
-
-/**
-    @defgroup SpaceBoundaries Space Boundaries
-    @ingroup Modules
-*/

Modified: code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.cc
===================================================================
--- code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.cc	2011-05-26 14:34:54 UTC (rev 8603)
+++ code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.cc	2011-05-26 14:35:18 UTC (rev 8604)
@@ -22,6 +22,7 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
+ *      Maurus Kaufmann
  *      ...
  *
  */
@@ -29,7 +30,6 @@
 #include "Billboard.h"
 
 #include "OgreBillboard.h"
-#include "OgreBillboardSet.h"
 
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
@@ -45,7 +45,7 @@
         RegisterObject(Billboard);
 
         this->colour_ = ColourValue::White;
-        //this->rotation_ = 0;
+        this->rotation_ = 0;
 
         this->registerVariables();
     }
@@ -65,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()
@@ -88,7 +88,7 @@
                 if (this->billboard_.getBillboardSet())
                      this->attachOgreObject(this->billboard_.getBillboardSet());
                 this->billboard_.setVisible(this->isVisible());
-                //this->changedRotation();
+                this->changedRotation();
             }
         }
         else
@@ -113,7 +113,7 @@
             this->billboard_.setColour(this->colour_);
     }
 
-/*
+
     void Billboard::changedRotation()
     {
         if (this->billboard_.getBillboardSet())
@@ -127,12 +127,48 @@
             }
         }
     }
-*/
 
+
     void Billboard::changedVisibility()
     {
         SUPER(Billboard, changedVisibility);
 
         this->billboard_.setVisible(this->isVisible());
     }
+    
+    void Billboard::setBillboardType(Ogre::BillboardType bbt)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setBillboardType(bbt);
+        }
+    }
+    
+    void Billboard::setCommonDirection(Vector3 vec)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setCommonDirection( vec );
+        }
+    }
+            
+    void Billboard::setCommonUpVector(Vector3 vec)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setCommonUpVector( vec );
+        }
+    }
+    
+    void Billboard::setDefaultDimensions(float width, float height)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setDefaultDimensions(width, height);
+        }
+    }
 }

Modified: code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.h
===================================================================
--- code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.h	2011-05-26 14:34:54 UTC (rev 8603)
+++ code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.h	2011-05-26 14:35:18 UTC (rev 8604)
@@ -22,6 +22,7 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
+ *      Maurus Kaufmann
  *      ...
  *
  */
@@ -31,6 +32,8 @@
 
 #include "OrxonoxPrereqs.h"
 
+#include "OgreBillboardSet.h"
+
 #include "util/Math.h"
 #include "tools/BillboardSet.h"
 #include "interfaces/TeamColourable.h"
@@ -61,16 +64,25 @@
             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); }
+                
+            void setBillboardType(Ogre::BillboardType bbt);
+            
+            void setCommonDirection(Vector3 vec); //!< normalised Vector vec as argument
+            
+            void setCommonUpVector(Vector3 vec); //!< normalised Vector vec as argument
+            
+            void setDefaultDimensions(float width, float height);
 
+
         protected:
             inline BillboardSet& getBillboardSet()
                 { return this->billboard_; }
@@ -80,12 +92,12 @@
         private:
             void registerVariables();
             void changedMaterial();
-            //void changedRotation();
+            void changedRotation();
 
             BillboardSet billboard_;
             std::string material_;
             ColourValue colour_;
-            //Radian rotation_;
+            Radian rotation_;
     };
 }
 

Modified: code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc
===================================================================
--- code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc	2011-05-26 14:34:54 UTC (rev 8603)
+++ code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc	2011-05-26 14:35:18 UTC (rev 8604)
@@ -36,7 +36,9 @@
 #include "infos/PlayerInfo.h"
 #include "interfaces/RadarViewable.h"
 #include "graphics/Billboard.h"
+#include <OgreBillboardSet.h>
 
+
 namespace orxonox
 {
     CreateFactory(SpaceBoundaries);
@@ -55,7 +57,13 @@
         // Show Boundaries on the radar.
         this->centerRadar_ = new RadarViewable(this, this);
         this->centerRadar_->setRadarObjectShape(RadarViewable::Dot);
-        this->centerRadar_->setRadarVisibility(false);
+        this->centerRadar_->setRadarVisibility(false);\
+        
+        // FOLGENDER BLOCK: TO REMOVE (DEBUGGING)
+        constBilly = new Billboard(this);
+        Vector3 pos = Vector3(-10, -10, -10);
+        constBilly->setPosition(pos);
+        setBillboardOptions(constBilly, pos);
     }
     SpaceBoundaries::~SpaceBoundaries()
     {
@@ -71,6 +79,8 @@
             }
         }
         this->billboards_.clear();
+        
+        delete constBilly; // TO REMOVE (DEBUGGING)
     }
     
     void SpaceBoundaries::checkWhoIsIn()
@@ -111,8 +121,8 @@
         if( current == this->billboards_.end() )
         {
             Billboard *tmp = new Billboard(this);
-            this->setBillboardOptions( tmp );
             tmp->setPosition(position);
+            this->setBillboardOptions( tmp, position);
             billboardAdministration tmp2 = { true, tmp };
             this->billboards_.push_back( tmp2 );
             
@@ -123,11 +133,16 @@
         }
     }
     
-    void SpaceBoundaries::setBillboardOptions(Billboard *billy)
+    void SpaceBoundaries::setBillboardOptions(Billboard *billy, Vector3 position)
     {
         if(billy != NULL)
         {
             billy->setMaterial("Grid");
+            billy->setBillboardType(Ogre::BBT_PERPENDICULAR_COMMON);
+            Vector3 normalisedVec = (position - this->getPosition()).normalisedCopy(); /* Vektor von Kugelmitte nach aussen */
+            billy->setCommonDirection ( -1.0 * normalisedVec );
+            billy->setCommonUpVector( Vector3::UNIT_Z ); // (normalisedVec.crossProduct(Vector3::UNIT_X)).normalisedCopy() );
+            billy->setDefaultDimensions(150, 150);
             billy->setVisible(true);
         }
     }

Modified: code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h
===================================================================
--- code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h	2011-05-26 14:34:54 UTC (rev 8603)
+++ code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h	2011-05-26 14:35:18 UTC (rev 8604)
@@ -25,18 +25,6 @@
  *      ...
  *
  */
- 
- /* TODO:   - Bei Reaction_ == 2 ist die Reflexion noch nicht ganz so top!! Vielleicht auch so belassen, ist ja nicht unbedingt schlecht.
- 
-            - Textmessages und Billboards sollen teils nur bei einem humanPlayer angezeigt werden, nicht bei allen (vgl. Netzwerk-Spiel mit mehreren humanPlayers)
-                beachte hierzu folgende statische Funktion: 'static unsigned int  Host::getPlayerID()'
-                (file:///home/kmaurus/orxonox/spaceBoundaries/build/doc/api/html/classorxonox_1_1_host.html#9c1e3b39e3b42e467dfbf42902911ce2)
-                
-                Mich finde ich unter humanPlayer ...
-                
-            - Kommentieren (Betrachte als Beispiel/Vorbild 'libraries/core/WeakPtr.h') 
-                oder brauche groups-file.
- */
 
 #ifndef _SpaceBoundaries_H__
 #define _SpaceBoundaries_H__
@@ -63,7 +51,7 @@
        - 'position' : absolute position of the object of SpaceBoundaries in the level (usually 0,0,0) 
        - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
        - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
-                          inform the player that he'll soon be leaving the allowed area. 
+                          inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
        - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown. 
        - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
                             0: Reflect the space ship (default).
@@ -124,18 +112,21 @@
                            //!< 2: Invertierte Version von 0. Verbiete es, in ein Gebiet hinein zu fliegen.
             float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.
             float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst.
-            float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen.
+            float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen. ("Entfernung von 'this->maxDistance_'")
             
             float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden.
-                                   //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung)
+                                   //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung).
+                                   //!< Hat nur eine Bedeutung, falls 'this->reaction_' 1 (eins) ist. 
             
             
             RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar.
+            
+            Billboard* constBilly; // TO REMOVE (DEBUGGING)
         
         
             // Funktionen::
             float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen.
-            void displayWarning(const std::string warnText);
+            void displayWarning(const std::string warnText); //!< Einen Warntext auf dem Bildschirm ausgeben. (noch nicht implementiert)
             void displayBoundaries(Pawn *item);
             void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
             void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
@@ -144,7 +135,7 @@
             void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
             
             void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'.
-            void setBillboardOptions(Billboard *billy);
+            void setBillboardOptions(Billboard *billy, Vector3 position);
             void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0.
             
     };




More information about the Orxonox-commit mailing list