openscenegraph
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
39 Billboard(const Billboard&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
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
69 inline void setPositionList(PositionList& pl) { _positionList=pl; }
70
72 inline PositionList& getPositionList() { return _positionList; }
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
107 {
108 AXIAL_ROT_X_AXIS=AXIAL_ROT+1,
112 CACHE_DIRTY
113 };
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
Definition Billboard:27
void updateCache()
int _cachedMode
Definition Billboard:124
void setNormal(const Vec3 &normal)
const Vec3 & getNormal() const
Definition Billboard:57
bool computeMatrix(Matrix &modelview, const Vec3 &eye_local, const Vec3 &pos_local) const
const Vec3 & getAxis() const
Definition Billboard:52
virtual bool addDrawable(Drawable *gset)
void setPositionList(PositionList &pl)
Definition Billboard:69
const PositionList & getPositionList() const
Definition Billboard:75
Vec3 _axis
Definition Billboard:117
Mode
Definition Billboard:30
@ POINT_ROT_WORLD
Definition Billboard:32
@ POINT_ROT_EYE
Definition Billboard:31
virtual bool removeDrawable(Drawable *gset)
Mode getMode() const
Definition Billboard:46
void setMode(Mode mode)
void setPosition(unsigned int i, const Vec3 &pos)
Definition Billboard:61
PositionList & getPositionList()
Definition Billboard:72
const Vec3 & getPosition(unsigned int i) const
Definition Billboard:63
Billboard(const Billboard &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
void setAxis(const Vec3 &axis)
Vec3 _normal
Definition Billboard:118
std::vector< Vec3 > PositionList
Definition Billboard:66
virtual bool addDrawable(Drawable *gset, const Vec3 &pos)
META_Node(osg, Billboard)
virtual ~Billboard()
AxisAligned
Definition Billboard:107
@ 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
Vec3 _side
Definition Billboard:125
Matrix _rotateNormalToZAxis
Definition Billboard:119
PositionList _positionList
Definition Billboard:120
Definition BoundingSphere:35
Definition CopyOp:41
Definition Drawable:89
Definition Geode:29
Definition Matrixd:27
Definition Vec3f:29
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39