Billboard
Billboard is a flat unit-sized quad oriented toward the camera at all times. It is usually textured and exposes the minimal Renderable interface so it can be submitted to the renderer. Common use cases include particles, labels, icons, and world-space markers.
MyNode::MyNode() {
auto texture = LoadTexture("assets/billboard.png");
if (texture.has_value()) {
auto material = vglx::BillboardMaterial::Create({.texture_map = texture.value()});
Add(vglx::Billboard::Create(material))->transform.SetScale(0.5f);
} else {
std::println(stderr, "{}", texture.error());
}
}INFO
Derives from Renderable and inherits all public properties and methods.
Construction
Constructors
Billboard()
Constructs a billboard.
If material is null a new instance of BillboardMaterial will be created.
Billboard::Billboard(std::shared_ptr<BillboardMaterial> material);| Parameter | Description |
|---|---|
| material | Material used to render the billboard. |
Factories preferred
Creates an instance of Billboard.
static std::unique_ptr<Billboard> Billboard::Create(std::shared_ptr<BillboardMaterial> material=nullptr);| Parameter | Description |
|---|---|
| material | Shared billboard material. |
Properties
Normalized anchor point inside the billboard.
Defines the pivot used for placement and rotation of the billboard.
- lower-left corner of the billboard.
- center of the billboard (default).
- upper-right corner of the billboard.
The billboard's world-space position corresponds to this anchor point. Rotation is applied around this pivot.
Vector2 anchor {Vector2 {0.5f, 0.5f}};rotation float
View-space rotation angle in radians applied to the billboard.
float rotation {0.0f};Functions
Returns the material associated with the billboard.
std::shared_ptr<Material> Billboard::GetMaterial() const override;GetNodeType() Node::Type virtual
Identifies this node as.
Type vglx::Billboard::GetNodeType() const override;SetMaterial() auto
Sets the material used to render the billboard.
auto Billboard::SetMaterial(std::shared_ptr<BillboardMaterial> material);| Parameter | Description |
|---|---|
| material | Shared pointer to a billboard material. |