Sprite constructor
Sprite([
- Material? material
Material material
- (optional) an instance of
SpriteMaterial. Default is a white SpriteMaterial.
Creates a new name.
Implementation
Sprite([Material? material]) : super() {
type = 'Sprite';
if (_geometry == null) {
_geometry = BufferGeometry();
final float32List = Float32List.fromList([
-0.5,
-0.5,
0,
0,
0,
0.5,
-0.5,
0,
1,
0,
0.5,
0.5,
0,
1,
1,
-0.5,
0.5,
0,
0,
1
]);
final interleavedBuffer = InterleavedBuffer.fromList(float32List, 5);
_geometry!.setIndex([0, 1, 2, 0, 2, 3]);
_geometry!.setAttributeFromString('position',InterleavedBufferAttribute(interleavedBuffer, 3, 0, false));
_geometry!.setAttributeFromString('uv', InterleavedBufferAttribute(interleavedBuffer, 2, 3, false));
}
geometry = _geometry;
this.material = (material != null) ? material : SpriteMaterial(null);
}