Sprite constructor

Sprite({
  1. TextureSource? texture,
  2. double width = 1.0,
  3. double height = 1.0,
  4. Vector4? color,
  5. double rotation = 0.0,
  6. BillboardFacing facing = BillboardFacing.spherical,
  7. 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();
}