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.

File:
1 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()
Note: See TracChangeset for help on using the changeset viewer.