SpriteMaterial
Lightweight material for textured 2D sprites and billboards.
Designed for camera-facing quads such as UI elements, particles, and glyphs. Renders without lighting (unlit) and uses an RGBA texture with an optional tint color. Transparency is enabled by default and driven by the texture's alpha channel.
cpp
auto material = vglx::SpriteMaterial::Create(texture, 0xFFFFFF);
auto sprite = vglx::Sprite::Create(material);
scene->Add(sprite);INFO
Derives from Material and inherits all public properties and methods.
Construction
Constructors
SpriteMaterial()
Constructs a sprite material.
Transparency is enabled by default and uses the alpha channel of the provided texture.
cpp
SpriteMaterial::SpriteMaterial(std::shared_ptr<Texture2D> texture_map, const Color& color=0xFFFFFF);| Parameter | Description |
|---|---|
| texture_map | Sprite texture to sample for color and alpha. |
| color | Base tint color applied to the texture. |
Factories preferred
SpriteMaterial::Create() auto
Creates a shared instance of SpriteMaterial.
cpp
static auto SpriteMaterial::Create(std::shared_ptr<Texture2D> texture_map, const Color& color=0xFFFFFF);| Parameter | Description |
|---|---|
| texture_map | Sprite texture to sample for color and alpha. |
| color | Base tint color applied to the texture. |
Properties
Sprite texture sampled in RGBA; alpha controls transparency.
cpp
std::shared_ptr<Texture2D> texture_map {};Functions
Identifies this material as Material::Type::SpriteMaterial.
cpp
Type SpriteMaterial::GetType() const override;