UNPKG

4.26 kBSource Map (JSON)View Raw
1{"version":3,"file":"defaultValue.js","sources":["../../../src/shader/utils/defaultValue.ts"],"sourcesContent":["function booleanArray(size: number): Array<boolean>\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n"],"names":[],"mappings":";;;;AAAA,SAAA,YAAA,CAAsB,IACtB,EAAA;AACI,EAAM,MAAA,KAAA,GAAQ,IAAI,KAAA,CAAM,IAAI,CAAA,CAAA;AAE5B,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,C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