import { Geometry } from "../Geometry";
import { Sprite3dMaterial } from "../materials";
import { Mesh3D } from "../Mesh3D";

//所有sprite公用一个几何
let geometrySpirte3D: Geometry;
export class Sprite3D extends Mesh3D {
    constructor(material: Sprite3dMaterial) {
        if (!geometrySpirte3D) {
            var vertices = [
                - 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
            ];
            var uvs = [
                0, 1,
                1, 1,
                1, 0,
                0, 0
            ];
            geometrySpirte3D = new Geometry(vertices, [0, 1, 2, 0, 2, 3], null, null, uvs);
        }
        //@ts-ignore
        super(geometrySpirte3D, material);
    }
}