Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8604


Ignore:
Timestamp:
May 26, 2011, 4:35:18 PM (13 years ago)
Author:
kmaurus
Message:
 
Location:
code/branches/spaceboundaries2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceboundaries2/data/levels/myTestLevel.oxw

    r8513 r8604  
    3030
    3131    <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"/>
    32     <SpawnPoint team=0 position="0,0,0" lookat="2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     32    <SpawnPoint team=0 position="0,0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    3333   
    34     <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" reactionMode="2" healthDecrease="0.9" position="0,0,0"/>
     34    <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" reactionMode="0" healthDecrease="0.9" position="0,0,0"/>
    3535   
    3636    <Billboard position="0,0,0" colour="1.0,1.0,1.0" material="Flares/backlightflare" scale=1 />
  • code/branches/spaceboundaries2/doc/api/Groups.dox

    r8468 r8604  
    161161    @ingroup Modules
    162162*/
    163 
    164 /**
    165     @defgroup SpaceBoundaries Space Boundaries
    166     @ingroup Modules
    167 */
  • code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.cc

    r7492 r8604  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
     25 *      Maurus Kaufmann
    2526 *      ...
    2627 *
     
    3031
    3132#include "OgreBillboard.h"
    32 #include "OgreBillboardSet.h"
    3333
    3434#include "core/CoreIncludes.h"
     
    4646
    4747        this->colour_ = ColourValue::White;
    48         //this->rotation_ = 0;
     48        this->rotation_ = 0;
    4949
    5050        this->registerVariables();
     
    6666        XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
    6767        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);
    6969    }
    7070
     
    7373        registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
    7474        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));
    7676    }
    7777
     
    8989                     this->attachOgreObject(this->billboard_.getBillboardSet());
    9090                this->billboard_.setVisible(this->isVisible());
    91                 //this->changedRotation();
     91                this->changedRotation();
    9292            }
    9393        }
     
    114114    }
    115115
    116 /*
     116
    117117    void Billboard::changedRotation()
    118118    {
     
    128128        }
    129129    }
    130 */
     130
    131131
    132132    void Billboard::changedVisibility()
     
    136136        this->billboard_.setVisible(this->isVisible());
    137137    }
     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    }
    138174}
  • code/branches/spaceboundaries2/src/orxonox/graphics/Billboard.h

    r7492 r8604  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
     25 *      Maurus Kaufmann
    2526 *      ...
    2627 *
     
    3132
    3233#include "OrxonoxPrereqs.h"
     34
     35#include "OgreBillboardSet.h"
    3336
    3437#include "util/Math.h"
     
    6265                { return this->colour_; }
    6366
    64 /*
     67
    6568            inline void setRotation(const Radian& rotation)
    6669                { this->rotation_ = rotation; this->changedRotation(); }
    6770            inline const Radian& getRotation() const
    6871                { return this->rotation_; }
    69 */
     72
    7073
    7174            virtual void setTeamColour(const ColourValue& colour)
    7275                { 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
    7385
    7486        protected:
     
    8193            void registerVariables();
    8294            void changedMaterial();
    83             //void changedRotation();
     95            void changedRotation();
    8496
    8597            BillboardSet billboard_;
    8698            std::string material_;
    8799            ColourValue colour_;
    88             //Radian rotation_;
     100            Radian rotation_;
    89101    };
    90102}
  • 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.