Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 26, 2010, 9:48:42 PM (14 years ago)
Author:
dafrick
Message:

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.

Location:
code/trunk/src/orxonox/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/graphics/Billboard.cc

    r6417 r7491  
    2929#include "Billboard.h"
    3030
     31#include "OgreBillboard.h"
     32#include "OgreBillboardSet.h"
     33
    3134#include "core/CoreIncludes.h"
    3235#include "core/GameMode.h"
     
    4346
    4447        this->colour_ = ColourValue::White;
    45 //        this->rotation_ = 0;
     48        this->rotation_ = 0;
    4649
    4750        this->registerVariables();
     
    6366        XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
    6467        XMLPortParam(Billboard, "colour",   setColour,   getColour,   xmlelement, mode).defaultValues(ColourValue::White);
    65 //        XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
     68        XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
    6669    }
    6770
     
    7073        registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
    7174        registerVariable(this->colour_,   VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
    72 //        registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
     75        registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
    7376    }
    7477
     
    8689                     this->attachOgreObject(this->billboard_.getBillboardSet());
    8790                this->billboard_.setVisible(this->isVisible());
    88 //                this->changedRotation();
     91                this->changedRotation();
    8992            }
    9093        }
     
    111114    }
    112115
    113 /*
    114116    void Billboard::changedRotation()
    115117    {
    116118        if (this->billboard_.getBillboardSet())
    117             this->billboard_.getBillboardSet()->setRotation(this->rotation_);
     119        {
     120            Ogre::BillboardSet* set = this->billboard_.getBillboardSet();
     121            set->setBillboardRotationType(Ogre::BBR_VERTEX);
     122            unsigned int size = set->getPoolSize();
     123            for(unsigned int i = 0; i < size; i++)
     124            {
     125                set->getBillboard(i)->setRotation(this->rotation_);
     126            }
     127        }
    118128    }
    119 */
    120129
    121130    void Billboard::changedVisibility()
  • code/trunk/src/orxonox/graphics/Billboard.h

    r7163 r7491  
    6161            inline const ColourValue& getColour() const
    6262                { return this->colour_; }
    63 /*
     63
    6464            inline void setRotation(const Radian& rotation)
    6565                { this->rotation_ = rotation; this->changedRotation(); }
    6666            inline const Radian& getRotation() const
    6767                { return this->rotation_; }
    68 */
     68
    6969            virtual void setTeamColour(const ColourValue& colour)
    7070                { this->setColour(colour); }
     
    7979            void registerVariables();
    8080            void changedMaterial();
    81 //            void changedRotation();
     81            void changedRotation();
    8282
    8383            BillboardSet billboard_;
    8484            std::string material_;
    8585            ColourValue colour_;
    86 //            Radian rotation_;
     86            Radian rotation_;
    8787    };
    8888}
Note: See TracChangeset for help on using the changeset viewer.