Unigine::ObjectBillboards Class
Interface for object billboards handling. See also the UnigineScript analog.
To use this class, include the UnigineObjectBillboards.h file.
Unigine::ObjectBillboards Class
Members
static int type ()
ObjectBillboards type.Return value
ObjectBillboards type identifier.static Ptr< ObjectBillboards > create (const NodePtr & node)
ObjectBillboards constructor.Arguments
- const NodePtr & node - Node smart pointer.
static Ptr< ObjectBillboards > create (const ObjectPtr & object)
ObjectBillboards constructor.Arguments
- const ObjectPtr & object - Object smart pointer.
static Ptr< ObjectBillboards > create ()
ObjectBillboards constructor.virtual void setDepthSort (int sort) const =0
Sets a value indicating if the depth sorting (in back-to-front order) of billboards is enabled. The depth sorting should be enabled, if alpha blending is used for the billboard material.Arguments
- int sort - 1 to enable the depth sorting, 0 to disable it. The default is 0.
virtual int getDepthSort () const =0
Returns a value indicating if the depth sorting (in back-to-front order) of billboards is enabled. The depth sorting should be enabled, if alpha blending is used for the billboard material.Return value
Returns 1 if the depth sorting is enabled; otherwise, 0.virtual void clearBillboards () const =0
Deletes all billboards from the Billboards object.virtual void allocateBillboards (int num) const =0
Allocates a buffer for a given number of billboards that will be created.Arguments
- int num - The number of billboards to be created in the allocated buffer.
virtual int addBillboard (float width, float height) const =0
Adds a billboard with given width and height to be managed by the Billboards object. A position, texture coordinates and an angle of the new billboard are set to default:- position is set to vec3(0,0,0)
- texture coordinates are set to vec4(1,1,0,0)
- angle is set to 0.
Arguments
- float width - Billboard width in units.
- float height - Billboard height in units.
Return value
Number of the added billboard.virtual void removeBillboard (int num) const =0
Removes a given billboard from the Billboard object.Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
virtual int getNumBillboards () const =0
Returns the total number of billboards contained in and managed by Billboards object.Return value
Number of billboards.virtual void setPosition (int num, const vec3 & position) const =0
Updates the position of a given billboard. The default is vec3(0,0,0).Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
- const vec3 & position - New billboard position coordinates.
virtual vec3 getPosition (int num) const =0
Returns the position of a given billboard. The default is vec3(0,0,0).Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
Return value
Billboard position coordinates.virtual void setTexCoord (int num, const vec4 & texcoord) const =0
Updates texture coordinates of a given billboard. The default is vec4(1,1,0,0).- The first pair of coordinates (x and x) sets texture scale by X and Y axes. For example, by the scale of 2 the texture is repeated twice on the billboard.
- The second pair (z and w) set texture offset along X and Y axes. For example, by the offset of 0.5 along X axis the texture is repositioned to the right (so that the edge of the texture is rendered in the center).
Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
- const vec4 & texcoord - New texture coordinates.
virtual vec4 getTexCoord (int num) const =0
Returns the texture coordinates of a given billboard. The default is vec4(1,1,0,0).- The first pair of coordinates (x and x) sets texture scale by X and Y axes. For example, by the scale of 2 the texture is repeated twice on the billboard.
- The second pair (z and w) set texture offset along X and Y axes. For example, by the offset of 0.5 along X axis the texture is repositioned to the right (so that the edge of the texture is rendered in the center).
Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
Return value
Billboard texture coordinates.virtual void setWidth (int num, float width) const =0
Updates a width of a given billboard.Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
- float width - New billboard width in units.
virtual float getWidth (int num) const =0
Returns the width of a given billboard.Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
Return value
Billboard width in units.virtual void setHeight (int num, float height) const =0
Updates a height of a given billboard.Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
- float height - New billboard height in units.
virtual float getHeight (int num) const =0
Returns the height of a given billboard.Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
Return value
Billboard height in units.virtual void setAngle (int num, float angle) const =0
Updates an angle of a given billboard, which is used to set the billboard orientation.Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
- float angle - Billboard angle in degrees to set the billboard orientation. Positive values rotate the billboard clockwise, negative ones rotate it counter-clockwise.
virtual float getAngle (int num) const =0
Returns the angle of a given billboard, which is used to set the billboard orientation.Arguments
- int num - Billboard number in range from 0 to the total number of billboards.
Return value
Billboard angle in degrees. The default is 0 degrees.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)