SpriteMaterial
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.
auto material = vglx::SpriteMaterial::Create({
.color = 0xFFFFFF,
.texture_map = texture
});
my_scene->Add(vglx::Sprite::Create(material));INFO
Derives from Material and inherits all public properties and methods.
Construction
Constructors
SpriteMaterial()
Constructs a sprite material from the given parameters.
Transparency is enabled by default and uses the alpha channel of the provided texture.
SpriteMaterial::SpriteMaterial(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters. |
Factories preferred
SpriteMaterial::Create() std::shared_ptr<SpriteMaterial>
Creates a shared instance of SpriteMaterial with default parameters.
static std::shared_ptr<SpriteMaterial> SpriteMaterial::Create();SpriteMaterial::Create() std::shared_ptr<SpriteMaterial>
Creates a shared instance of SpriteMaterial.
static std::shared_ptr<SpriteMaterial> SpriteMaterial::Create(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters. |
Types
SpriteMaterial::Parameters struct
Parameters for constructing a SpriteMaterial object.
| Parameter | Description |
|---|---|
| color Color | Base tint color applied to the texture. |
| texture_map std::shared_ptr<Texture> | Sprite texture sampled for color and alpha. |
| size_attenuation bool | Attenuate sprite size by distance in perspective. |
Properties
size_attenuation bool
Controls whether sprite size is attenuated by distance in perspective.
bool size_attenuation {true};Sprite texture sampled in RGBA; alpha controls transparency.
std::shared_ptr<Texture> texture_map {};Functions
Identifies this material as Material::Type::SpriteMaterial.
Type SpriteMaterial::GetType() const override;