OpenSceneGraph 3.6.5
Billboard
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_BILLBOARD
15#define OSG_BILLBOARD 1
16
17#include <osg/Matrix>
18#include <osg/Geode>
19
20namespace osg {
21
27{
28 public:
29
35
37
40
42
44 void setMode(Mode mode);
46 inline Mode getMode() const { return _mode; }
47
50 void setAxis(const Vec3& axis);
52 inline const Vec3& getAxis() const { return _axis; }
53
55 void setNormal(const Vec3& normal);
57 inline const Vec3& getNormal() const { return _normal; }
58
59
61 inline void setPosition(unsigned int i,const Vec3& pos) { _positionList[i] = pos; }
63 inline const Vec3& getPosition(unsigned int i) const { return _positionList[i]; }
64
66 typedef std::vector<Vec3> PositionList;
67
70
73
75 inline const PositionList& getPositionList() const { return _positionList; }
76
82 virtual bool addDrawable( Drawable *gset );
83
89 virtual bool addDrawable(Drawable *gset,const Vec3& pos);
90
95 virtual bool removeDrawable( Drawable *gset );
96
97
98 bool computeMatrix(Matrix& modelview, const Vec3& eye_local, const Vec3& pos_local) const;
99
101
102 protected:
103
104 virtual ~Billboard();
105
114
115
121
122 // used internally as cache of which what _axis is aligned to help
123 // decide which method of rotation to use.
127
128};
129
130}
131
132#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec3f Vec3
Definition Vec3:21
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Matrixd Matrix
Definition Matrix:27
void updateCache()
int _cachedMode
Definition Billboard:124
void setNormal(const Vec3 &normal)
This normal defines child Drawables' front face direction when unrotated.
const Vec3 & getNormal() const
Get the front face direction normal.
Definition Billboard:57
bool computeMatrix(Matrix &modelview, const Vec3 &eye_local, const Vec3 &pos_local) const
const Vec3 & getAxis() const
Get the rotation axis.
Definition Billboard:52
virtual bool addDrawable(Drawable *gset)
Add a Drawable with a default position of Vec3(0,0,0).
void setPositionList(PositionList &pl)
Set the list of pivot point positions.
Definition Billboard:69
const PositionList & getPositionList() const
Get a const list of pivot point positions.
Definition Billboard:75
Vec3 _axis
Definition Billboard:117
Mode
Definition Billboard:30
@ POINT_ROT_WORLD
Definition Billboard:32
@ AXIAL_ROT
Definition Billboard:33
@ POINT_ROT_EYE
Definition Billboard:31
virtual bool removeDrawable(Drawable *gset)
Remove a Drawable and its associated position.
Mode getMode() const
Get the billboard rotation mode.
Definition Billboard:46
void setMode(Mode mode)
Set the billboard rotation mode.
void setPosition(unsigned int i, const Vec3 &pos)
Set the specified child Drawable's position.
Definition Billboard:61
PositionList & getPositionList()
Get the list of pivot point positions.
Definition Billboard:72
const Vec3 & getPosition(unsigned int i) const
Get the specified child Drawable's position.
Definition Billboard:63
Billboard(const Billboard &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void setAxis(const Vec3 &axis)
Set the rotation axis for the billboard's child Drawables.
Vec3 _normal
Definition Billboard:118
std::vector< Vec3 > PositionList
Type definition for pivot point position list.
Definition Billboard:66
virtual bool addDrawable(Drawable *gset, const Vec3 &pos)
Add a Drawable with a specified position.
META_Node(osg, Billboard)
virtual ~Billboard()
AxisAligned
Definition Billboard:107
@ CACHE_DIRTY
Definition Billboard:112
@ AXIAL_ROT_X_AXIS
Definition Billboard:108
@ POINT_ROT_WORLD_Z_AXIS
Definition Billboard:111
@ AXIAL_ROT_Y_AXIS
Definition Billboard:109
@ AXIAL_ROT_Z_AXIS
Definition Billboard:110
Mode _mode
Definition Billboard:116
virtual BoundingSphere computeBound() const
Compute the bounding sphere around Node's geometry or children.
Vec3 _side
Definition Billboard:125
Matrix _rotateNormalToZAxis
Definition Billboard:119
PositionList _positionList
Definition Billboard:120
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Pure virtual base class for drawable geometry.
Definition Drawable:89
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.