29#ifndef __BillboardSet_H__
30#define __BillboardSet_H__
333 bool externalDataSource =
false);
732 bool debugRenderables =
false);
835 {
return mPointRendering; }
A 3D box aligned with the x/y/z axes.
Factory object for creating BillboardSet instances.
void destroyInstance(MovableObject *obj)
Destroy an instance of the object.
static String FACTORY_TYPE_NAME
MovableObject * createInstanceImpl(const String &name, const NameValuePairList *params)
Internal implementation of create method - must be overridden.
const String & getType(void) const
Get the type of the object to be created.
A collection of billboards (faces which are always facing the given direction) with the same (default...
bool getAutoUpdate(void) const
Return the auto update state of this billboard set.
Real mDefaultHeight
Default height of each billboard.
vector< Ogre::FloatRect >::type TextureCoordSets
void genVertices(const Vector3 *const offsets, const Billboard &pBillboard)
Internal method for generating vertex data.
virtual void clear()
Empties this set of all billboards.
Vector3 mCommonUpVector
Common up-vector for billboards of type BBT_PERPENDICULAR_SELF and BBT_PERPENDICULAR_COMMON.
virtual void _notifyBillboardRotated(void)
Internal callback used by Billboards to notify their parent that they have been rotated.
virtual void setMaterial(const MaterialPtr &material)
Sets the name of the material to be used for this billboard set.
void genVertOffsets(Real inleft, Real inright, Real intop, Real inbottom, Real width, Real height, const Vector3 &x, const Vector3 &y, Vector3 *pDestVec)
Internal method generates vertex offsets.
Vector3 mCommonDirection
Common direction for billboards of type BBT_ORIENTED_COMMON and BBT_PERPENDICULAR_COMMON.
virtual void _updateBounds(void)
Update the bounds of the billboardset.
virtual SortMode _getSortMode(void) const
Gets the sort mode of this billboard set.
virtual void setUseAccurateFacing(bool acc)
Sets whether or not billboards should use an 'accurate' facing model based on the vector from each bi...
virtual void setBillboardType(BillboardType bbt)
Sets the type of billboard to render.
Camera * mCurrentCamera
Current camera.
AxisAlignedBox mAABB
Bounds of all billboards in this set.
virtual const AxisAlignedBox & getBoundingBox(void) const
Overridden from MovableObject.
virtual void increasePool(size_t size)
Internal method for increasing pool size.
virtual void setCullIndividually(bool cullIndividual)
Sets whether culling tests billboards in this individually as well as in a group.
bool mAutoExtendPool
Flag indicating whether to autoextend pool.
virtual bool getSortingEnabled(void) const
Returns true if sorting of billboards is enabled based on their distance from the camera.
virtual bool isPointRenderingEnabled(void) const
Returns whether point rendering is enabled.
virtual void _notifyCurrentCamera(Camera *cam)
Overridden from MovableObject.
BillboardType mBillboardType
The type of billboard to render.
virtual Ogre::FloatRect const * getTextureCoords(uint16 *oNumCoords)
getTextureCoords() returns the current texture coordinate rects in effect.
virtual const Vector3 & getCommonUpVector(void) const
Gets the common up-vector for all billboards (BBT_PERPENDICULAR_SELF and BBT_PERPENDICULAR_COMMON)
virtual void getRenderOperation(RenderOperation &op)
Overridden from MovableObject.
BillboardOrigin mOriginType
Origin of each billboard.
void injectBillboard(const Billboard &bb)
Define a billboard.
virtual void setSortingEnabled(bool sortenable)
Enables sorting for this BillboardSet.
VertexData * mVertexData
The vertex position data for all billboards in this set.
bool billboardVisible(Camera *cam, const Billboard &bill)
Internal method for culling individual billboards.
virtual void removeBillboard(Billboard *pBill)
Removes a billboard from the set.
Real mBoundingRadius
Bounding radius.
virtual void setPointRenderingEnabled(bool enabled)
Set whether or not the BillboardSet will use point rendering rather than manually generated quads.
TextureCoordSets mTextureCoords
uint32 getTypeFlags(void) const
Override to return specific type flag.
FreeBillboardList mFreeBillboards
Free billboard queue.
HardwareVertexBufferSharedPtr mMainBuf
Shortcut to main buffer (positions, colours, texture coords)
virtual void setDefaultWidth(Real width)
See setDefaultDimensions - this sets 1 component individually.
float * mLockPtr
Locked pointer to buffer.
vector< Billboard * >::type BillboardPool
const LightList & getLights(void) const
Gets a list of lights, ordered relative to how close they are to this renderable.
virtual void removeBillboard(unsigned int index)
Removes the billboard at the supplied index.
virtual bool getAutoextend(void) const
Returns true if the billboard pool automatically extends.
Vector3 mCamDir
Camera direction in billboard space.
virtual bool getUseAccurateFacing(void) const
Gets whether or not billboards use an 'accurate' facing model based on the vector from each billboard...
bool mSortingEnabled
Flag indicating whether the billboards has to be sorted.
bool mAllDefaultSize
True if no billboards in this set have been resized - greater efficiency.
virtual void setDefaultHeight(Real height)
See setDefaultDimensions - this sets 1 component individually.
virtual void setTextureCoords(Ogre::FloatRect const *coords, uint16 numCoords)
BillboardSet can use custom texture coordinates for various billboards.
bool mBuffersCreated
Flag indicating whether the HW buffers have been created.
virtual void setPoolSize(size_t size)
Adjusts the size of the pool of billboards available in this set.
void beginBillboards(size_t numBillboards=0)
Begin injection of billboard data; applicable when constructing the BillboardSet for external data us...
virtual const Vector3 & getCommonDirection(void) const
Gets the common direction for all billboards (BBT_ORIENTED_COMMON)
bool getBillboardsInWorldSpace()
Gets whether billboards are treated as being in world space.
IndexData * mIndexData
The vertex index data for all billboards in this set (1 set only)
ActiveBillboardList mActiveBillboards
Active billboard list.
virtual void setTextureStacksAndSlices(uchar stacks, uchar slices)
setTextureStacksAndSlices() will generate texture coordinate rects as if the texture for the billboar...
void setBounds(const AxisAlignedBox &box, Real radius)
Set the bounds of the BillboardSet.
BillboardRotationType mRotationType
Rotation type of each billboard.
virtual void setBillboardsInWorldSpace(bool ws)
Sets whether billboards should be treated as being in world space.
virtual int getNumBillboards(void) const
Returns the number of active billboards which currently make up this set.
virtual const String & getMaterialName(void) const
Sets the name of the material to be used for this billboard set.
Billboard * createBillboard(const Vector3 &position, const ColourValue &colour=ColourValue::White)
Creates a new billboard and adds it to this set.
virtual void setMaterialName(const String &name, const String &groupName=ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME)
Sets the name of the material to be used for this billboard set.
virtual unsigned int getPoolSize(void) const
Returns the current size of the billboard pool.
Real getSquaredViewDepth(const Camera *cam) const
Overridden, see Renderable.
virtual const MaterialPtr & getMaterial(void) const
Overridden from MovableObject.
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false)
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject ...
void genBillboardAxes(Vector3 *pX, Vector3 *pY, const Billboard *pBill=0)
Internal method for generating billboard corners.
virtual const String & getMovableType(void) const
Overridden from MovableObject.
MaterialPtr mMaterial
Pointer to the material to use.
void getParametricOffsets(Real &left, Real &right, Real &top, Real &bottom)
Internal method, generates parametric offsets based on origin.
virtual void setAutoextend(bool autoextend)
Tells the set whether to allow automatic extension of the pool of billboards.
void endBillboards(void)
Finish defining billboards.
Billboard * createBillboard(Real x, Real y, Real z, const ColourValue &colour=ColourValue::White)
Creates a new billboard and adds it to this set.
bool mExternalData
Is external billboard data in use?
void notifyBillboardDataChanged(void)
When billboard set is not auto updating its GPU buffer, the user is responsible to inform it about an...
virtual void setBillboardRotationType(BillboardRotationType rotationType)
Sets billboard rotation type.
virtual Real getDefaultHeight(void) const
See setDefaultDimensions - this gets 1 component individually.
void _createBuffers(void)
Internal method creates vertex and index buffers.
bool mCullIndividual
Flag indicating whether each billboard should be culled separately (default: false)
Real mDefaultWidth
Default width of each billboard.
bool mBillboardDataChanged
True if the billboard data changed. Will cause vertex buffer update.
virtual void setCommonDirection(const Vector3 &vec)
Use this to specify the common direction given to billboards of type BBT_ORIENTED_COMMON or BBT_PERPE...
size_t mPoolSize
The number of billboard in the pool.
bool mAutoUpdate
Tell if vertex buffer should be update automatically.
virtual BillboardRotationType getBillboardRotationType(void) const
Sets billboard rotation type.
BillboardSet()
Private constructor (instances cannot be created directly).
virtual void _notifyBillboardResized(void)
Internal callback used by Billboards to notify their parent that they have been resized.
virtual Billboard * getBillboard(unsigned int index) const
Returns a pointer to the billboard at the supplied index.
void _destroyBuffers(void)
Internal method destroys vertex and index buffers.
virtual void setDefaultDimensions(Real width, Real height)
Sets the default dimensions of the billboards in this set.
virtual bool getCullIndividually(void) const
Returns whether or not billboards in this are tested individually for culling.
static RadixSort< ActiveBillboardList, Billboard *, float > mRadixSorter
Vector3 mCamX
Camera axes in billboard space.
String mMaterialName
Name of the material to use.
virtual void _updateRenderQueue(RenderQueue *queue)
Overridden from MovableObject.
virtual BillboardOrigin getBillboardOrigin(void) const
Gets the point which acts as the origin point for all billboards in this set.
list< Billboard * >::type FreeBillboardList
virtual void setCommonUpVector(const Vector3 &vec)
Use this to specify the common up-vector given to billboards of type BBT_PERPENDICULAR_SELF or BBT_PE...
virtual void getWorldTransforms(Matrix4 *xform) const
Overridden from MovableObject.
unsigned short mNumVisibleBillboards
Number of visible billboards (will be == getNumBillboards if mCullIndividual == false)
virtual BillboardType getBillboardType(void) const
Returns the billboard type in use.
BillboardPool mBillboardPool
Pool of billboard instances for use and reuse in the active billboard list.
virtual void setBillboardOrigin(BillboardOrigin origin)
Sets the point which acts as the origin point for all billboards in this set.
virtual Real getBoundingRadius(void) const
Overridden from MovableObject.
Vector3 mCamPos
Camera position in billboard space.
BillboardSet(const String &name, unsigned int poolSize=20, bool externalDataSource=false)
Usual constructor - this is called by the SceneManager.
bool mPointRendering
Use point rendering?
virtual void _sortBillboards(Camera *cam)
Sort the billboard set.
virtual Real getDefaultWidth(void) const
See setDefaultDimensions - this gets 1 component individually.
bool mAccurateFacing
Use 'true' billboard to cam position facing, rather than camera direcion.
void setAutoUpdate(bool autoUpdate)
Set the auto update state of this billboard set.
list< Billboard * >::type ActiveBillboardList
Quaternion mCamQ
Camera orientation in billboard space.
A billboard is a primitive which always faces the camera in every frame.
A viewpoint from which the scene will be rendered.
Class representing colour.
Shared pointer implementation used to share vertex buffers.
Summary class collecting together index data source information.
Class encapsulating a standard 4x4 homogeneous matrix.
Interface definition for a factory class which produces a certain kind of MovableObject,...
Abstract class defining a movable object in a scene.
Implementation of a Quaternion, i.e.
Class for performing a radix sort (fast comparison-less sort based on byte value) on various standard...
'New' rendering operation using vertex buffers.
Class to manage the scene object rendering queue.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly.
Abstract class defining the interface all renderable objects must implement.
Standard 3-dimensional vector.
Summary class collecting together vertex source information.
BillboardOrigin
Enum covering what exactly a billboard's position means (center, top-left etc).
BillboardRotationType
The rotation type of billboard.
BillboardType
The type of billboard to use.
@ BBR_VERTEX
Rotate the billboard's vertices around their facing direction.
@ BBR_TEXCOORD
Rotate the billboard's texture coordinates.
@ BBT_PERPENDICULAR_COMMON
Billboards are perpendicular to a shared direction vector (used as Z axis, the facing direction) and ...
@ BBT_POINT
Standard point billboard (default), always faces the camera completely and is always upright.
@ BBT_PERPENDICULAR_SELF
Billboards are perpendicular to their own direction vector (their own Z axis, the facing direction) a...
@ BBT_ORIENTED_SELF
Billboards are oriented around their own direction vector (their own Y axis) and only rotate around t...
@ BBT_ORIENTED_COMMON
Billboards are oriented around a shared direction vector (used as Y axis) and only rotate around this...
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
SortMode
Sort mode for billboard-set and particle-system.
unsigned char uchar
In order to avoid finger-aches :)
float Real
Software floating point type.
Sort by direction functor.
Vector3 sortDir
Direction to sort in.
SortByDirectionFunctor(const Vector3 &dir)
float operator()(Billboard *bill) const
Sort by distance functor.
Vector3 sortPos
Position to sort in.
float operator()(Billboard *bill) const
SortByDistanceFunctor(const Vector3 &pos)