@spearwolf/twopoint5d
Version:
Create 2.5D realtime graphics and pixelart with WebGL and three.js
26 lines • 739 B
JavaScript
export class BaseSprite {
make(width = 0.5, height = 0.5, xOffset = 0, yOffset = 0) {
this.setPosition([
-width + xOffset, -height + yOffset, 0,
-width + xOffset, +height + yOffset, 0,
+width + xOffset, +height + yOffset, 0,
+width + xOffset, -height + yOffset, 0,
]);
this.setUv([
0, 1,
0, 0,
1, 0,
1, 1,
]);
}
}
export const BaseSpriteDescriptor = {
vertexCount: 4,
indices: [0, 2, 1, 0, 3, 2],
attributes: {
position: { components: ['x', 'y', 'z'] },
uv: { components: ['u', 'v'] },
},
basePrototype: BaseSprite.prototype,
};
//# sourceMappingURL=BaseSprite.js.map