Billboard
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_BILLBOARD
#define OSG_BILLBOARD 1
#include <osg/Matrix>
#include <osg/Geode>
namespace osg {
class OSG_EXPORT Billboard : public Geode
{
public:
enum Mode {
POINT_ROT_EYE,
POINT_ROT_WORLD,
AXIAL_ROT
};
Billboard();
Billboard(const Billboard&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, Billboard);
void setMode(Mode mode);
inline Mode getMode() const { return _mode; }
void setAxis(const Vec3& axis);
inline const Vec3& getAxis() const { return _axis; }
void setNormal(const Vec3& normal);
inline const Vec3& getNormal() const { return _normal; }
inline void setPosition(unsigned int i,const Vec3& pos) { _positionList[i] = pos; }
inline const Vec3& getPosition(unsigned int i) const { return _positionList[i]; }
typedef std::vector<Vec3> PositionList;
inline void setPositionList(PositionList& pl) { _positionList=pl; }
inline PositionList& getPositionList() { return _positionList; }
inline const PositionList& getPositionList() const { return _positionList; }
virtual bool addDrawable( Drawable *gset );
virtual bool addDrawable(Drawable *gset,const Vec3& pos);
virtual bool removeDrawable( Drawable *gset );
bool computeMatrix(Matrix& modelview, const Vec3& eye_local, const Vec3& pos_local) const;
virtual BoundingSphere computeBound() const;
protected:
virtual ~Billboard();
enum AxisAligned
{
AXIAL_ROT_X_AXIS=AXIAL_ROT+1,
AXIAL_ROT_Y_AXIS,
AXIAL_ROT_Z_AXIS,
POINT_ROT_WORLD_Z_AXIS,
CACHE_DIRTY
};
Mode _mode;
Vec3 _axis;
Vec3 _normal;
Matrix _rotateNormalToZAxis;
PositionList _positionList;
// used internally as cache of which what _axis is aligned to help
// decide which method of rotation to use.
int _cachedMode;
Vec3 _side;
void updateCache();
};
}
#endif
Geode
Matrix
osg::Billboard::updateCache
void updateCache()
osg::Billboard::_cachedMode
int _cachedMode
Definition Billboard:124
osg::Billboard::setNormal
void setNormal(const Vec3 &normal)
osg::Billboard::getNormal
const Vec3 & getNormal() const
Definition Billboard:57
osg::Billboard::computeMatrix
bool computeMatrix(Matrix &modelview, const Vec3 &eye_local, const Vec3 &pos_local) const
osg::Billboard::getAxis
const Vec3 & getAxis() const
Definition Billboard:52
osg::Billboard::addDrawable
virtual bool addDrawable(Drawable *gset)
osg::Billboard::setPositionList
void setPositionList(PositionList &pl)
Definition Billboard:69
osg::Billboard::getPositionList
const PositionList & getPositionList() const
Definition Billboard:75
osg::Billboard::_axis
Vec3 _axis
Definition Billboard:117
osg::Billboard::Mode
Mode
Definition Billboard:30
osg::Billboard::POINT_ROT_WORLD
@ POINT_ROT_WORLD
Definition Billboard:32
osg::Billboard::AXIAL_ROT
@ AXIAL_ROT
Definition Billboard:33
osg::Billboard::POINT_ROT_EYE
@ POINT_ROT_EYE
Definition Billboard:31
osg::Billboard::removeDrawable
virtual bool removeDrawable(Drawable *gset)
osg::Billboard::getMode
Mode getMode() const
Definition Billboard:46
osg::Billboard::setMode
void setMode(Mode mode)
osg::Billboard::setPosition
void setPosition(unsigned int i, const Vec3 &pos)
Definition Billboard:61
osg::Billboard::getPositionList
PositionList & getPositionList()
Definition Billboard:72
osg::Billboard::getPosition
const Vec3 & getPosition(unsigned int i) const
Definition Billboard:63
osg::Billboard::Billboard
Billboard(const Billboard &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::Billboard::setAxis
void setAxis(const Vec3 &axis)
osg::Billboard::_normal
Vec3 _normal
Definition Billboard:118
osg::Billboard::PositionList
std::vector< Vec3 > PositionList
Definition Billboard:66
osg::Billboard::addDrawable
virtual bool addDrawable(Drawable *gset, const Vec3 &pos)
osg::Billboard::META_Node
META_Node(osg, Billboard)
osg::Billboard::~Billboard
virtual ~Billboard()
osg::Billboard::AxisAligned
AxisAligned
Definition Billboard:107
osg::Billboard::CACHE_DIRTY
@ CACHE_DIRTY
Definition Billboard:112
osg::Billboard::AXIAL_ROT_X_AXIS
@ AXIAL_ROT_X_AXIS
Definition Billboard:108
osg::Billboard::POINT_ROT_WORLD_Z_AXIS
@ POINT_ROT_WORLD_Z_AXIS
Definition Billboard:111
osg::Billboard::AXIAL_ROT_Y_AXIS
@ AXIAL_ROT_Y_AXIS
Definition Billboard:109
osg::Billboard::AXIAL_ROT_Z_AXIS
@ AXIAL_ROT_Z_AXIS
Definition Billboard:110
osg::Billboard::_mode
Mode _mode
Definition Billboard:116
osg::Billboard::computeBound
virtual BoundingSphere computeBound() const
osg::Billboard::_side
Vec3 _side
Definition Billboard:125
osg::Billboard::Billboard
Billboard()
osg::Billboard::_rotateNormalToZAxis
Matrix _rotateNormalToZAxis
Definition Billboard:119
osg::Billboard::_positionList
PositionList _positionList
Definition Billboard:120
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Drawable
Definition Drawable:89
osg::Geode::Geode
Geode()
osg
Definition AlphaFunc:19
osg::Vec3
Vec3f Vec3
Definition Vec3:21
osg::BoundingSphere
BoundingSphered BoundingSphere
Definition BoundingSphere:314
osg::Matrix
Matrixd Matrix
Definition Matrix:27
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39