@spearwolf/twopoint5d
Version:
a library to create 2.5d realtime graphics and pixelart with three.js
34 lines • 1.03 kB
JavaScript
export class TileBaseSprite {
make(width = 1, height = 1, xOffset = 0, zOffset = 0) {
this.setPosition([
xOffset, 0, zOffset,
xOffset, 0, zOffset + height,
xOffset + width, 0, zOffset + height,
xOffset + width, 0, zOffset,
]);
this.setUv([
0, 0,
0, 1,
1, 1,
1, 0,
]);
}
}
export const TileBaseSpriteDescriptor = {
vertexCount: 4,
indices: [0, 1, 2, 0, 2, 3],
attributes: {
position: { components: ['x', 'y', 'z'] },
uv: { size: 2 },
},
basePrototype: TileBaseSprite.prototype,
};
export const TileSpriteDescriptor = {
meshCount: 1,
attributes: {
instancePosition: { components: ['x', 'y', 'z'], usage: 'dynamic', autoTouch: false },
texCoords: { size: 4, usage: 'dynamic', autoTouch: false },
quadSize: { components: ['width', 'height'], usage: 'dynamic', autoTouch: false },
},
};
//# sourceMappingURL=descriptors.js.map