Changeset 8604 for code/branches/spaceboundaries2/src
- Timestamp:
- May 26, 2011, 4:35:18 PM (14 years ago)
- Location:
- code/branches/spaceboundaries2/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.cc
r7492 r8604 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * Maurus Kaufmann 25 26 * ... 26 27 * … … 30 31 31 32 #include "OgreBillboard.h" 32 #include "OgreBillboardSet.h"33 33 34 34 #include "core/CoreIncludes.h" … … 46 46 47 47 this->colour_ = ColourValue::White; 48 //this->rotation_ = 0;48 this->rotation_ = 0; 49 49 50 50 this->registerVariables(); … … 66 66 XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode); 67 67 XMLPortParam(Billboard, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White); 68 //XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);68 XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0); 69 69 } 70 70 … … 73 73 registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial)); 74 74 registerVariable(this->colour_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour)); 75 //registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));75 registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation)); 76 76 } 77 77 … … 89 89 this->attachOgreObject(this->billboard_.getBillboardSet()); 90 90 this->billboard_.setVisible(this->isVisible()); 91 //this->changedRotation();91 this->changedRotation(); 92 92 } 93 93 } … … 114 114 } 115 115 116 /* 116 117 117 void Billboard::changedRotation() 118 118 { … … 128 128 } 129 129 } 130 */ 130 131 131 132 132 void Billboard::changedVisibility() … … 136 136 this->billboard_.setVisible(this->isVisible()); 137 137 } 138 139 void Billboard::setBillboardType(Ogre::BillboardType bbt) 140 { 141 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 142 if( bSet != NULL ) 143 { 144 bSet->setBillboardType(bbt); 145 } 146 } 147 148 void Billboard::setCommonDirection(Vector3 vec) 149 { 150 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 151 if( bSet != NULL ) 152 { 153 bSet->setCommonDirection( vec ); 154 } 155 } 156 157 void Billboard::setCommonUpVector(Vector3 vec) 158 { 159 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 160 if( bSet != NULL ) 161 { 162 bSet->setCommonUpVector( vec ); 163 } 164 } 165 166 void Billboard::setDefaultDimensions(float width, float height) 167 { 168 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 169 if( bSet != NULL ) 170 { 171 bSet->setDefaultDimensions(width, height); 172 } 173 } 138 174 } -
code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.h
r7492 r8604 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * Maurus Kaufmann 25 26 * ... 26 27 * … … 31 32 32 33 #include "OrxonoxPrereqs.h" 34 35 #include "OgreBillboardSet.h" 33 36 34 37 #include "util/Math.h" … … 62 65 { return this->colour_; } 63 66 64 /* 67 65 68 inline void setRotation(const Radian& rotation) 66 69 { this->rotation_ = rotation; this->changedRotation(); } 67 70 inline const Radian& getRotation() const 68 71 { return this->rotation_; } 69 */ 72 70 73 71 74 virtual void setTeamColour(const ColourValue& colour) 72 75 { this->setColour(colour); } 76 77 void setBillboardType(Ogre::BillboardType bbt); 78 79 void setCommonDirection(Vector3 vec); //!< normalised Vector vec as argument 80 81 void setCommonUpVector(Vector3 vec); //!< normalised Vector vec as argument 82 83 void setDefaultDimensions(float width, float height); 84 73 85 74 86 protected: … … 81 93 void registerVariables(); 82 94 void changedMaterial(); 83 //void changedRotation();95 void changedRotation(); 84 96 85 97 BillboardSet billboard_; 86 98 std::string material_; 87 99 ColourValue colour_; 88 //Radian rotation_;100 Radian rotation_; 89 101 }; 90 102 } -
code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc
r8513 r8604 37 37 #include "interfaces/RadarViewable.h" 38 38 #include "graphics/Billboard.h" 39 #include <OgreBillboardSet.h> 40 39 41 40 42 namespace orxonox … … 56 58 this->centerRadar_ = new RadarViewable(this, this); 57 59 this->centerRadar_->setRadarObjectShape(RadarViewable::Dot); 58 this->centerRadar_->setRadarVisibility(false); 60 this->centerRadar_->setRadarVisibility(false);\ 61 62 // FOLGENDER BLOCK: TO REMOVE (DEBUGGING) 63 constBilly = new Billboard(this); 64 Vector3 pos = Vector3(-10, -10, -10); 65 constBilly->setPosition(pos); 66 setBillboardOptions(constBilly, pos); 59 67 } 60 68 SpaceBoundaries::~SpaceBoundaries() … … 72 80 } 73 81 this->billboards_.clear(); 82 83 delete constBilly; // TO REMOVE (DEBUGGING) 74 84 } 75 85 … … 112 122 { 113 123 Billboard *tmp = new Billboard(this); 114 this->setBillboardOptions( tmp );115 124 tmp->setPosition(position); 125 this->setBillboardOptions( tmp, position); 116 126 billboardAdministration tmp2 = { true, tmp }; 117 127 this->billboards_.push_back( tmp2 ); … … 124 134 } 125 135 126 void SpaceBoundaries::setBillboardOptions(Billboard *billy )136 void SpaceBoundaries::setBillboardOptions(Billboard *billy, Vector3 position) 127 137 { 128 138 if(billy != NULL) 129 139 { 130 140 billy->setMaterial("Grid"); 141 billy->setBillboardType(Ogre::BBT_PERPENDICULAR_COMMON); 142 Vector3 normalisedVec = (position - this->getPosition()).normalisedCopy(); /* Vektor von Kugelmitte nach aussen */ 143 billy->setCommonDirection ( -1.0 * normalisedVec ); 144 billy->setCommonUpVector( Vector3::UNIT_Z ); // (normalisedVec.crossProduct(Vector3::UNIT_X)).normalisedCopy() ); 145 billy->setDefaultDimensions(150, 150); 131 146 billy->setVisible(true); 132 147 } -
code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h
r8513 r8604 26 26 * 27 27 */ 28 29 /* TODO: - Bei Reaction_ == 2 ist die Reflexion noch nicht ganz so top!! Vielleicht auch so belassen, ist ja nicht unbedingt schlecht.30 31 - Textmessages und Billboards sollen teils nur bei einem humanPlayer angezeigt werden, nicht bei allen (vgl. Netzwerk-Spiel mit mehreren humanPlayers)32 beachte hierzu folgende statische Funktion: 'static unsigned int Host::getPlayerID()'33 (file:///home/kmaurus/orxonox/spaceBoundaries/build/doc/api/html/classorxonox_1_1_host.html#9c1e3b39e3b42e467dfbf42902911ce2)34 35 Mich finde ich unter humanPlayer ...36 37 - Kommentieren (Betrachte als Beispiel/Vorbild 'libraries/core/WeakPtr.h')38 oder brauche groups-file.39 */40 28 41 29 #ifndef _SpaceBoundaries_H__ … … 64 52 - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball). 65 53 - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to 66 inform the player that he'll soon be leaving the allowed area. 54 inform the player that he'll soon be leaving the allowed area. (not implemented yet!) 67 55 - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown. 68 56 - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries. … … 125 113 float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'. 126 114 float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst. 127 float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen. 115 float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen. ("Entfernung von 'this->maxDistance_'") 128 116 129 117 float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden. 130 //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung) 118 //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung). 119 //!< Hat nur eine Bedeutung, falls 'this->reaction_' 1 (eins) ist. 131 120 132 121 133 122 RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar. 123 124 Billboard* constBilly; // TO REMOVE (DEBUGGING) 134 125 135 126 136 127 // Funktionen:: 137 128 float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen. 138 void displayWarning(const std::string warnText); 129 void displayWarning(const std::string warnText); //!< Einen Warntext auf dem Bildschirm ausgeben. (noch nicht implementiert) 139 130 void displayBoundaries(Pawn *item); 140 131 void conditionalBounceBack(Pawn *item, float currentDistance, float dt); … … 145 136 146 137 void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'. 147 void setBillboardOptions(Billboard *billy );138 void setBillboardOptions(Billboard *billy, Vector3 position); 148 139 void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0. 149 140
Note: See TracChangeset
for help on using the changeset viewer.