This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

ObjectBillboard Class

This class allows creating a billboard that always faces the camera. The following samples demonstrate the ObjectBillboard class usage:

In case a lot of identical billboards need to be used, see ObjectBillboards for optimized rendering.

ObjectBillboard Class

This class inherits from Object

Members


ObjectBillboard (float width, float height)

Constructor. Creates a new billboard object with given dimensions.

Arguments

  • float width - Width of the new billboard in units.
  • float height - Height of the new billboard in units.

int getAxisX ()

Returns a value indicating if the billboard rotation is restricted by the X axis (aligned to the world X axis).

Return value

1 if the billboard rotation is restricted by the X axis; otherwise, 0.

int getAxisZ ()

Returns a value indicating if the billboard rotation is restricted by the Z axis (aligned to the world Z axis).

Return value

1 if the billboard rotation is restricted by the Z axis; otherwise, 0.

float getHeight ()

Returns the height of the billboard.

Return value

Height of the billboard in units.

vec3 getOffset ()

Returns the offset of the billboard center of rotation.

Return value

Offset in units.

int getScreen ()

Returns a value indicating if the billboard is always screen-aligned, that is strictly parallel to the screen plane and not rotating.

Return value

1 if the billboard is screen-aligned; otherwise, 0.

vec4 getTexCoord ()

Returns texture coordinates of the billboard (a texture atlas can be used).
  • The first pair of coordinates (x and y) set 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).

Return value

Texture coordinates for the billboard.

float getWidth ()

Returns the width of the billboard.

Return value

Width of the billboard in units.

void setAxisX (int axis)

Restricts rotation of the billboard by the X axis (aligned to the world X axis).

Arguments

  • int axis - Positive value to restrict X-axis rotation of the billboard; otherwise; 0.

void setAxisZ (int axis)

Restricts rotation of the billboard by the Z axis (aligned to the world Z axis).

Arguments

  • int axis - Positive value to restrict Z-axis rotation of the billboard; otherwise; 0.

void setOffset (vec3 offset)

Sets an offset of the billboard center of rotation.

Arguments

  • vec3 offset - Offset in units.

void setScreen (int mode)

Sets a value indicating if the billboard should always be screen-aligned, that is strictly parallel to the screen plane and not rotating.

Arguments

  • int mode - Positive number to make the billboard screen-aligned; 0 to let it rotate.

void setSize (float width, float height)

Updates billboard dimensions.

Arguments

  • float width - New width of the billboard in units.
  • float height - New height of the billboard in units.

void setTexCoord (vec4 texcoord)

Sets texture coordinates for the billboard (a texture atlas can be used).
  • The first pair of coordinates (x and y) set 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

  • vec4 texcoord - Texture coordinates for the billboard.
Last update: 2017-07-03
Build: ()