UNPKG

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