Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2011, 4:35:18 PM (14 years ago)
Author:
kmaurus
Message:
 
Location:
code/branches/spaceboundaries2/src/orxonox/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc

    r8513 r8604  
    3737#include "interfaces/RadarViewable.h"
    3838#include "graphics/Billboard.h"
     39#include <OgreBillboardSet.h>
     40
    3941
    4042namespace orxonox
     
    5658        this->centerRadar_ = new RadarViewable(this, this);
    5759        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);
    5967    }
    6068    SpaceBoundaries::~SpaceBoundaries()
     
    7280        }
    7381        this->billboards_.clear();
     82       
     83        delete constBilly; // TO REMOVE (DEBUGGING)
    7484    }
    7585   
     
    112122        {
    113123            Billboard *tmp = new Billboard(this);
    114             this->setBillboardOptions( tmp );
    115124            tmp->setPosition(position);
     125            this->setBillboardOptions( tmp, position);
    116126            billboardAdministration tmp2 = { true, tmp };
    117127            this->billboards_.push_back( tmp2 );
     
    124134    }
    125135   
    126     void SpaceBoundaries::setBillboardOptions(Billboard *billy)
     136    void SpaceBoundaries::setBillboardOptions(Billboard *billy, Vector3 position)
    127137    {
    128138        if(billy != NULL)
    129139        {
    130140            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);
    131146            billy->setVisible(true);
    132147        }
  • code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h

    r8513 r8604  
    2626 *
    2727 */
    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  */
    4028
    4129#ifndef _SpaceBoundaries_H__
     
    6452       - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
    6553       - '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!)
    6755       - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
    6856       - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
     
    125113            float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.
    126114            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_'")
    128116           
    129117            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.
    131120           
    132121           
    133122            RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar.
     123           
     124            Billboard* constBilly; // TO REMOVE (DEBUGGING)
    134125       
    135126       
    136127            // Funktionen::
    137128            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)
    139130            void displayBoundaries(Pawn *item);
    140131            void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
     
    145136           
    146137            void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'.
    147             void setBillboardOptions(Billboard *billy);
     138            void setBillboardOptions(Billboard *billy, Vector3 position);
    148139            void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0.
    149140           
Note: See TracChangeset for help on using the changeset viewer.