1 | {"version":3,"file":"Attribute.mjs","sources":["../../src/geometry/Attribute.ts"],"sourcesContent":["import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n public divisor: number;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n * @param [divisor=1] - Divisor to use when doing instanced rendering\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean, divisor = 1)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n this.divisor = divisor;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n"],"names":[],"mappings":";;AAWO,MAAM,SACb,CAAA;AAAA,EAoBI,WAAY,CAAA,MAAA,EAAgB,IAAO,GAAA,CAAA,EAAG,UAAa,GAAA,KAAA,EAAO,IAAO,GAAA,KAAA,CAAM,KAAO,EAAA,MAAA,EAAiB,KAAgB,EAAA,QAAA,EAAoB,UAAU,CAC7I,EAAA;AACI,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA,CAAA;AACZ,IAAA,IAAA,CAAK,UAAa,GAAA,UAAA,CAAA;AAClB,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA,CAAA;AACZ,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,IAAA,IAAA,CAAK,QAAW,GAAA,QAAA,CAAA;AAChB,IAAA,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AAAA,GACnB;AAAA,EAGA,OACA,GAAA;AACI,IAAA,IAAA,CAAK,MAAS,GAAA,IAAA,CAAA;AAAA,GAClB;AAAA,EAWA,OAAO,IAAK,CAAA,MAAA,EAAgB,IAAe,EAAA,UAAA,EAAsB,MAAc,MAC/E,EAAA;AACI,IAAA,OAAO,IAAI,SAAU,CAAA,MAAA,EAAQ,IAAM,EAAA,UAAA,EAAY,MAAM,MAAM,CAAA,CAAA;AAAA,GAC/D;AACJ;;;;"} |