Sprite constructor
Sprite({
- TextureSource? texture,
- double width = 1.0,
- double height = 1.0,
- Vector4? color,
- double rotation = 0.0,
- BillboardFacing facing = BillboardFacing.spherical,
- SpriteBlendMode blendMode = SpriteBlendMode.alpha,
Creates a sprite, optionally textured.
Implementation
Sprite({
TextureSource? texture,
double width = 1.0,
double height = 1.0,
Vector4? color,
double rotation = 0.0,
BillboardFacing facing = BillboardFacing.spherical,
SpriteBlendMode blendMode = SpriteBlendMode.alpha,
}) : _width = width,
_height = height,
_color = color ?? Vector4(1, 1, 1, 1),
_rotation = rotation {
material = SpriteMaterial(colorTexture: texture)..blendMode = blendMode;
geometry.facing = facing;
mesh = Mesh(geometry, material);
_refresh();
}