UNPKG

2.03 kBJavaScriptView Raw
1import { TYPES } from "@pixi/constants";
2class Attribute {
3 /**
4 * @param buffer - the id of the buffer that this attribute will look for
5 * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.
6 * @param normalized - should the data be normalized.
7 * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available
8 * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)
9 * @param [start=0] - How far into the array to start reading values (used for interleaving data)
10 * @param [instance=false] - Whether the geometry is instanced.
11 * @param [divisor=1] - Divisor to use when doing instanced rendering
12 */
13 constructor(buffer, size = 0, normalized = !1, type = TYPES.FLOAT, stride, start, instance, divisor = 1) {
14 this.buffer = buffer, this.size = size, this.normalized = normalized, this.type = type, this.stride = stride, this.start = start, this.instance = instance, this.divisor = divisor;
15 }
16 /** Destroys the Attribute. */
17 destroy() {
18 this.buffer = null;
19 }
20 /**
21 * Helper function that creates an Attribute based on the information provided
22 * @param buffer - the id of the buffer that this attribute will look for
23 * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2
24 * @param [normalized=false] - should the data be normalized.
25 * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available
26 * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)
27 * @returns - A new {@link PIXI.Attribute} based on the information provided
28 */
29 static from(buffer, size, normalized, type, stride) {
30 return new Attribute(buffer, size, normalized, type, stride);
31 }
32}
33export {
34 Attribute
35};
36//# sourceMappingURL=Attribute.mjs.map