1 | {"version":3,"file":"Attribute.js","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":["TYPES"],"mappings":";;AAWO,MAAM,UACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBI,YAAY,QAAgB,OAAO,GAAG,aAAa,IAAO,OAAOA,UAAAA,MAAM,OAAO,QAAiB,OAAgB,UAAoB,UAAU,GAC7I;AACS,SAAA,SAAS,QACd,KAAK,OAAO,MACZ,KAAK,aAAa,YAClB,KAAK,OAAO,MACZ,KAAK,SAAS,QACd,KAAK,QAAQ,OACb,KAAK,WAAW,UAChB,KAAK,UAAU;AAAA,EACnB;AAAA;AAAA,EAGA,UACA;AACI,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,KAAK,QAAgB,MAAe,YAAsB,MAAc,QAC/E;AACI,WAAO,IAAI,UAAU,QAAQ,MAAM,YAAY,MAAM,MAAM;AAAA,EAC/D;AACJ;;"} |