UNPKG

pixi.js

Version:

PixiJS — The HTML5 Creation Engine =============

1 lines 2.11 kB
{"version":3,"file":"types.mjs","sources":["../../../../../src/rendering/renderers/shared/shader/types.ts"],"sourcesContent":["// TODO add more types as required\nexport const UNIFORM_TYPES_VALUES = [\n 'f32',\n 'i32',\n 'vec2<f32>',\n 'vec3<f32>',\n 'vec4<f32>',\n 'mat2x2<f32>',\n 'mat3x3<f32>',\n 'mat4x4<f32>',\n 'mat3x2<f32>',\n 'mat4x2<f32>',\n 'mat2x3<f32>',\n 'mat4x3<f32>',\n 'mat2x4<f32>',\n 'mat3x4<f32>'\n] as const;\n\n/** useful for checking if a type is supported - a map of supported types with a true value. */\nexport const UNIFORM_TYPES_MAP = UNIFORM_TYPES_VALUES.reduce((acc, type) =>\n{\n acc[type] = true;\n\n return acc;\n}, {} as Record<UNIFORM_TYPES, boolean>);\n\nexport type UNIFORM_TYPES_SINGLE = typeof UNIFORM_TYPES_VALUES[number];\n\ntype OPTIONAL_SPACE = ' ' | '';\n\nexport type UNIFORM_TYPES_ARRAY = `array<${UNIFORM_TYPES_SINGLE},${OPTIONAL_SPACE}${number}>`;\n\nexport type UNIFORM_TYPES = UNIFORM_TYPES_SINGLE | UNIFORM_TYPES_ARRAY;\n\nexport interface UniformData\n{\n /** the value of the uniform, this could be any object - a parser will figure out how to write it to the buffer */\n value: unknown;\n type: UNIFORM_TYPES;\n /** the size of the variable (eg 2 for vec2, 3 for vec3, 4 for vec4) */\n size?: number;\n name?: string;\n}\n\nexport interface UboElement\n{\n data: UniformData;\n offset: number;\n size: number;\n}\n\nexport interface UboLayout\n{\n uboElements: UboElement[];\n /** float32 size // TODO change to bytes */\n size: number;\n}\n\n/* eslint-disable quote-props */\nexport type UniformsSyncCallback = (...args: any[]) => void;\n"],"names":[],"mappings":";AACO,MAAM,oBAAuB,GAAA;AAAA,EAChC,KAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AACJ,EAAA;AAGO,MAAM,iBAAoB,GAAA,oBAAA,CAAqB,MAAO,CAAA,CAAC,KAAK,IACnE,KAAA;AACI,EAAA,GAAA,CAAI,IAAI,CAAI,GAAA,IAAA,CAAA;AAEZ,EAAO,OAAA,GAAA,CAAA;AACX,CAAA,EAAG,EAAoC;;;;"}