1 | {"version":3,"file":"getAttributeData.js","sources":["../../../src/shader/utils/getAttributeData.ts"],"sourcesContent":["import { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\nimport type { IAttributeData } from '../Program';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.startsWith('gl_'))\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n"],"names":["mapType","mapSize"],"mappings":";;;;;;;AAYO,SAAA,gBAAA,CAA0B,SAAuB,EACxD,EAAA;AACI,EAAA,MAAM,aAA8C,EAAC,CAAA;AAErD,EAAA,MAAM,eAAkB,GAAA,EAAA,CAAG,mBAAoB,CAAA,OAAA,EAAS,GAAG,iBAAiB,CAAA,CAAA;AAE5E,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,eAAA,EAAiB,CACrC,EAAA,EAAA;AACI,IAAA,MAAM,UAAa,GAAA,EAAA,CAAG,eAAgB,CAAA,OAAA,EAAS,CAAC,CAAA,CAAA;AAEhD,IAAA,IAAI,UAAW,CAAA,IAAA,CAAK,UAAW,CAAA,KAAK,CACpC,EAAA;AACI,MAAA,SAAA;AAAA,KACJ;AAEA,IAAA,MAAM,IAAO,GAAAA,eAAA,CAAQ,EAAI,EAAA,UAAA,CAAW,IAAI,CAAA,CAAA;AACxC,IAAA,MAAM,IAAO,GAAA;AAAA,MACT,IAAA;AAAA,MACA,MAAM,UAAW,CAAA,IAAA;AAAA,MACjB,IAAA,EAAMC,gBAAQ,IAAI,CAAA;AAAA,MAClB,QAAU,EAAA,EAAA,CAAG,iBAAkB,CAAA,OAAA,EAAS,WAAW,IAAI,CAAA;AAAA,KAC3D,CAAA;AAEA,IAAA,UAAA,CAAW,WAAW,IAAQ,CAAA,GAAA,IAAA,CAAA;AAAA,GAClC;AAEA,EAAO,OAAA,UAAA,CAAA;AACX;;;;"} |