Fixed the X and Y axis rotation billboards so that now rotate correctly.

Rewrote the osgbillboard demo so that it creates a point rotatated billbaord
and X,Y and Z axis billboards to both test and demonstrate this types of
billboards in action.
This commit is contained in:
Robert Osfield
2002-08-09 16:27:39 +00:00
parent 0c6991ea27
commit 392150521a
5 changed files with 199 additions and 366 deletions

View File

@@ -35,11 +35,16 @@ class SG_EXPORT Billboard : public Geode
/** Get the billboard rotation mode. */
inline const Mode getMode() const { return _mode; }
/** Set the axis about which all the billboard's drawable rotate. */
/** Set the axis about which all the billboard's drawable rotate. Only utlized when mode==AXIAL_ROT*/
void setAxis(const Vec3& axis);
/** Get the axis about which all the billboard's drawable rotate. */
inline const Vec3& getAxis() const { return _axis; }
/** Set the normal which defines the billboard's drawable front face, when unrotated. */
void setNormal(const Vec3& normal);
/** Get the normal of billboard's drawable front face. */
inline const Vec3& getNormal() const { return _normal; }
/** Set the position of specified drawable. */
inline void setPos(int i,const Vec3& pos) { _positionList[i] = pos; }
@@ -117,20 +122,22 @@ class SG_EXPORT Billboard : public Geode
{
AXIAL_ROT_X_AXIS=AXIAL_ROT+1,
AXIAL_ROT_Y_AXIS,
AXIAL_ROT_Z_AXIS
AXIAL_ROT_Z_AXIS,
CACHE_DIRTY
};
Mode _mode;
Vec3 _axis;
Vec3 _normal;
PositionList _positionList;
ref_ptr<ComputeBillboardCallback> _computeBillboardCallback;
// used internally as cache of which what _axis is aligned to help
// deicde which method of rotation to use.
int _cachedMode;
void setCachedMode();
int _cachedMode;
Vec3 _side;
void updateCache();
};