@babylonjs/loaders 6.9.0 → 6.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/OBJ/index.js.map +1 -1
  2. package/OBJ/mtlFileLoader.js.map +1 -1
  3. package/OBJ/objFileLoader.js.map +1 -1
  4. package/OBJ/objLoadingOptions.js.map +1 -1
  5. package/OBJ/solidParser.js.map +1 -1
  6. package/STL/index.js.map +1 -1
  7. package/STL/stlFileLoader.js.map +1 -1
  8. package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
  9. package/glTF/1.0/glTFLoader.js.map +1 -1
  10. package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
  11. package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
  12. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
  13. package/glTF/1.0/index.js.map +1 -1
  14. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
  15. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  16. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
  17. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
  18. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
  19. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
  20. package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
  21. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  22. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  23. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
  24. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  25. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  26. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  27. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  28. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  29. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  30. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  31. package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
  32. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  33. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  34. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  35. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  36. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
  37. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  38. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  39. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  40. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  41. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  42. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
  43. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
  44. package/glTF/2.0/Extensions/index.js.map +1 -1
  45. package/glTF/2.0/glTFLoader.js +2 -2
  46. package/glTF/2.0/glTFLoader.js.map +1 -1
  47. package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
  48. package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
  49. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
  50. package/glTF/2.0/index.js.map +1 -1
  51. package/glTF/glTFFileLoader.js.map +1 -1
  52. package/glTF/glTFValidation.js.map +1 -1
  53. package/glTF/index.js.map +1 -1
  54. package/index.js.map +1 -1
  55. package/legacy/legacy-glTF.d.ts +2 -2
  56. package/legacy/legacy-glTF.js.map +1 -1
  57. package/legacy/legacy-glTF1.d.ts +1 -1
  58. package/legacy/legacy-glTF1.js.map +1 -1
  59. package/legacy/legacy-glTF1FileLoader.js.map +1 -1
  60. package/legacy/legacy-glTF2.d.ts +1 -1
  61. package/legacy/legacy-glTF2.js.map +1 -1
  62. package/legacy/legacy-glTF2FileLoader.js.map +1 -1
  63. package/legacy/legacy-glTFFileLoader.js.map +1 -1
  64. package/legacy/legacy-objFileLoader.d.ts +1 -1
  65. package/legacy/legacy-objFileLoader.js.map +1 -1
  66. package/legacy/legacy-stlFileLoader.d.ts +1 -1
  67. package/legacy/legacy-stlFileLoader.js.map +1 -1
  68. package/legacy/legacy.d.ts +1 -1
  69. package/legacy/legacy.js.map +1 -1
  70. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"glTFLoaderInterfaces.js","sourceRoot":"","sources":["../../../../../lts/loaders/generated/glTF/1.0/glTFLoaderInterfaces.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACtB,sDAAW,CAAA;IACX,wEAAoB,CAAA;IACpB,wDAAY,CAAA;IACZ,0EAAqB,CAAA;IACrB,wDAAY,CAAA;AAChB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,yDAAgB,CAAA;IAChB,qDAAc,CAAA;AAClB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAsBX;AAtBD,WAAY,cAAc;IACtB,sDAAW,CAAA;IACX,wEAAoB,CAAA;IACpB,wDAAY,CAAA;IACZ,0EAAqB,CAAA;IACrB,oDAAU,CAAA;IACV,sEAAmB,CAAA;IACnB,wDAAY,CAAA;IACZ,mEAAkB,CAAA;IAClB,mEAAkB,CAAA;IAClB,mEAAkB,CAAA;IAClB,+DAAgB,CAAA;IAChB,+DAAgB,CAAA;IAChB,+DAAgB,CAAA;IAChB,uDAAY,CAAA;IACZ,iEAAiB,CAAA;IACjB,iEAAiB,CAAA;IACjB,iEAAiB,CAAA;IACjB,mEAAkB,CAAA;IAClB,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CAAA;AAC5B,CAAC,EAhBW,iBAAiB,KAAjB,iBAAiB,QAgB5B","sourcesContent":["import type { AssetContainer } from \"core/assetContainer\";\r\nimport type { Bone } from \"core/Bones/bone\";\r\nimport type { Skeleton } from \"core/Bones/skeleton\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Enums\r\n * @internal\r\n */\r\nexport enum EComponentType {\r\n BYTE = 5120,\r\n UNSIGNED_BYTE = 5121,\r\n SHORT = 5122,\r\n UNSIGNED_SHORT = 5123,\r\n FLOAT = 5126,\r\n}\r\n\r\n/** @internal */\r\nexport enum EShaderType {\r\n FRAGMENT = 35632,\r\n VERTEX = 35633,\r\n}\r\n\r\n/** @internal */\r\nexport enum EParameterType {\r\n BYTE = 5120,\r\n UNSIGNED_BYTE = 5121,\r\n SHORT = 5122,\r\n UNSIGNED_SHORT = 5123,\r\n INT = 5124,\r\n UNSIGNED_INT = 5125,\r\n FLOAT = 5126,\r\n FLOAT_VEC2 = 35664,\r\n FLOAT_VEC3 = 35665,\r\n FLOAT_VEC4 = 35666,\r\n INT_VEC2 = 35667,\r\n INT_VEC3 = 35668,\r\n INT_VEC4 = 35669,\r\n BOOL = 35670,\r\n BOOL_VEC2 = 35671,\r\n BOOL_VEC3 = 35672,\r\n BOOL_VEC4 = 35673,\r\n FLOAT_MAT2 = 35674,\r\n FLOAT_MAT3 = 35675,\r\n FLOAT_MAT4 = 35676,\r\n SAMPLER_2D = 35678,\r\n}\r\n\r\n/** @internal */\r\nexport enum ETextureWrapMode {\r\n CLAMP_TO_EDGE = 33071,\r\n MIRRORED_REPEAT = 33648,\r\n REPEAT = 10497,\r\n}\r\n\r\n/** @internal */\r\nexport enum ETextureFilterType {\r\n NEAREST = 9728,\r\n LINEAR = 9728,\r\n NEAREST_MIPMAP_NEAREST = 9984,\r\n LINEAR_MIPMAP_NEAREST = 9985,\r\n NEAREST_MIPMAP_LINEAR = 9986,\r\n LINEAR_MIPMAP_LINEAR = 9987,\r\n}\r\n\r\n/** @internal */\r\nexport enum ETextureFormat {\r\n ALPHA = 6406,\r\n RGB = 6407,\r\n RGBA = 6408,\r\n LUMINANCE = 6409,\r\n LUMINANCE_ALPHA = 6410,\r\n}\r\n\r\n/** @internal */\r\nexport enum ECullingType {\r\n FRONT = 1028,\r\n BACK = 1029,\r\n FRONT_AND_BACK = 1032,\r\n}\r\n\r\n/** @internal */\r\nexport enum EBlendingFunction {\r\n ZERO = 0,\r\n ONE = 1,\r\n SRC_COLOR = 768,\r\n ONE_MINUS_SRC_COLOR = 769,\r\n DST_COLOR = 774,\r\n ONE_MINUS_DST_COLOR = 775,\r\n SRC_ALPHA = 770,\r\n ONE_MINUS_SRC_ALPHA = 771,\r\n DST_ALPHA = 772,\r\n ONE_MINUS_DST_ALPHA = 773,\r\n CONSTANT_COLOR = 32769,\r\n ONE_MINUS_CONSTANT_COLOR = 32770,\r\n CONSTANT_ALPHA = 32771,\r\n ONE_MINUS_CONSTANT_ALPHA = 32772,\r\n SRC_ALPHA_SATURATE = 776,\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFProperty {\r\n extensions?: { [key: string]: any };\r\n extras?: Object;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFChildRootProperty extends IGLTFProperty {\r\n name?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAccessor extends IGLTFChildRootProperty {\r\n bufferView: string;\r\n byteOffset: number;\r\n byteStride: number;\r\n count: number;\r\n type: string;\r\n componentType: EComponentType;\r\n\r\n max?: number[];\r\n min?: number[];\r\n name?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFBufferView extends IGLTFChildRootProperty {\r\n buffer: string;\r\n byteOffset: number;\r\n byteLength: number;\r\n byteStride: number;\r\n\r\n target?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFBuffer extends IGLTFChildRootProperty {\r\n uri: string;\r\n\r\n byteLength?: number;\r\n type?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFShader extends IGLTFChildRootProperty {\r\n uri: string;\r\n type: EShaderType;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFProgram extends IGLTFChildRootProperty {\r\n attributes: string[];\r\n fragmentShader: string;\r\n vertexShader: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueParameter {\r\n type: number;\r\n\r\n count?: number;\r\n semantic?: string;\r\n node?: string;\r\n value?: number | boolean | string | Array<any>;\r\n source?: string;\r\n\r\n babylonValue?: any;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueCommonProfile {\r\n lightingModel: string;\r\n texcoordBindings: Object;\r\n\r\n parameters?: Array<any>;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueStatesFunctions {\r\n blendColor?: number[];\r\n blendEquationSeparate?: number[];\r\n blendFuncSeparate?: number[];\r\n colorMask: boolean[];\r\n cullFace: number[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueStates {\r\n enable: number[];\r\n functions: IGLTFTechniqueStatesFunctions;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechnique extends IGLTFChildRootProperty {\r\n parameters: { [key: string]: IGLTFTechniqueParameter };\r\n program: string;\r\n\r\n attributes: { [key: string]: string };\r\n uniforms: { [key: string]: string };\r\n states: IGLTFTechniqueStates;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFMaterial extends IGLTFChildRootProperty {\r\n technique?: string;\r\n values: string[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFMeshPrimitive extends IGLTFProperty {\r\n attributes: { [key: string]: string };\r\n indices: string;\r\n material: string;\r\n\r\n mode?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFMesh extends IGLTFChildRootProperty {\r\n primitives: IGLTFMeshPrimitive[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFImage extends IGLTFChildRootProperty {\r\n uri: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFSampler extends IGLTFChildRootProperty {\r\n magFilter?: number;\r\n minFilter?: number;\r\n wrapS?: number;\r\n wrapT?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTexture extends IGLTFChildRootProperty {\r\n sampler: string;\r\n source: string;\r\n\r\n format?: ETextureFormat;\r\n internalFormat?: ETextureFormat;\r\n target?: number;\r\n type?: number;\r\n\r\n // Babylon.js values (optimize)\r\n babylonTexture?: Texture;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAmbienLight {\r\n color?: number[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFDirectionalLight {\r\n color?: number[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFPointLight {\r\n color?: number[];\r\n constantAttenuation?: number;\r\n linearAttenuation?: number;\r\n quadraticAttenuation?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFSpotLight {\r\n color?: number[];\r\n constantAttenuation?: number;\r\n fallOfAngle?: number;\r\n fallOffExponent?: number;\r\n linearAttenuation?: number;\r\n quadraticAttenuation?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFLight extends IGLTFChildRootProperty {\r\n type: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFCameraOrthographic {\r\n xmag: number;\r\n ymag: number;\r\n zfar: number;\r\n znear: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFCameraPerspective {\r\n aspectRatio: number;\r\n yfov: number;\r\n zfar: number;\r\n znear: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFCamera extends IGLTFChildRootProperty {\r\n type: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimationChannelTarget {\r\n id: string;\r\n path: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimationChannel {\r\n sampler: string;\r\n target: IGLTFAnimationChannelTarget;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimationSampler {\r\n input: string;\r\n output: string;\r\n\r\n interpolation?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimation extends IGLTFChildRootProperty {\r\n channels?: IGLTFAnimationChannel[];\r\n parameters?: { [key: string]: string };\r\n samplers?: { [key: string]: IGLTFAnimationSampler };\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFNodeInstanceSkin {\r\n skeletons: string[];\r\n skin: string;\r\n meshes: string[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFSkins extends IGLTFChildRootProperty {\r\n bindShapeMatrix: number[];\r\n inverseBindMatrices: string;\r\n jointNames: string[];\r\n\r\n babylonSkeleton?: Skeleton;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFNode extends IGLTFChildRootProperty {\r\n camera?: string;\r\n children: string[];\r\n skin?: string;\r\n jointName?: string;\r\n light?: string;\r\n matrix: number[];\r\n mesh?: string;\r\n meshes?: string[];\r\n rotation?: number[];\r\n scale?: number[];\r\n translation?: number[];\r\n\r\n // Babylon.js values (optimize)\r\n babylonNode?: Node;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFScene extends IGLTFChildRootProperty {\r\n nodes: string[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFRuntime {\r\n extensions: { [key: string]: any };\r\n accessors: { [key: string]: IGLTFAccessor };\r\n buffers: { [key: string]: IGLTFBuffer };\r\n bufferViews: { [key: string]: IGLTFBufferView };\r\n meshes: { [key: string]: IGLTFMesh };\r\n lights: { [key: string]: IGLTFLight };\r\n cameras: { [key: string]: IGLTFCamera };\r\n nodes: { [key: string]: IGLTFNode };\r\n images: { [key: string]: IGLTFImage };\r\n textures: { [key: string]: IGLTFTexture };\r\n shaders: { [key: string]: IGLTFShader };\r\n programs: { [key: string]: IGLTFProgram };\r\n samplers: { [key: string]: IGLTFSampler };\r\n techniques: { [key: string]: IGLTFTechnique };\r\n materials: { [key: string]: IGLTFMaterial };\r\n animations: { [key: string]: IGLTFAnimation };\r\n skins: { [key: string]: IGLTFSkins };\r\n\r\n currentScene?: Object;\r\n scenes: { [key: string]: IGLTFScene }; // v1.1\r\n\r\n extensionsUsed: string[];\r\n extensionsRequired?: string[]; // v1.1\r\n\r\n buffersCount: number;\r\n shaderscount: number;\r\n\r\n scene: Scene;\r\n rootUrl: string;\r\n\r\n loadedBufferCount: number;\r\n loadedBufferViews: { [name: string]: ArrayBufferView };\r\n\r\n loadedShaderCount: number;\r\n\r\n importOnlyMeshes: boolean;\r\n importMeshesNames?: string[];\r\n\r\n dummyNodes: Node[];\r\n\r\n assetContainer: Nullable<AssetContainer>;\r\n}\r\n\r\n/** @internal */\r\nexport interface INodeToRoot {\r\n bone: Bone;\r\n node: IGLTFNode;\r\n id: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IJointNode {\r\n node: IGLTFNode;\r\n id: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"glTFLoaderInterfaces.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/glTFLoaderInterfaces.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACtB,sDAAW,CAAA;IACX,wEAAoB,CAAA;IACpB,wDAAY,CAAA;IACZ,0EAAqB,CAAA;IACrB,wDAAY,CAAA;AAChB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,yDAAgB,CAAA;IAChB,qDAAc,CAAA;AAClB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAsBX;AAtBD,WAAY,cAAc;IACtB,sDAAW,CAAA;IACX,wEAAoB,CAAA;IACpB,wDAAY,CAAA;IACZ,0EAAqB,CAAA;IACrB,oDAAU,CAAA;IACV,sEAAmB,CAAA;IACnB,wDAAY,CAAA;IACZ,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AAyB,CAAA;IACzB,qEAAe,CAAA;IACf,yFAAyB,CAAA;IACzB,qEAAe,CAAA;IACf,yFAAyB,CAAA;IACzB,qEAAe,CAAA;IACf,yFAAyB,CAAA;IACzB,iFAAsB,CAAA;IACtB,qGAAgC,CAAA;IAChC,iFAAsB,CAAA;IACtB,qGAAgC,CAAA;IAChC,uFAAwB,CAAA;AAC5B,CAAC,EAhBW,iBAAiB,KAAjB,iBAAiB,QAgB5B","sourcesContent":["import type { AssetContainer } from \"core/assetContainer\";\r\nimport type { Bone } from \"core/Bones/bone\";\r\nimport type { Skeleton } from \"core/Bones/skeleton\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Enums\r\n * @internal\r\n */\r\nexport enum EComponentType {\r\n BYTE = 5120,\r\n UNSIGNED_BYTE = 5121,\r\n SHORT = 5122,\r\n UNSIGNED_SHORT = 5123,\r\n FLOAT = 5126,\r\n}\r\n\r\n/** @internal */\r\nexport enum EShaderType {\r\n FRAGMENT = 35632,\r\n VERTEX = 35633,\r\n}\r\n\r\n/** @internal */\r\nexport enum EParameterType {\r\n BYTE = 5120,\r\n UNSIGNED_BYTE = 5121,\r\n SHORT = 5122,\r\n UNSIGNED_SHORT = 5123,\r\n INT = 5124,\r\n UNSIGNED_INT = 5125,\r\n FLOAT = 5126,\r\n FLOAT_VEC2 = 35664,\r\n FLOAT_VEC3 = 35665,\r\n FLOAT_VEC4 = 35666,\r\n INT_VEC2 = 35667,\r\n INT_VEC3 = 35668,\r\n INT_VEC4 = 35669,\r\n BOOL = 35670,\r\n BOOL_VEC2 = 35671,\r\n BOOL_VEC3 = 35672,\r\n BOOL_VEC4 = 35673,\r\n FLOAT_MAT2 = 35674,\r\n FLOAT_MAT3 = 35675,\r\n FLOAT_MAT4 = 35676,\r\n SAMPLER_2D = 35678,\r\n}\r\n\r\n/** @internal */\r\nexport enum ETextureWrapMode {\r\n CLAMP_TO_EDGE = 33071,\r\n MIRRORED_REPEAT = 33648,\r\n REPEAT = 10497,\r\n}\r\n\r\n/** @internal */\r\nexport enum ETextureFilterType {\r\n NEAREST = 9728,\r\n LINEAR = 9728,\r\n NEAREST_MIPMAP_NEAREST = 9984,\r\n LINEAR_MIPMAP_NEAREST = 9985,\r\n NEAREST_MIPMAP_LINEAR = 9986,\r\n LINEAR_MIPMAP_LINEAR = 9987,\r\n}\r\n\r\n/** @internal */\r\nexport enum ETextureFormat {\r\n ALPHA = 6406,\r\n RGB = 6407,\r\n RGBA = 6408,\r\n LUMINANCE = 6409,\r\n LUMINANCE_ALPHA = 6410,\r\n}\r\n\r\n/** @internal */\r\nexport enum ECullingType {\r\n FRONT = 1028,\r\n BACK = 1029,\r\n FRONT_AND_BACK = 1032,\r\n}\r\n\r\n/** @internal */\r\nexport enum EBlendingFunction {\r\n ZERO = 0,\r\n ONE = 1,\r\n SRC_COLOR = 768,\r\n ONE_MINUS_SRC_COLOR = 769,\r\n DST_COLOR = 774,\r\n ONE_MINUS_DST_COLOR = 775,\r\n SRC_ALPHA = 770,\r\n ONE_MINUS_SRC_ALPHA = 771,\r\n DST_ALPHA = 772,\r\n ONE_MINUS_DST_ALPHA = 773,\r\n CONSTANT_COLOR = 32769,\r\n ONE_MINUS_CONSTANT_COLOR = 32770,\r\n CONSTANT_ALPHA = 32771,\r\n ONE_MINUS_CONSTANT_ALPHA = 32772,\r\n SRC_ALPHA_SATURATE = 776,\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFProperty {\r\n extensions?: { [key: string]: any };\r\n extras?: Object;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFChildRootProperty extends IGLTFProperty {\r\n name?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAccessor extends IGLTFChildRootProperty {\r\n bufferView: string;\r\n byteOffset: number;\r\n byteStride: number;\r\n count: number;\r\n type: string;\r\n componentType: EComponentType;\r\n\r\n max?: number[];\r\n min?: number[];\r\n name?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFBufferView extends IGLTFChildRootProperty {\r\n buffer: string;\r\n byteOffset: number;\r\n byteLength: number;\r\n byteStride: number;\r\n\r\n target?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFBuffer extends IGLTFChildRootProperty {\r\n uri: string;\r\n\r\n byteLength?: number;\r\n type?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFShader extends IGLTFChildRootProperty {\r\n uri: string;\r\n type: EShaderType;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFProgram extends IGLTFChildRootProperty {\r\n attributes: string[];\r\n fragmentShader: string;\r\n vertexShader: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueParameter {\r\n type: number;\r\n\r\n count?: number;\r\n semantic?: string;\r\n node?: string;\r\n value?: number | boolean | string | Array<any>;\r\n source?: string;\r\n\r\n babylonValue?: any;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueCommonProfile {\r\n lightingModel: string;\r\n texcoordBindings: Object;\r\n\r\n parameters?: Array<any>;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueStatesFunctions {\r\n blendColor?: number[];\r\n blendEquationSeparate?: number[];\r\n blendFuncSeparate?: number[];\r\n colorMask: boolean[];\r\n cullFace: number[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechniqueStates {\r\n enable: number[];\r\n functions: IGLTFTechniqueStatesFunctions;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTechnique extends IGLTFChildRootProperty {\r\n parameters: { [key: string]: IGLTFTechniqueParameter };\r\n program: string;\r\n\r\n attributes: { [key: string]: string };\r\n uniforms: { [key: string]: string };\r\n states: IGLTFTechniqueStates;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFMaterial extends IGLTFChildRootProperty {\r\n technique?: string;\r\n values: string[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFMeshPrimitive extends IGLTFProperty {\r\n attributes: { [key: string]: string };\r\n indices: string;\r\n material: string;\r\n\r\n mode?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFMesh extends IGLTFChildRootProperty {\r\n primitives: IGLTFMeshPrimitive[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFImage extends IGLTFChildRootProperty {\r\n uri: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFSampler extends IGLTFChildRootProperty {\r\n magFilter?: number;\r\n minFilter?: number;\r\n wrapS?: number;\r\n wrapT?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFTexture extends IGLTFChildRootProperty {\r\n sampler: string;\r\n source: string;\r\n\r\n format?: ETextureFormat;\r\n internalFormat?: ETextureFormat;\r\n target?: number;\r\n type?: number;\r\n\r\n // Babylon.js values (optimize)\r\n babylonTexture?: Texture;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAmbienLight {\r\n color?: number[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFDirectionalLight {\r\n color?: number[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFPointLight {\r\n color?: number[];\r\n constantAttenuation?: number;\r\n linearAttenuation?: number;\r\n quadraticAttenuation?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFSpotLight {\r\n color?: number[];\r\n constantAttenuation?: number;\r\n fallOfAngle?: number;\r\n fallOffExponent?: number;\r\n linearAttenuation?: number;\r\n quadraticAttenuation?: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFLight extends IGLTFChildRootProperty {\r\n type: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFCameraOrthographic {\r\n xmag: number;\r\n ymag: number;\r\n zfar: number;\r\n znear: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFCameraPerspective {\r\n aspectRatio: number;\r\n yfov: number;\r\n zfar: number;\r\n znear: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFCamera extends IGLTFChildRootProperty {\r\n type: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimationChannelTarget {\r\n id: string;\r\n path: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimationChannel {\r\n sampler: string;\r\n target: IGLTFAnimationChannelTarget;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimationSampler {\r\n input: string;\r\n output: string;\r\n\r\n interpolation?: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFAnimation extends IGLTFChildRootProperty {\r\n channels?: IGLTFAnimationChannel[];\r\n parameters?: { [key: string]: string };\r\n samplers?: { [key: string]: IGLTFAnimationSampler };\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFNodeInstanceSkin {\r\n skeletons: string[];\r\n skin: string;\r\n meshes: string[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFSkins extends IGLTFChildRootProperty {\r\n bindShapeMatrix: number[];\r\n inverseBindMatrices: string;\r\n jointNames: string[];\r\n\r\n babylonSkeleton?: Skeleton;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFNode extends IGLTFChildRootProperty {\r\n camera?: string;\r\n children: string[];\r\n skin?: string;\r\n jointName?: string;\r\n light?: string;\r\n matrix: number[];\r\n mesh?: string;\r\n meshes?: string[];\r\n rotation?: number[];\r\n scale?: number[];\r\n translation?: number[];\r\n\r\n // Babylon.js values (optimize)\r\n babylonNode?: Node;\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFScene extends IGLTFChildRootProperty {\r\n nodes: string[];\r\n}\r\n\r\n/** @internal */\r\nexport interface IGLTFRuntime {\r\n extensions: { [key: string]: any };\r\n accessors: { [key: string]: IGLTFAccessor };\r\n buffers: { [key: string]: IGLTFBuffer };\r\n bufferViews: { [key: string]: IGLTFBufferView };\r\n meshes: { [key: string]: IGLTFMesh };\r\n lights: { [key: string]: IGLTFLight };\r\n cameras: { [key: string]: IGLTFCamera };\r\n nodes: { [key: string]: IGLTFNode };\r\n images: { [key: string]: IGLTFImage };\r\n textures: { [key: string]: IGLTFTexture };\r\n shaders: { [key: string]: IGLTFShader };\r\n programs: { [key: string]: IGLTFProgram };\r\n samplers: { [key: string]: IGLTFSampler };\r\n techniques: { [key: string]: IGLTFTechnique };\r\n materials: { [key: string]: IGLTFMaterial };\r\n animations: { [key: string]: IGLTFAnimation };\r\n skins: { [key: string]: IGLTFSkins };\r\n\r\n currentScene?: Object;\r\n scenes: { [key: string]: IGLTFScene }; // v1.1\r\n\r\n extensionsUsed: string[];\r\n extensionsRequired?: string[]; // v1.1\r\n\r\n buffersCount: number;\r\n shaderscount: number;\r\n\r\n scene: Scene;\r\n rootUrl: string;\r\n\r\n loadedBufferCount: number;\r\n loadedBufferViews: { [name: string]: ArrayBufferView };\r\n\r\n loadedShaderCount: number;\r\n\r\n importOnlyMeshes: boolean;\r\n importMeshesNames?: string[];\r\n\r\n dummyNodes: Node[];\r\n\r\n assetContainer: Nullable<AssetContainer>;\r\n}\r\n\r\n/** @internal */\r\nexport interface INodeToRoot {\r\n bone: Bone;\r\n node: IGLTFNode;\r\n id: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface IJointNode {\r\n node: IGLTFNode;\r\n id: string;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"glTFLoaderUtils.js","sourceRoot":"","sources":["../../../../../lts/loaders/generated/glTF/1.0/glTFLoaderUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG9G,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAC3E,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,cAAc,EAAE,oDAAsC;AAC/D,OAAO,EAAE,OAAO,EAAE,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iC,CAAC,GAAG;gBACrD,wBAAwB;gBACxB,EAAE;gBACF,yBAAyB;gBACzB,0BAA0B;gBAC1B,EAAE;gBACF,0BAA0B;gBAC1B,EAAE;gBACF,iBAAiB;gBACjB,GAAG;gBACH,iEAAiE;gBACjE,GAAG;aACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEb,MAAM,CAAC,YAAY,CAAC,gCAAgC,CAAC,GAAG;gBACpD,wBAAwB;gBACxB,EAAE;gBACF,0BAA0B;gBAC1B,EAAE;gBACF,iBAAiB;gBACjB,GAAG;gBACH,gCAAgC;gBAChC,GAAG;aACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEb,MAAM,UAAU,GAAG;gBACf,MAAM,EAAE,qBAAqB;gBAC7B,QAAQ,EAAE,qBAAqB;aAClC,CAAC;YAEF,MAAM,OAAO,GAAG;gBACZ,UAAU,EAAE,CAAC,UAAU,CAAC;gBACxB,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;gBACnD,QAAQ,EAAE,IAAI,KAAK,EAAU;gBAC7B,iBAAiB,EAAE,KAAK;aAC3B,CAAC;YAEF,SAAS,CAAC,gBAAgB,GAAG,IAAI,cAAc,CAAC,qBAAqB,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YACnG,SAAS,CAAC,gBAAgB,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;SACtF;QAED,OAAO,SAAS,CAAC,gBAAgB,CAAC;IACtC,CAAC;;AAED,4BAA4B;AACb,0BAAgB,GAA6B,IAAI,CAAC","sourcesContent":["import type { IGLTFTechniqueParameter, IGLTFAccessor, IGLTFRuntime, IGLTFBufferView } from \"./glTFLoaderInterfaces\";\r\nimport { EParameterType, ETextureWrapMode, ETextureFilterType, EComponentType } from \"./glTFLoaderInterfaces\";\r\n\r\nimport type { Nullable } from \"core/types\";\r\nimport { Vector2, Vector3, Vector4, Matrix } from \"core/Maths/math.vector\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\n/**\r\n * Utils functions for GLTF\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class GLTFUtils {\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param scene the Scene object\r\n * @param source the source node where to pick the matrix\r\n * @param parameter the GLTF technique parameter\r\n * @param uniformName the name of the shader's uniform\r\n * @param shaderMaterial the shader material\r\n */\r\n public static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void {\r\n let mat: Nullable<Matrix> = null;\r\n\r\n if (parameter.semantic === \"MODEL\") {\r\n mat = source.getWorldMatrix();\r\n } else if (parameter.semantic === \"PROJECTION\") {\r\n mat = scene.getProjectionMatrix();\r\n } else if (parameter.semantic === \"VIEW\") {\r\n mat = scene.getViewMatrix();\r\n } else if (parameter.semantic === \"MODELVIEWINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().multiply(scene.getViewMatrix()).invert());\r\n } else if (parameter.semantic === \"MODELVIEW\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix());\r\n } else if (parameter.semantic === \"MODELVIEWPROJECTION\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix());\r\n } else if (parameter.semantic === \"MODELINVERSE\") {\r\n mat = source.getWorldMatrix().invert();\r\n } else if (parameter.semantic === \"VIEWINVERSE\") {\r\n mat = scene.getViewMatrix().invert();\r\n } else if (parameter.semantic === \"PROJECTIONINVERSE\") {\r\n mat = scene.getProjectionMatrix().invert();\r\n } else if (parameter.semantic === \"MODELVIEWINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix()).invert();\r\n } else if (parameter.semantic === \"MODELVIEWPROJECTIONINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix()).invert();\r\n } else if (parameter.semantic === \"MODELINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().invert());\r\n }\r\n\r\n if (mat) {\r\n switch (parameter.type) {\r\n case EParameterType.FLOAT_MAT2:\r\n shaderMaterial.setMatrix2x2(uniformName, Matrix.GetAsMatrix2x2(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT3:\r\n shaderMaterial.setMatrix3x3(uniformName, Matrix.GetAsMatrix3x3(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT4:\r\n shaderMaterial.setMatrix(uniformName, mat);\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param shaderMaterial the shader material\r\n * @param uniform the name of the shader's uniform\r\n * @param value the value of the uniform\r\n * @param type the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)\r\n */\r\n public static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean {\r\n switch (type) {\r\n case EParameterType.FLOAT:\r\n shaderMaterial.setFloat(uniform, value);\r\n return true;\r\n case EParameterType.FLOAT_VEC2:\r\n shaderMaterial.setVector2(uniform, Vector2.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC3:\r\n shaderMaterial.setVector3(uniform, Vector3.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC4:\r\n shaderMaterial.setVector4(uniform, Vector4.FromArray(value));\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the wrap mode of the texture\r\n * @param mode the mode value\r\n */\r\n public static GetWrapMode(mode: number): number {\r\n switch (mode) {\r\n case ETextureWrapMode.CLAMP_TO_EDGE:\r\n return Texture.CLAMP_ADDRESSMODE;\r\n case ETextureWrapMode.MIRRORED_REPEAT:\r\n return Texture.MIRROR_ADDRESSMODE;\r\n case ETextureWrapMode.REPEAT:\r\n return Texture.WRAP_ADDRESSMODE;\r\n default:\r\n return Texture.WRAP_ADDRESSMODE;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the byte stride giving an accessor\r\n * @param accessor the GLTF accessor objet\r\n */\r\n public static GetByteStrideFromType(accessor: IGLTFAccessor): number {\r\n // Needs this function since \"byteStride\" isn't requiered in glTF format\r\n const type = accessor.type;\r\n\r\n switch (type) {\r\n case \"VEC2\":\r\n return 2;\r\n case \"VEC3\":\r\n return 3;\r\n case \"VEC4\":\r\n return 4;\r\n case \"MAT2\":\r\n return 4;\r\n case \"MAT3\":\r\n return 9;\r\n case \"MAT4\":\r\n return 16;\r\n default:\r\n return 1;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the texture filter mode giving a mode value\r\n * @param mode the filter mode value\r\n * @returns the filter mode (TODO - needs to be a type?)\r\n */\r\n public static GetTextureFilterMode(mode: number): number {\r\n switch (mode) {\r\n case ETextureFilterType.LINEAR:\r\n case ETextureFilterType.LINEAR_MIPMAP_NEAREST:\r\n case ETextureFilterType.LINEAR_MIPMAP_LINEAR:\r\n return Texture.TRILINEAR_SAMPLINGMODE;\r\n case ETextureFilterType.NEAREST:\r\n case ETextureFilterType.NEAREST_MIPMAP_NEAREST:\r\n return Texture.NEAREST_SAMPLINGMODE;\r\n default:\r\n return Texture.BILINEAR_SAMPLINGMODE;\r\n }\r\n }\r\n\r\n public static GetBufferFromBufferView(\r\n gltfRuntime: IGLTFRuntime,\r\n bufferView: IGLTFBufferView,\r\n byteOffset: number,\r\n byteLength: number,\r\n componentType: EComponentType\r\n ): ArrayBufferView {\r\n byteOffset = bufferView.byteOffset + byteOffset;\r\n\r\n const loadedBufferView = gltfRuntime.loadedBufferViews[bufferView.buffer];\r\n if (byteOffset + byteLength > loadedBufferView.byteLength) {\r\n throw new Error(\"Buffer access is out of range\");\r\n }\r\n\r\n const buffer = loadedBufferView.buffer;\r\n byteOffset += loadedBufferView.byteOffset;\r\n\r\n switch (componentType) {\r\n case EComponentType.BYTE:\r\n return new Int8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_BYTE:\r\n return new Uint8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.SHORT:\r\n return new Int16Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_SHORT:\r\n return new Uint16Array(buffer, byteOffset, byteLength);\r\n default:\r\n return new Float32Array(buffer, byteOffset, byteLength);\r\n }\r\n }\r\n\r\n /**\r\n * Returns a buffer from its accessor\r\n * @param gltfRuntime the GLTF runtime\r\n * @param accessor the GLTF accessor\r\n */\r\n public static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any {\r\n const bufferView: IGLTFBufferView = gltfRuntime.bufferViews[accessor.bufferView];\r\n const byteLength = accessor.count * GLTFUtils.GetByteStrideFromType(accessor);\r\n return GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, accessor.byteOffset, byteLength, accessor.componentType);\r\n }\r\n\r\n /**\r\n * Decodes a buffer view into a string\r\n * @param view the buffer view\r\n */\r\n public static DecodeBufferToText(view: ArrayBufferView): string {\r\n let result = \"\";\r\n const length = view.byteLength;\r\n\r\n for (let i = 0; i < length; ++i) {\r\n result += String.fromCharCode((<any>view)[i]);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Returns the default material of gltf. Related to\r\n * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material\r\n * @param scene the Babylon.js scene\r\n */\r\n public static GetDefaultMaterial(scene: Scene): ShaderMaterial {\r\n if (!GLTFUtils._DefaultMaterial) {\r\n Effect.ShadersStore[\"GLTFDefaultMaterialVertexShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform mat4 worldView;\",\r\n \"uniform mat4 projection;\",\r\n \"\",\r\n \"attribute vec3 position;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_Position = projection * worldView * vec4(position, 1.0);\",\r\n \"}\",\r\n ].join(\"\\n\");\r\n\r\n Effect.ShadersStore[\"GLTFDefaultMaterialPixelShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform vec4 u_emission;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_FragColor = u_emission;\",\r\n \"}\",\r\n ].join(\"\\n\");\r\n\r\n const shaderPath = {\r\n vertex: \"GLTFDefaultMaterial\",\r\n fragment: \"GLTFDefaultMaterial\",\r\n };\r\n\r\n const options = {\r\n attributes: [\"position\"],\r\n uniforms: [\"worldView\", \"projection\", \"u_emission\"],\r\n samplers: new Array<string>(),\r\n needAlphaBlending: false,\r\n };\r\n\r\n GLTFUtils._DefaultMaterial = new ShaderMaterial(\"GLTFDefaultMaterial\", scene, shaderPath, options);\r\n GLTFUtils._DefaultMaterial.setColor4(\"u_emission\", new Color4(0.5, 0.5, 0.5, 1.0));\r\n }\r\n\r\n return GLTFUtils._DefaultMaterial;\r\n }\r\n\r\n // The GLTF default material\r\n private static _DefaultMaterial: Nullable<ShaderMaterial> = null;\r\n}\r\n"]}
1
+ {"version":3,"file":"glTFLoaderUtils.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/glTFLoaderUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG9G,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAC3E,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,cAAc,EAAE,oDAAsC;AAC/D,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAI1D;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAClB;;;;;;;OA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B,0BAA0B;gBAC1B,EAAE;gBACF,0BAA0B;gBAC1B,EAAE;gBACF,iBAAiB;gBACjB,GAAG;gBACH,iEAAiE;gBACjE,GAAG;aACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEb,MAAM,CAAC,YAAY,CAAC,gCAAgC,CAAC,GAAG;gBACpD,wBAAwB;gBACxB,EAAE;gBACF,0BAA0B;gBAC1B,EAAE;gBACF,iBAAiB;gBACjB,GAAG;gBACH,gCAAgC;gBAChC,GAAG;aACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEb,MAAM,UAAU,GAAG;gBACf,MAAM,EAAE,qBAAqB;gBAC7B,QAAQ,EAAE,qBAAqB;aAClC,CAAC;YAEF,MAAM,OAAO,GAAG;gBACZ,UAAU,EAAE,CAAC,UAAU,CAAC;gBACxB,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;gBACnD,QAAQ,EAAE,IAAI,KAAK,EAAU;gBAC7B,iBAAiB,EAAE,KAAK;aAC3B,CAAC;YAEF,SAAS,CAAC,gBAAgB,GAAG,IAAI,cAAc,CAAC,qBAAqB,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YACnG,SAAS,CAAC,gBAAgB,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;SACtF;QAED,OAAO,SAAS,CAAC,gBAAgB,CAAC;IACtC,CAAC;;AAED,4BAA4B;AACb,0BAAgB,GAA6B,IAAI,CAAC","sourcesContent":["import type { IGLTFTechniqueParameter, IGLTFAccessor, IGLTFRuntime, IGLTFBufferView } from \"./glTFLoaderInterfaces\";\r\nimport { EParameterType, ETextureWrapMode, ETextureFilterType, EComponentType } from \"./glTFLoaderInterfaces\";\r\n\r\nimport type { Nullable } from \"core/types\";\r\nimport { Vector2, Vector3, Vector4, Matrix } from \"core/Maths/math.vector\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\n/**\r\n * Utils functions for GLTF\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class GLTFUtils {\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param scene the Scene object\r\n * @param source the source node where to pick the matrix\r\n * @param parameter the GLTF technique parameter\r\n * @param uniformName the name of the shader's uniform\r\n * @param shaderMaterial the shader material\r\n */\r\n public static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void {\r\n let mat: Nullable<Matrix> = null;\r\n\r\n if (parameter.semantic === \"MODEL\") {\r\n mat = source.getWorldMatrix();\r\n } else if (parameter.semantic === \"PROJECTION\") {\r\n mat = scene.getProjectionMatrix();\r\n } else if (parameter.semantic === \"VIEW\") {\r\n mat = scene.getViewMatrix();\r\n } else if (parameter.semantic === \"MODELVIEWINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().multiply(scene.getViewMatrix()).invert());\r\n } else if (parameter.semantic === \"MODELVIEW\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix());\r\n } else if (parameter.semantic === \"MODELVIEWPROJECTION\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix());\r\n } else if (parameter.semantic === \"MODELINVERSE\") {\r\n mat = source.getWorldMatrix().invert();\r\n } else if (parameter.semantic === \"VIEWINVERSE\") {\r\n mat = scene.getViewMatrix().invert();\r\n } else if (parameter.semantic === \"PROJECTIONINVERSE\") {\r\n mat = scene.getProjectionMatrix().invert();\r\n } else if (parameter.semantic === \"MODELVIEWINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix()).invert();\r\n } else if (parameter.semantic === \"MODELVIEWPROJECTIONINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix()).invert();\r\n } else if (parameter.semantic === \"MODELINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().invert());\r\n }\r\n\r\n if (mat) {\r\n switch (parameter.type) {\r\n case EParameterType.FLOAT_MAT2:\r\n shaderMaterial.setMatrix2x2(uniformName, Matrix.GetAsMatrix2x2(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT3:\r\n shaderMaterial.setMatrix3x3(uniformName, Matrix.GetAsMatrix3x3(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT4:\r\n shaderMaterial.setMatrix(uniformName, mat);\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param shaderMaterial the shader material\r\n * @param uniform the name of the shader's uniform\r\n * @param value the value of the uniform\r\n * @param type the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)\r\n */\r\n public static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean {\r\n switch (type) {\r\n case EParameterType.FLOAT:\r\n shaderMaterial.setFloat(uniform, value);\r\n return true;\r\n case EParameterType.FLOAT_VEC2:\r\n shaderMaterial.setVector2(uniform, Vector2.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC3:\r\n shaderMaterial.setVector3(uniform, Vector3.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC4:\r\n shaderMaterial.setVector4(uniform, Vector4.FromArray(value));\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the wrap mode of the texture\r\n * @param mode the mode value\r\n */\r\n public static GetWrapMode(mode: number): number {\r\n switch (mode) {\r\n case ETextureWrapMode.CLAMP_TO_EDGE:\r\n return Texture.CLAMP_ADDRESSMODE;\r\n case ETextureWrapMode.MIRRORED_REPEAT:\r\n return Texture.MIRROR_ADDRESSMODE;\r\n case ETextureWrapMode.REPEAT:\r\n return Texture.WRAP_ADDRESSMODE;\r\n default:\r\n return Texture.WRAP_ADDRESSMODE;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the byte stride giving an accessor\r\n * @param accessor the GLTF accessor objet\r\n */\r\n public static GetByteStrideFromType(accessor: IGLTFAccessor): number {\r\n // Needs this function since \"byteStride\" isn't requiered in glTF format\r\n const type = accessor.type;\r\n\r\n switch (type) {\r\n case \"VEC2\":\r\n return 2;\r\n case \"VEC3\":\r\n return 3;\r\n case \"VEC4\":\r\n return 4;\r\n case \"MAT2\":\r\n return 4;\r\n case \"MAT3\":\r\n return 9;\r\n case \"MAT4\":\r\n return 16;\r\n default:\r\n return 1;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the texture filter mode giving a mode value\r\n * @param mode the filter mode value\r\n * @returns the filter mode (TODO - needs to be a type?)\r\n */\r\n public static GetTextureFilterMode(mode: number): number {\r\n switch (mode) {\r\n case ETextureFilterType.LINEAR:\r\n case ETextureFilterType.LINEAR_MIPMAP_NEAREST:\r\n case ETextureFilterType.LINEAR_MIPMAP_LINEAR:\r\n return Texture.TRILINEAR_SAMPLINGMODE;\r\n case ETextureFilterType.NEAREST:\r\n case ETextureFilterType.NEAREST_MIPMAP_NEAREST:\r\n return Texture.NEAREST_SAMPLINGMODE;\r\n default:\r\n return Texture.BILINEAR_SAMPLINGMODE;\r\n }\r\n }\r\n\r\n public static GetBufferFromBufferView(\r\n gltfRuntime: IGLTFRuntime,\r\n bufferView: IGLTFBufferView,\r\n byteOffset: number,\r\n byteLength: number,\r\n componentType: EComponentType\r\n ): ArrayBufferView {\r\n byteOffset = bufferView.byteOffset + byteOffset;\r\n\r\n const loadedBufferView = gltfRuntime.loadedBufferViews[bufferView.buffer];\r\n if (byteOffset + byteLength > loadedBufferView.byteLength) {\r\n throw new Error(\"Buffer access is out of range\");\r\n }\r\n\r\n const buffer = loadedBufferView.buffer;\r\n byteOffset += loadedBufferView.byteOffset;\r\n\r\n switch (componentType) {\r\n case EComponentType.BYTE:\r\n return new Int8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_BYTE:\r\n return new Uint8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.SHORT:\r\n return new Int16Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_SHORT:\r\n return new Uint16Array(buffer, byteOffset, byteLength);\r\n default:\r\n return new Float32Array(buffer, byteOffset, byteLength);\r\n }\r\n }\r\n\r\n /**\r\n * Returns a buffer from its accessor\r\n * @param gltfRuntime the GLTF runtime\r\n * @param accessor the GLTF accessor\r\n */\r\n public static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any {\r\n const bufferView: IGLTFBufferView = gltfRuntime.bufferViews[accessor.bufferView];\r\n const byteLength = accessor.count * GLTFUtils.GetByteStrideFromType(accessor);\r\n return GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, accessor.byteOffset, byteLength, accessor.componentType);\r\n }\r\n\r\n /**\r\n * Decodes a buffer view into a string\r\n * @param view the buffer view\r\n */\r\n public static DecodeBufferToText(view: ArrayBufferView): string {\r\n let result = \"\";\r\n const length = view.byteLength;\r\n\r\n for (let i = 0; i < length; ++i) {\r\n result += String.fromCharCode((<any>view)[i]);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Returns the default material of gltf. Related to\r\n * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material\r\n * @param scene the Babylon.js scene\r\n */\r\n public static GetDefaultMaterial(scene: Scene): ShaderMaterial {\r\n if (!GLTFUtils._DefaultMaterial) {\r\n Effect.ShadersStore[\"GLTFDefaultMaterialVertexShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform mat4 worldView;\",\r\n \"uniform mat4 projection;\",\r\n \"\",\r\n \"attribute vec3 position;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_Position = projection * worldView * vec4(position, 1.0);\",\r\n \"}\",\r\n ].join(\"\\n\");\r\n\r\n Effect.ShadersStore[\"GLTFDefaultMaterialPixelShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform vec4 u_emission;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_FragColor = u_emission;\",\r\n \"}\",\r\n ].join(\"\\n\");\r\n\r\n const shaderPath = {\r\n vertex: \"GLTFDefaultMaterial\",\r\n fragment: \"GLTFDefaultMaterial\",\r\n };\r\n\r\n const options = {\r\n attributes: [\"position\"],\r\n uniforms: [\"worldView\", \"projection\", \"u_emission\"],\r\n samplers: new Array<string>(),\r\n needAlphaBlending: false,\r\n };\r\n\r\n GLTFUtils._DefaultMaterial = new ShaderMaterial(\"GLTFDefaultMaterial\", scene, shaderPath, options);\r\n GLTFUtils._DefaultMaterial.setColor4(\"u_emission\", new Color4(0.5, 0.5, 0.5, 1.0));\r\n }\r\n\r\n return GLTFUtils._DefaultMaterial;\r\n }\r\n\r\n // The GLTF default material\r\n private static _DefaultMaterial: Nullable<ShaderMaterial> = null;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"glTFMaterialsCommonExtension.js","sourceRoot":"","sources":["../../../../../lts/loaders/generated/glTF/1.0/glTFMaterialsCommonExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/E,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,QAAQ,EAAE,8CAAgC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AACpD,OAAO,EAAE,SAAS,EA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AAgB,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;SAC3G;aAAM;YACH,gBAAgB,CAAC,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC7F;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,YAAY,CAAC,WAAyB,EAAE,EAAU,EAAE,QAA0B,EAAE,YAAoB,EAAE,OAAkC;QAC5I,iCAAiC;QACjC,cAAc,CAAC,sBAAsB,CACjC,WAAW,EACX,EAAE,EACF,CAAC,MAAM,EAAE,EAAE;YACP,6BAA6B;YAC7B,cAAc,CAAC,kBAAkB,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAO,QAAS,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;QACvH,CAAC,EACD,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,4BAA4B,EAAE,CAAC,CAAC","sourcesContent":["import { GLTFLoaderExtension, GLTFLoaderBase, GLTFLoader } from \"./glTFLoader\";\r\n\r\nimport type { IGLTFRuntime, IGLTFMaterial } from \"./glTFLoaderInterfaces\";\r\n\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\n\r\ninterface IGLTFMaterialsCommonExtensionValues {\r\n ambient?: number[] | string;\r\n diffuse?: number[] | string;\r\n emission?: number[] | string;\r\n specular?: number[] | string;\r\n shininess?: number;\r\n transparency?: number;\r\n}\r\n\r\ninterface IGLTFMaterialsCommonExtension {\r\n technique: string;\r\n transparent?: number;\r\n doubleSided?: boolean;\r\n values: IGLTFMaterialsCommonExtensionValues;\r\n}\r\n\r\ninterface IGLTFRuntimeCommonExtension {\r\n lights: { [key: string]: IGLTFLightCommonExtension };\r\n}\r\n\r\ninterface IGLTFLightCommonExtension {\r\n name: string;\r\n type: string;\r\n\r\n ambient?: IGLTFAmbientLightCommonExtension;\r\n point?: IGLTFPointLightCommonExtension;\r\n directional?: IGLTFDirectionalLightCommonExtension;\r\n spot?: IGLTFSpotLightCommonExtension;\r\n}\r\n\r\ninterface IGLTFPointLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\ninterface IGLTFAmbientLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFDirectionalLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFSpotLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n fallOffAngle: number;\r\n fallOffExponent: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\n/**\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {\r\n constructor() {\r\n super(\"KHR_materials_common\");\r\n }\r\n\r\n public loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime): boolean {\r\n if (!gltfRuntime.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFRuntimeCommonExtension = gltfRuntime.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n // Create lights\r\n const lights = extension.lights;\r\n if (lights) {\r\n for (const thing in lights) {\r\n const light: IGLTFLightCommonExtension = lights[thing];\r\n\r\n switch (light.type) {\r\n case \"ambient\": {\r\n const ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);\r\n const ambient = light.ambient;\r\n if (ambient) {\r\n ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"point\": {\r\n const pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);\r\n const point = light.point;\r\n if (point) {\r\n pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"directional\": {\r\n const dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);\r\n const directional = light.directional;\r\n if (directional) {\r\n dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"spot\": {\r\n const spot = light.spot;\r\n if (spot) {\r\n const spotLight = new SpotLight(\r\n light.name,\r\n new Vector3(0, 10, 0),\r\n new Vector3(0, -1, 0),\r\n spot.fallOffAngle || Math.PI,\r\n spot.fallOffExponent || 0.0,\r\n gltfRuntime.scene\r\n );\r\n spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n default:\r\n Tools.Warn('GLTF Material Common extension: light type \"' + light.type + \"” not supported\");\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean {\r\n const material: IGLTFMaterial = gltfRuntime.materials[id];\r\n if (!material || !material.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFMaterialsCommonExtension = material.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n const standardMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n\r\n if (extension.technique === \"CONSTANT\") {\r\n standardMaterial.disableLighting = true;\r\n }\r\n\r\n standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;\r\n standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;\r\n standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;\r\n\r\n // Ambient\r\n if (typeof extension.values.ambient === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, \"ambientTexture\", onError);\r\n } else {\r\n standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);\r\n }\r\n\r\n // Diffuse\r\n if (typeof extension.values.diffuse === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, \"diffuseTexture\", onError);\r\n } else {\r\n standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);\r\n }\r\n\r\n // Emission\r\n if (typeof extension.values.emission === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, \"emissiveTexture\", onError);\r\n } else {\r\n standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);\r\n }\r\n\r\n // Specular\r\n if (typeof extension.values.specular === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, \"specularTexture\", onError);\r\n } else {\r\n standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _loadTexture(gltfRuntime: IGLTFRuntime, id: string, material: StandardMaterial, propertyPath: string, onError: (message: string) => void): void {\r\n // Create buffer from texture url\r\n GLTFLoaderBase.LoadTextureBufferAsync(\r\n gltfRuntime,\r\n id,\r\n (buffer) => {\r\n // Create texture from buffer\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, (texture) => ((<any>material)[propertyPath] = texture));\r\n },\r\n onError\r\n );\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());\r\n"]}
1
+ {"version":3,"file":"glTFMaterialsCommonExtension.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0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r\nimport type { IGLTFRuntime, IGLTFMaterial } from \"./glTFLoaderInterfaces\";\r\n\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\n\r\ninterface IGLTFMaterialsCommonExtensionValues {\r\n ambient?: number[] | string;\r\n diffuse?: number[] | string;\r\n emission?: number[] | string;\r\n specular?: number[] | string;\r\n shininess?: number;\r\n transparency?: number;\r\n}\r\n\r\ninterface IGLTFMaterialsCommonExtension {\r\n technique: string;\r\n transparent?: number;\r\n doubleSided?: boolean;\r\n values: IGLTFMaterialsCommonExtensionValues;\r\n}\r\n\r\ninterface IGLTFRuntimeCommonExtension {\r\n lights: { [key: string]: IGLTFLightCommonExtension };\r\n}\r\n\r\ninterface IGLTFLightCommonExtension {\r\n name: string;\r\n type: string;\r\n\r\n ambient?: IGLTFAmbientLightCommonExtension;\r\n point?: IGLTFPointLightCommonExtension;\r\n directional?: IGLTFDirectionalLightCommonExtension;\r\n spot?: IGLTFSpotLightCommonExtension;\r\n}\r\n\r\ninterface IGLTFPointLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\ninterface IGLTFAmbientLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFDirectionalLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFSpotLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n fallOffAngle: number;\r\n fallOffExponent: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\n/**\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {\r\n constructor() {\r\n super(\"KHR_materials_common\");\r\n }\r\n\r\n public loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime): boolean {\r\n if (!gltfRuntime.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFRuntimeCommonExtension = gltfRuntime.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n // Create lights\r\n const lights = extension.lights;\r\n if (lights) {\r\n for (const thing in lights) {\r\n const light: IGLTFLightCommonExtension = lights[thing];\r\n\r\n switch (light.type) {\r\n case \"ambient\": {\r\n const ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);\r\n const ambient = light.ambient;\r\n if (ambient) {\r\n ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"point\": {\r\n const pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);\r\n const point = light.point;\r\n if (point) {\r\n pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"directional\": {\r\n const dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);\r\n const directional = light.directional;\r\n if (directional) {\r\n dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"spot\": {\r\n const spot = light.spot;\r\n if (spot) {\r\n const spotLight = new SpotLight(\r\n light.name,\r\n new Vector3(0, 10, 0),\r\n new Vector3(0, -1, 0),\r\n spot.fallOffAngle || Math.PI,\r\n spot.fallOffExponent || 0.0,\r\n gltfRuntime.scene\r\n );\r\n spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n default:\r\n Tools.Warn('GLTF Material Common extension: light type \"' + light.type + \"” not supported\");\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean {\r\n const material: IGLTFMaterial = gltfRuntime.materials[id];\r\n if (!material || !material.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFMaterialsCommonExtension = material.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n const standardMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n\r\n if (extension.technique === \"CONSTANT\") {\r\n standardMaterial.disableLighting = true;\r\n }\r\n\r\n standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;\r\n standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;\r\n standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;\r\n\r\n // Ambient\r\n if (typeof extension.values.ambient === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, \"ambientTexture\", onError);\r\n } else {\r\n standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);\r\n }\r\n\r\n // Diffuse\r\n if (typeof extension.values.diffuse === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, \"diffuseTexture\", onError);\r\n } else {\r\n standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);\r\n }\r\n\r\n // Emission\r\n if (typeof extension.values.emission === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, \"emissiveTexture\", onError);\r\n } else {\r\n standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);\r\n }\r\n\r\n // Specular\r\n if (typeof extension.values.specular === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, \"specularTexture\", onError);\r\n } else {\r\n standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _loadTexture(gltfRuntime: IGLTFRuntime, id: string, material: StandardMaterial, propertyPath: string, onError: (message: string) => void): void {\r\n // Create buffer from texture url\r\n GLTFLoaderBase.LoadTextureBufferAsync(\r\n gltfRuntime,\r\n id,\r\n (buffer) => {\r\n // Create texture from buffer\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, (texture) => ((<any>material)[propertyPath] = texture));\r\n },\r\n onError\r\n );\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/loaders/generated/glTF/1.0/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./glTFBinaryExtension\";\r\nexport * from \"./glTFLoader\";\r\nexport * from \"./glTFLoaderInterfaces\";\r\nexport * from \"./glTFLoaderUtils\";\r\nexport * from \"./glTFMaterialsCommonExtension\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./glTFBinaryExtension\";\r\nexport * from \"./glTFLoader\";\r\nexport * from \"./glTFLoaderInterfaces\";\r\nexport * from \"./glTFLoaderUtils\";\r\nexport * from \"./glTFMaterialsCommonExtension\";\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_lights_image_based.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/Extensions/EXT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C;IACP,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport { SphericalHarmonics, SphericalPolynomial } from \"core/Maths/sphericalPolynomial\";\r\nimport { Quaternion, Matrix } from \"core/Maths/math.vector\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { RawCubeTexture } from \"core/Materials/Textures/rawCubeTexture\";\r\n\r\nimport type { IEXTLightsImageBased_LightReferenceImageBased, IEXTLightsImageBased_LightImageBased, IEXTLightsImageBased } from \"babylonjs-gltf2interface\";\r\nimport type { IScene } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"EXT_lights_image_based\";\r\n\r\ndeclare module \"babylonjs-gltf2interface\" {\r\n /** @internal */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n interface IEXTLightsImageBased_LightImageBased {\r\n _babylonTexture?: BaseTexture;\r\n _loaded?: Promise<void>;\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_lights_image_based/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_lights_image_based implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n private _lights?: IEXTLightsImageBased_LightImageBased[];\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._lights;\r\n }\r\n\r\n /** @internal */\r\n public onLoading(): void {\r\n const extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n const extension = extensions[this.name] as IEXTLightsImageBased;\r\n this._lights = extension.lights;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTLightsImageBased_LightReferenceImageBased>(context, scene, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n\r\n promises.push(this._loader.loadSceneAsync(context, scene));\r\n\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n const light = ArrayItem.Get(`${extensionContext}/light`, this._lights, extension.light);\r\n promises.push(\r\n this._loadLightAsync(`/extensions/${this.name}/lights/${extension.light}`, light).then((texture) => {\r\n this._loader.babylonScene.environmentTexture = texture;\r\n })\r\n );\r\n\r\n this._loader.logClose();\r\n\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadLightAsync(context: string, light: IEXTLightsImageBased_LightImageBased): Promise<BaseTexture> {\r\n if (!light._loaded) {\r\n const promises = new Array<Promise<any>>();\r\n\r\n this._loader.logOpen(`${context}`);\r\n\r\n const imageData = new Array<Array<ArrayBufferView>>(light.specularImages.length);\r\n for (let mipmap = 0; mipmap < light.specularImages.length; mipmap++) {\r\n const faces = light.specularImages[mipmap];\r\n imageData[mipmap] = new Array<ArrayBufferView>(faces.length);\r\n for (let face = 0; face < faces.length; face++) {\r\n const specularImageContext = `${context}/specularImages/${mipmap}/${face}`;\r\n this._loader.logOpen(`${specularImageContext}`);\r\n\r\n const index = faces[face];\r\n const image = ArrayItem.Get(specularImageContext, this._loader.gltf.images, index);\r\n promises.push(\r\n this._loader.loadImageAsync(`/images/${index}`, image).then((data) => {\r\n imageData[mipmap][face] = data;\r\n })\r\n );\r\n\r\n this._loader.logClose();\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n\r\n light._loaded = Promise.all(promises).then(() => {\r\n const babylonTexture = new RawCubeTexture(this._loader.babylonScene, null, light.specularImageSize);\r\n babylonTexture.name = light.name || \"environment\";\r\n light._babylonTexture = babylonTexture;\r\n\r\n if (light.intensity != undefined) {\r\n babylonTexture.level = light.intensity;\r\n }\r\n\r\n if (light.rotation) {\r\n let rotation = Quaternion.FromArray(light.rotation);\r\n\r\n // Invert the rotation so that positive rotation is counter-clockwise.\r\n if (!this._loader.babylonScene.useRightHandedSystem) {\r\n rotation = Quaternion.Inverse(rotation);\r\n }\r\n\r\n Matrix.FromQuaternionToRef(rotation, babylonTexture.getReflectionTextureMatrix());\r\n }\r\n\r\n if (!light.irradianceCoefficients) {\r\n throw new Error(`${context}: Irradiance coefficients are missing`);\r\n }\r\n\r\n const sphericalHarmonics = SphericalHarmonics.FromArray(light.irradianceCoefficients);\r\n sphericalHarmonics.scaleInPlace(light.intensity);\r\n\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n const sphericalPolynomial = SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n\r\n // Compute the lod generation scale to fit exactly to the number of levels available.\r\n const lodGenerationScale = (imageData.length - 1) / Scalar.Log2(light.specularImageSize);\r\n return babylonTexture.updateRGBDAsync(imageData, sphericalPolynomial, lodGenerationScale);\r\n });\r\n }\r\n\r\n return light._loaded.then(() => {\r\n return light._babylonTexture!;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_lights_image_based(loader));\r\n"]}
1
+ {"version":3,"file":"EXT_lights_image_based.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/EXT_lights_image_based.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAChD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qDAAuC;AACzF,OAAO,EAA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","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport { SphericalHarmonics, SphericalPolynomial } from \"core/Maths/sphericalPolynomial\";\r\nimport { Quaternion, Matrix } from \"core/Maths/math.vector\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { RawCubeTexture } from \"core/Materials/Textures/rawCubeTexture\";\r\n\r\nimport type { IEXTLightsImageBased_LightReferenceImageBased, IEXTLightsImageBased_LightImageBased, IEXTLightsImageBased } from \"babylonjs-gltf2interface\";\r\nimport type { IScene } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"EXT_lights_image_based\";\r\n\r\ndeclare module \"babylonjs-gltf2interface\" {\r\n /** @internal */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n interface IEXTLightsImageBased_LightImageBased {\r\n _babylonTexture?: BaseTexture;\r\n _loaded?: Promise<void>;\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_lights_image_based/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_lights_image_based implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n private _lights?: IEXTLightsImageBased_LightImageBased[];\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._lights;\r\n }\r\n\r\n /** @internal */\r\n public onLoading(): void {\r\n const extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n const extension = extensions[this.name] as IEXTLightsImageBased;\r\n this._lights = extension.lights;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTLightsImageBased_LightReferenceImageBased>(context, scene, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n\r\n promises.push(this._loader.loadSceneAsync(context, scene));\r\n\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n const light = ArrayItem.Get(`${extensionContext}/light`, this._lights, extension.light);\r\n promises.push(\r\n this._loadLightAsync(`/extensions/${this.name}/lights/${extension.light}`, light).then((texture) => {\r\n this._loader.babylonScene.environmentTexture = texture;\r\n })\r\n );\r\n\r\n this._loader.logClose();\r\n\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadLightAsync(context: string, light: IEXTLightsImageBased_LightImageBased): Promise<BaseTexture> {\r\n if (!light._loaded) {\r\n const promises = new Array<Promise<any>>();\r\n\r\n this._loader.logOpen(`${context}`);\r\n\r\n const imageData = new Array<Array<ArrayBufferView>>(light.specularImages.length);\r\n for (let mipmap = 0; mipmap < light.specularImages.length; mipmap++) {\r\n const faces = light.specularImages[mipmap];\r\n imageData[mipmap] = new Array<ArrayBufferView>(faces.length);\r\n for (let face = 0; face < faces.length; face++) {\r\n const specularImageContext = `${context}/specularImages/${mipmap}/${face}`;\r\n this._loader.logOpen(`${specularImageContext}`);\r\n\r\n const index = faces[face];\r\n const image = ArrayItem.Get(specularImageContext, this._loader.gltf.images, index);\r\n promises.push(\r\n this._loader.loadImageAsync(`/images/${index}`, image).then((data) => {\r\n imageData[mipmap][face] = data;\r\n })\r\n );\r\n\r\n this._loader.logClose();\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n\r\n light._loaded = Promise.all(promises).then(() => {\r\n const babylonTexture = new RawCubeTexture(this._loader.babylonScene, null, light.specularImageSize);\r\n babylonTexture.name = light.name || \"environment\";\r\n light._babylonTexture = babylonTexture;\r\n\r\n if (light.intensity != undefined) {\r\n babylonTexture.level = light.intensity;\r\n }\r\n\r\n if (light.rotation) {\r\n let rotation = Quaternion.FromArray(light.rotation);\r\n\r\n // Invert the rotation so that positive rotation is counter-clockwise.\r\n if (!this._loader.babylonScene.useRightHandedSystem) {\r\n rotation = Quaternion.Inverse(rotation);\r\n }\r\n\r\n Matrix.FromQuaternionToRef(rotation, babylonTexture.getReflectionTextureMatrix());\r\n }\r\n\r\n if (!light.irradianceCoefficients) {\r\n throw new Error(`${context}: Irradiance coefficients are missing`);\r\n }\r\n\r\n const sphericalHarmonics = SphericalHarmonics.FromArray(light.irradianceCoefficients);\r\n sphericalHarmonics.scaleInPlace(light.intensity);\r\n\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n const sphericalPolynomial = SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n\r\n // Compute the lod generation scale to fit exactly to the number of levels available.\r\n const lodGenerationScale = (imageData.length - 1) / Scalar.Log2(light.specularImageSize);\r\n return babylonTexture.updateRGBDAsync(imageData, sphericalPolynomial, lodGenerationScale);\r\n });\r\n }\r\n\r\n return light._loaded.then(() => {\r\n return light._babylonTexture!;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_lights_image_based(loader));\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_mesh_gpu_instancing.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,6CAA+B;AAIjF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAMtD,oDAAsC;AAEtC,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC;;;GAGG;AACH,gEAAg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TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport type { INode } from \"../glTFLoaderInterfaces\";\r\n\r\nimport type { IEXTMeshGpuInstancing } from \"babylonjs-gltf2interface\";\r\n\r\nimport \"core/Meshes/thinInstanceMesh\";\r\n\r\nconst NAME = \"EXT_mesh_gpu_instancing\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)\r\n * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTMeshGpuInstancing, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n this._loader._disableInstancedMesh++;\r\n\r\n const promise = this._loader.loadNodeAsync(`/nodes/${node.index}`, node, assign);\r\n\r\n this._loader._disableInstancedMesh--;\r\n\r\n if (!node._primitiveBabylonMeshes) {\r\n return promise;\r\n }\r\n\r\n const promises = new Array<Promise<Nullable<Float32Array>>>();\r\n let instanceCount = 0;\r\n\r\n const loadAttribute = (attribute: string) => {\r\n if (extension.attributes[attribute] == undefined) {\r\n promises.push(Promise.resolve(null));\r\n return;\r\n }\r\n\r\n const accessor = ArrayItem.Get(`${extensionContext}/attributes/${attribute}`, this._loader.gltf.accessors, extension.attributes[attribute]);\r\n promises.push(this._loader._loadFloatAccessorAsync(`/accessors/${accessor.bufferView}`, accessor));\r\n\r\n if (instanceCount === 0) {\r\n instanceCount = accessor.count;\r\n } else if (instanceCount !== accessor.count) {\r\n throw new Error(`${extensionContext}/attributes: Instance buffer accessors do not have the same count.`);\r\n }\r\n };\r\n\r\n loadAttribute(\"TRANSLATION\");\r\n loadAttribute(\"ROTATION\");\r\n loadAttribute(\"SCALE\");\r\n\r\n return promise.then((babylonTransformNode) => {\r\n return Promise.all(promises).then(([translationBuffer, rotationBuffer, scaleBuffer]) => {\r\n const matrices = new Float32Array(instanceCount * 16);\r\n\r\n TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation\r\n TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation\r\n TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale\r\n\r\n for (let i = 0; i < instanceCount; ++i) {\r\n translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);\r\n rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);\r\n scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);\r\n\r\n Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);\r\n\r\n TmpVectors.Matrix[0].copyToArray(matrices, i * 16);\r\n }\r\n\r\n for (const babylonMesh of node._primitiveBabylonMeshes!) {\r\n (babylonMesh as Mesh).thinInstanceSetBuffer(\"matrix\", matrices, 16, true);\r\n }\r\n\r\n return babylonTransformNode;\r\n });\r\n });\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_mesh_gpu_instancing(loader));\r\n"]}
1
+ {"version":3,"file":"EXT_mesh_gpu_instancing.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,6CAA+B;AAIjF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAMtD,oDAAsC;AAEtC,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,uBAAuB;IAahC;;OAEG;IACH,YAAY,MAAkB;QAf9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAaxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,aAAa,CAAC,OAAe,EAAE,IAAW,EAAE,MAAqD;QACpG,OAAO,UAAU,CAAC,kBAAkB,CAAuC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE;YACjI,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAErC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAEjF,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAErC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;gBAC/B,OAAO,OAAO,CAAC;aAClB;YAED,MAAM,QAAQ,GAAG,IAAI,KAAK,EA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Q,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBAC7E;oBAED,OAAO,oBAAoB,CAAC;gBAChC,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import { Vector3, Quaternion, Matrix, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport type { INode } from \"../glTFLoaderInterfaces\";\r\n\r\nimport type { IEXTMeshGpuInstancing } from \"babylonjs-gltf2interface\";\r\n\r\nimport \"core/Meshes/thinInstanceMesh\";\r\n\r\nconst NAME = \"EXT_mesh_gpu_instancing\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)\r\n * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTMeshGpuInstancing, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n this._loader._disableInstancedMesh++;\r\n\r\n const promise = this._loader.loadNodeAsync(`/nodes/${node.index}`, node, assign);\r\n\r\n this._loader._disableInstancedMesh--;\r\n\r\n if (!node._primitiveBabylonMeshes) {\r\n return promise;\r\n }\r\n\r\n const promises = new Array<Promise<Nullable<Float32Array>>>();\r\n let instanceCount = 0;\r\n\r\n const loadAttribute = (attribute: string) => {\r\n if (extension.attributes[attribute] == undefined) {\r\n promises.push(Promise.resolve(null));\r\n return;\r\n }\r\n\r\n const accessor = ArrayItem.Get(`${extensionContext}/attributes/${attribute}`, this._loader.gltf.accessors, extension.attributes[attribute]);\r\n promises.push(this._loader._loadFloatAccessorAsync(`/accessors/${accessor.bufferView}`, accessor));\r\n\r\n if (instanceCount === 0) {\r\n instanceCount = accessor.count;\r\n } else if (instanceCount !== accessor.count) {\r\n throw new Error(`${extensionContext}/attributes: Instance buffer accessors do not have the same count.`);\r\n }\r\n };\r\n\r\n loadAttribute(\"TRANSLATION\");\r\n loadAttribute(\"ROTATION\");\r\n loadAttribute(\"SCALE\");\r\n\r\n return promise.then((babylonTransformNode) => {\r\n return Promise.all(promises).then(([translationBuffer, rotationBuffer, scaleBuffer]) => {\r\n const matrices = new Float32Array(instanceCount * 16);\r\n\r\n TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation\r\n TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation\r\n TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale\r\n\r\n for (let i = 0; i < instanceCount; ++i) {\r\n translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);\r\n rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);\r\n scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);\r\n\r\n Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);\r\n\r\n TmpVectors.Matrix[0].copyToArray(matrices, i * 16);\r\n }\r\n\r\n for (const babylonMesh of node._primitiveBabylonMeshes!) {\r\n (babylonMesh as Mesh).thinInstanceSetBuffer(\"matrix\", matrices, 16, true);\r\n }\r\n\r\n return babylonTransformNode;\r\n });\r\n });\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_mesh_gpu_instancing(loader));\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_meshopt_compression.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/Extensions/EXT_meshopt_compression.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,iEAAmD;AAEhF,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAMvC;;;;;GAKG;AACH,gEAAgE;AAChE,MAAM,OAAO,uBAAuB;IAahC;;OAEG;IACH,YAAY,MAAkB;QAf9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAaxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,mBAAmB,CAAC,OAAe,EAAE,UAAuB;QAC/D,OAAO,UAAU,CAAC,kBAAkB,CAA0C,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE;YAC1I,MAAM,iBAAiB,GAAG,UAAgC,CAAC;YAC3D,IAAI,iBAAiB,CAAC,YAAY,EAAE;gBAChC,OAAO,iBAAiB,CAAC,YAAY,CAAC;aACzC;YAED,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YAC/F,iBAAiB,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAAY,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,UAAU,IAAI,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC/J,OAAO,kBAAkB,CAAC,OAAO,CAAC,qBAAqB,CAAC,MAAoB,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YAC3J,CAAC,CAAC,CAAC;YAEH,OAAO,iBAAiB,CAAC,YAAY,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { ArrayItem, GLTFLoader } from \"../glTFLoader\";\r\nimport type { IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport type { IEXTMeshoptCompression } from \"babylonjs-gltf2interface\";\r\nimport { MeshoptCompression } from \"core/Meshes/Compression/meshoptCompression\";\r\n\r\nconst NAME = \"EXT_meshopt_compression\";\r\n\r\ninterface IBufferViewMeshopt extends IBufferView {\r\n _meshOptData?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md)\r\n *\r\n * This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js\r\n * @since 5.0.0\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_meshopt_compression implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n this._loader = loader;\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTMeshoptCompression, ArrayBufferView>(context, bufferView, this.name, (extensionContext, extension) => {\r\n const bufferViewMeshopt = bufferView as IBufferViewMeshopt;\r\n if (bufferViewMeshopt._meshOptData) {\r\n return bufferViewMeshopt._meshOptData;\r\n }\r\n\r\n const buffer = ArrayItem.Get(`${context}/buffer`, this._loader.gltf.buffers, extension.buffer);\r\n bufferViewMeshopt._meshOptData = this._loader.loadBufferAsync(`/buffers/${buffer.index}`, buffer, extension.byteOffset || 0, extension.byteLength).then((buffer) => {\r\n return MeshoptCompression.Default.decodeGltfBufferAsync(buffer as Uint8Array, extension.count, extension.byteStride, extension.mode, extension.filter);\r\n });\r\n\r\n return bufferViewMeshopt._meshOptData;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_meshopt_compression(loader));\r\n"]}
1
+ {"version":3,"file":"EXT_meshopt_compression.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/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C,qBAAqB,CAAC,MAAoB,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YAC3J,CAAC,CAAC,CAAC;YAEH,OAAO,iBAAiB,CAAC,YAAY,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { ArrayItem, GLTFLoader } from \"../glTFLoader\";\r\nimport type { IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport type { IEXTMeshoptCompression } from \"babylonjs-gltf2interface\";\r\nimport { MeshoptCompression } from \"core/Meshes/Compression/meshoptCompression\";\r\n\r\nconst NAME = \"EXT_meshopt_compression\";\r\n\r\ninterface IBufferViewMeshopt extends IBufferView {\r\n _meshOptData?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md)\r\n *\r\n * This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js\r\n * @since 5.0.0\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_meshopt_compression implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n this._loader = loader;\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTMeshoptCompression, ArrayBufferView>(context, bufferView, this.name, (extensionContext, extension) => {\r\n const bufferViewMeshopt = bufferView as IBufferViewMeshopt;\r\n if (bufferViewMeshopt._meshOptData) {\r\n return bufferViewMeshopt._meshOptData;\r\n }\r\n\r\n const buffer = ArrayItem.Get(`${context}/buffer`, this._loader.gltf.buffers, extension.buffer);\r\n bufferViewMeshopt._meshOptData = this._loader.loadBufferAsync(`/buffers/${buffer.index}`, buffer, extension.byteOffset || 0, extension.byteLength).then((buffer) => {\r\n return MeshoptCompression.Default.decodeGltfBufferAsync(buffer as Uint8Array, extension.count, extension.byteStride, extension.mode, extension.filter);\r\n });\r\n\r\n return bufferViewMeshopt._meshOptData;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_meshopt_compression(loader));\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_texture_webp.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/Extensions/EXT_texture_webp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAMtD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,gBAAgB;IASzB;;OAEG;IACH,YAAY,MAAkB;QAX9B,kCAAkC;QAClB,SAAI,GAAG,IAAI,CAAC;QAWxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,iBAAiB,CAAC,OAAe,EAAE,OAAiB,EAAE,MAA6C;QACtG,OAAO,UAAU,CAAC,kBAAkB,CAA+B,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE;YAC5H,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5J,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,gBAAgB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YACtG,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CACnC,OAAO,EACP,OAAO,EACP,KAAK,EACL,CAAC,cAAc,EAAE,EAAE;gBACf,MAAM,CAAC,cAAc,CAAC,CAAC;YAC3B,CAAC,EACD,SAAS,EACT,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CACrC,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { ITexture } from \"../glTFLoaderInterfaces\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { IEXTTextureWebP } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"EXT_texture_webp\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_texture_webp/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_texture_webp implements IGLTFLoaderExtension {\r\n /** The name of this extension. */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled. */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTTextureWebP, BaseTexture>(context, texture, this.name, (extensionContext, extension) => {\r\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\r\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\r\n return this._loader._createTextureAsync(\r\n context,\r\n sampler,\r\n image,\r\n (babylonTexture) => {\r\n assign(babylonTexture);\r\n },\r\n undefined,\r\n !texture._textureInfo.nonColorData\r\n );\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_texture_webp(loader));\r\n"]}
1
+ {"version":3,"file":"EXT_texture_webp.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/EXT_texture_webp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAMtD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,gBAAgB;IASzB;;OAEG;IACH,YAAY,MAAkB;QAX9B,k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"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { ITexture } from \"../glTFLoaderInterfaces\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { IEXTTextureWebP } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"EXT_texture_webp\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_texture_webp/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_texture_webp implements IGLTFLoaderExtension {\r\n /** The name of this extension. */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled. */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTTextureWebP, BaseTexture>(context, texture, this.name, (extensionContext, extension) => {\r\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\r\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\r\n return this._loader._createTextureAsync(\r\n context,\r\n sampler,\r\n image,\r\n (babylonTexture) => {\r\n assign(babylonTexture);\r\n },\r\n undefined,\r\n !texture._textureInfo.nonColorData\r\n );\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_texture_webp(loader));\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Ex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,OAAe,EAAE,MAAe,EAAE,MAAuC;QAC5F,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,aAAa,EAAQ,EAAE;YACzE,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAC1C,MAAM,CAAC,aAAa,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,OAAe,EAAE,QAAmB,EAAE,eAAuB;QAC/E,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,eAAe,CAAC;IAC3B,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAwB,EAAE,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\n\r\nimport type { IProperty } from \"babylonjs-gltf2interface\";\r\nimport type { INode, ICamera, IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nconst NAME = \"ExtrasAsMetadata\";\r\n\r\ninterface ObjectWithMetadata {\r\n metadata: any;\r\n}\r\n\r\n/**\r\n * Store glTF extras (if present) in BJS objects' metadata\r\n */\r\nexport class ExtrasAsMetadata implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled = true;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _assignExtras(babylonObject: ObjectWithMetadata, gltfProp: IProperty): void {\r\n if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {\r\n const metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n const gltf = (metadata.gltf = metadata.gltf || {});\r\n gltf.extras = gltfProp.extras;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return this._loader.loadNodeAsync(context, node, (babylonTransformNode): void => {\r\n this._assignExtras(babylonTransformNode, node);\r\n assign(babylonTransformNode);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>> {\r\n return this._loader.loadCameraAsync(context, camera, (babylonCamera): void => {\r\n this._assignExtras(babylonCamera, camera);\r\n assign(babylonCamera);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material> {\r\n const babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);\r\n this._assignExtras(babylonMaterial, material);\r\n return babylonMaterial;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader): IGLTFLoaderExtension => new ExtrasAsMetadata(loader));\r\n"]}
1
+ {"version":3,"file":"ExtrasAsMetadata.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/ExtrasAsMetadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAMhC;;GAEG;AACH,MAAM,O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AAa,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,OAAe,EAAE,QAAmB,EAAE,eAAuB;QAC/E,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,eAAe,CAAC;IAC3B,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAwB,EAAE,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\n\r\nimport type { IProperty } from \"babylonjs-gltf2interface\";\r\nimport type { INode, ICamera, IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nconst NAME = \"ExtrasAsMetadata\";\r\n\r\ninterface ObjectWithMetadata {\r\n metadata: any;\r\n}\r\n\r\n/**\r\n * Store glTF extras (if present) in BJS objects' metadata\r\n */\r\nexport class ExtrasAsMetadata implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled = true;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _assignExtras(babylonObject: ObjectWithMetadata, gltfProp: IProperty): void {\r\n if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {\r\n const metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n const gltf = (metadata.gltf = metadata.gltf || {});\r\n gltf.extras = gltfProp.extras;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return this._loader.loadNodeAsync(context, node, (babylonTransformNode): void => {\r\n this._assignExtras(babylonTransformNode, node);\r\n assign(babylonTransformNode);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>> {\r\n return this._loader.loadCameraAsync(context, camera, (babylonCamera): void => {\r\n this._assignExtras(babylonCamera, camera);\r\n assign(babylonCamera);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material> {\r\n const babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);\r\n this._assignExtras(babylonMaterial, material);\r\n return babylonMaterial;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader): IGLTFLoaderExtension => new ExtrasAsMetadata(loader));\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_animation_pointer.data.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_animation_pointer.data.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,SAAS,EAAE,gDAAkC;AAGtD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,SAAS,SAAS,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAChF,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,K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AC,MAAM,oBAAoB,GAAG;IAChC,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,cAAc;CAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport { Animation } from \"core/Animations/animation\";\r\nimport type { ICamera, IKHRLightsPunctual_Light, IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport { AnimationPropertyInfo, nodeAnimationData } from \"../glTFLoaderAnimation\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\n\r\nfunction getColor3(_target: any, source: Float32Array, offset: number, scale: number): Color3 {\r\n return Color3.FromArray(source, offset).scale(scale);\r\n}\r\n\r\nfunction getAlpha(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset + 3] * scale;\r\n}\r\n\r\nfunction getFloat(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset] * scale;\r\n}\r\n\r\nfunction getMinusFloat(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return -source[offset] * scale;\r\n}\r\n\r\nfunction getNextFloat(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset + 1] * scale;\r\n}\r\n\r\nfunction getFloatBy2(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset] * scale * 2;\r\n}\r\n\r\nfunction getTextureTransformTree(textureName: string) {\r\n return {\r\n scale: [\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.uScale`, getFloat, () => 2),\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.vScale`, getNextFloat, () => 2),\r\n ],\r\n offset: [\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.uOffset`, getFloat, () => 2),\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.vOffset`, getNextFloat, () => 2),\r\n ],\r\n rotation: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.wAng`, getMinusFloat, () => 1)],\r\n };\r\n}\r\n\r\nclass CameraAnimationPropertyInfo extends AnimationPropertyInfo {\r\n /** @internal */\r\n public buildAnimations(target: ICamera, name: string, fps: number, keys: any[], callback: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void): void {\r\n callback(target._babylonCamera!, this._buildAnimation(name, fps, keys));\r\n }\r\n}\r\n\r\nclass MaterialAnimationPropertyInfo extends AnimationPropertyInfo {\r\n /** @internal */\r\n public buildAnimations(target: IMaterial, name: string, fps: number, keys: any[], callback: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void): void {\r\n for (const fillMode in target._data!) {\r\n callback(target._data![fillMode].babylonMaterial, this._buildAnimation(name, fps, keys));\r\n }\r\n }\r\n}\r\n\r\nclass LightAnimationPropertyInfo extends AnimationPropertyInfo {\r\n /** @internal */\r\n public buildAnimations(\r\n target: IKHRLightsPunctual_Light,\r\n name: string,\r\n fps: number,\r\n keys: any[],\r\n callback: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): void {\r\n callback(target._babylonLight!, this._buildAnimation(name, fps, keys));\r\n }\r\n}\r\n\r\nconst nodesTree = {\r\n __array__: {\r\n __target__: true,\r\n ...nodeAnimationData,\r\n },\r\n};\r\n\r\nconst camerasTree = {\r\n __array__: {\r\n __target__: true,\r\n orthographic: {\r\n xmag: [\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoLeft\", getMinusFloat, () => 1),\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoRight\", getNextFloat, () => 1),\r\n ],\r\n ymag: [\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoBottom\", getMinusFloat, () => 1),\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoTop\", getNextFloat, () => 1),\r\n ],\r\n zfar: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\", getFloat, () => 1)],\r\n znear: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"minZ\", getFloat, () => 1)],\r\n },\r\n perspective: {\r\n yfov: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"fov\", getFloat, () => 1)],\r\n zfar: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\", getFloat, () => 1)],\r\n znear: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"minZ\", getFloat, () => 1)],\r\n },\r\n },\r\n};\r\n\r\nconst materialsTree = {\r\n __array__: {\r\n __target__: true,\r\n pbrMetallicRoughness: {\r\n baseColorFactor: [\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"albedoColor\", getColor3, () => 4),\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"alpha\", getAlpha, () => 4),\r\n ],\r\n metallicFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"metallic\", getFloat, () => 1)],\r\n roughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"roughness\", getFloat, () => 1)],\r\n baseColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"albedoTexture\"),\r\n },\r\n },\r\n },\r\n emissiveFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"emissiveColor\", getColor3, () => 3)],\r\n normalTexture: {\r\n scale: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"bumpTexture.level\", getFloat, () => 1)],\r\n },\r\n occlusionTexture: {\r\n strength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"ambientTextureStrength\", getFloat, () => 1)],\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"ambientTexture\"),\r\n },\r\n },\r\n emissiveTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"emissiveTexture\"),\r\n },\r\n },\r\n extensions: {\r\n KHR_materials_ior: {\r\n ior: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"indexOfRefraction\", getFloat, () => 1)],\r\n },\r\n KHR_materials_clearcoat: {\r\n clearcoatFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.intensity\", getFloat, () => 1)],\r\n clearcoatRoughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.roughness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_sheen: {\r\n sheenColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"sheen.color\", getColor3, () => 3)],\r\n sheenRoughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"sheen.roughness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_specular: {\r\n specularFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"metallicF0Factor\", getFloat, () => 1)],\r\n specularColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"metallicReflectanceColor\", getColor3, () => 3)],\r\n },\r\n KHR_materials_emissive_strength: {\r\n emissiveStrength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"emissiveIntensity\", getFloat, () => 1)],\r\n },\r\n KHR_materials_transmission: {\r\n transmissionFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.refractionIntensity\", getFloat, () => 1)],\r\n },\r\n KHR_materials_volume: {\r\n attenuationColor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"subSurface.tintColor\", getColor3, () => 3)],\r\n attenuationDistance: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.tintColorAtDistance\", getFloat, () => 1)],\r\n thicknessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.maximumThickness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_iridescence: {\r\n iridescenceFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.intensity\", getFloat, () => 1)],\r\n iridescenceIor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.indexOfRefraction\", getFloat, () => 1)],\r\n iridescenceThicknessMinimum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.minimumThickness\", getFloat, () => 1)],\r\n iridescenceThicknessMaximum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.maximumThickness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_anisotropy: {\r\n anisotropyStrength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"anisotropy.intensity\", getFloat, () => 1)],\r\n anisotropyRotation: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"anisotropy.angle\", getFloat, () => 1)],\r\n },\r\n },\r\n },\r\n};\r\n\r\nconst extensionsTree = {\r\n KHR_lights_punctual: {\r\n lights: {\r\n __array__: {\r\n __target__: true,\r\n color: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"diffuse\", getColor3, () => 3)],\r\n intensity: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"intensity\", getFloat, () => 1)],\r\n range: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"range\", getFloat, () => 1)],\r\n spot: {\r\n innerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"innerAngle\", getFloatBy2, () => 1)],\r\n outerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"angle\", getFloatBy2, () => 1)],\r\n },\r\n },\r\n },\r\n },\r\n};\r\n\r\n/** @internal */\r\nexport const animationPointerTree = {\r\n nodes: nodesTree,\r\n materials: materialsTree,\r\n cameras: camerasTree,\r\n extensions: extensionsTree,\r\n};\r\n"]}
1
+ {"version":3,"file":"KHR_animation_pointer.data.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_animation_pointer.data.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,SAAS,EAAE,gDAAkC;AAGtD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,SAAS,SAAS,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAChF,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,QAAQ,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAC/E,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AACtC,CAAC;AAED,SAAS,QAAQ,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAC/E,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;AAClC,CAAC;AAED,SAAS,aAAa,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IACpF,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IACnF,OAAO,MAAM,CAAC,MAAM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AoB,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;gBACtG,SAAS,EAAE,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,mBAAmB,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC1G,KAAK,EAAE,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,mBAAmB,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;gBAClG,IAAI,EAAE;oBACF,cAAc,EAAE,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;oBACnH,cAAc,EAAE,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,mBAAmB,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;iBACjH;aACJ;SACJ;KACJ;CACJ,CAAC;AAEF,gBAAgB;AAChB,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,cAAc;CAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport { Animation } from \"core/Animations/animation\";\r\nimport type { ICamera, IKHRLightsPunctual_Light, IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport { AnimationPropertyInfo, nodeAnimationData } from \"../glTFLoaderAnimation\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\n\r\nfunction getColor3(_target: any, source: Float32Array, offset: number, scale: number): Color3 {\r\n return Color3.FromArray(source, offset).scale(scale);\r\n}\r\n\r\nfunction getAlpha(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset + 3] * scale;\r\n}\r\n\r\nfunction getFloat(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset] * scale;\r\n}\r\n\r\nfunction getMinusFloat(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return -source[offset] * scale;\r\n}\r\n\r\nfunction getNextFloat(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset + 1] * scale;\r\n}\r\n\r\nfunction getFloatBy2(_target: any, source: Float32Array, offset: number, scale: number): number {\r\n return source[offset] * scale * 2;\r\n}\r\n\r\nfunction getTextureTransformTree(textureName: string) {\r\n return {\r\n scale: [\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.uScale`, getFloat, () => 2),\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.vScale`, getNextFloat, () => 2),\r\n ],\r\n offset: [\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.uOffset`, getFloat, () => 2),\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.vOffset`, getNextFloat, () => 2),\r\n ],\r\n rotation: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.wAng`, getMinusFloat, () => 1)],\r\n };\r\n}\r\n\r\nclass CameraAnimationPropertyInfo extends AnimationPropertyInfo {\r\n /** @internal */\r\n public buildAnimations(target: ICamera, name: string, fps: number, keys: any[], callback: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void): void {\r\n callback(target._babylonCamera!, this._buildAnimation(name, fps, keys));\r\n }\r\n}\r\n\r\nclass MaterialAnimationPropertyInfo extends AnimationPropertyInfo {\r\n /** @internal */\r\n public buildAnimations(target: IMaterial, name: string, fps: number, keys: any[], callback: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void): void {\r\n for (const fillMode in target._data!) {\r\n callback(target._data![fillMode].babylonMaterial, this._buildAnimation(name, fps, keys));\r\n }\r\n }\r\n}\r\n\r\nclass LightAnimationPropertyInfo extends AnimationPropertyInfo {\r\n /** @internal */\r\n public buildAnimations(\r\n target: IKHRLightsPunctual_Light,\r\n name: string,\r\n fps: number,\r\n keys: any[],\r\n callback: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): void {\r\n callback(target._babylonLight!, this._buildAnimation(name, fps, keys));\r\n }\r\n}\r\n\r\nconst nodesTree = {\r\n __array__: {\r\n __target__: true,\r\n ...nodeAnimationData,\r\n },\r\n};\r\n\r\nconst camerasTree = {\r\n __array__: {\r\n __target__: true,\r\n orthographic: {\r\n xmag: [\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoLeft\", getMinusFloat, () => 1),\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoRight\", getNextFloat, () => 1),\r\n ],\r\n ymag: [\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoBottom\", getMinusFloat, () => 1),\r\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoTop\", getNextFloat, () => 1),\r\n ],\r\n zfar: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\", getFloat, () => 1)],\r\n znear: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"minZ\", getFloat, () => 1)],\r\n },\r\n perspective: {\r\n yfov: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"fov\", getFloat, () => 1)],\r\n zfar: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\", getFloat, () => 1)],\r\n znear: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"minZ\", getFloat, () => 1)],\r\n },\r\n },\r\n};\r\n\r\nconst materialsTree = {\r\n __array__: {\r\n __target__: true,\r\n pbrMetallicRoughness: {\r\n baseColorFactor: [\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"albedoColor\", getColor3, () => 4),\r\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"alpha\", getAlpha, () => 4),\r\n ],\r\n metallicFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"metallic\", getFloat, () => 1)],\r\n roughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"roughness\", getFloat, () => 1)],\r\n baseColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"albedoTexture\"),\r\n },\r\n },\r\n },\r\n emissiveFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"emissiveColor\", getColor3, () => 3)],\r\n normalTexture: {\r\n scale: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"bumpTexture.level\", getFloat, () => 1)],\r\n },\r\n occlusionTexture: {\r\n strength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"ambientTextureStrength\", getFloat, () => 1)],\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"ambientTexture\"),\r\n },\r\n },\r\n emissiveTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"emissiveTexture\"),\r\n },\r\n },\r\n extensions: {\r\n KHR_materials_ior: {\r\n ior: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"indexOfRefraction\", getFloat, () => 1)],\r\n },\r\n KHR_materials_clearcoat: {\r\n clearcoatFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.intensity\", getFloat, () => 1)],\r\n clearcoatRoughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.roughness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_sheen: {\r\n sheenColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"sheen.color\", getColor3, () => 3)],\r\n sheenRoughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"sheen.roughness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_specular: {\r\n specularFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"metallicF0Factor\", getFloat, () => 1)],\r\n specularColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"metallicReflectanceColor\", getColor3, () => 3)],\r\n },\r\n KHR_materials_emissive_strength: {\r\n emissiveStrength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"emissiveIntensity\", getFloat, () => 1)],\r\n },\r\n KHR_materials_transmission: {\r\n transmissionFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.refractionIntensity\", getFloat, () => 1)],\r\n },\r\n KHR_materials_volume: {\r\n attenuationColor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"subSurface.tintColor\", getColor3, () => 3)],\r\n attenuationDistance: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.tintColorAtDistance\", getFloat, () => 1)],\r\n thicknessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.maximumThickness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_iridescence: {\r\n iridescenceFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.intensity\", getFloat, () => 1)],\r\n iridescenceIor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.indexOfRefraction\", getFloat, () => 1)],\r\n iridescenceThicknessMinimum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.minimumThickness\", getFloat, () => 1)],\r\n iridescenceThicknessMaximum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.maximumThickness\", getFloat, () => 1)],\r\n },\r\n KHR_materials_anisotropy: {\r\n anisotropyStrength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"anisotropy.intensity\", getFloat, () => 1)],\r\n anisotropyRotation: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"anisotropy.angle\", getFloat, () => 1)],\r\n },\r\n },\r\n },\r\n};\r\n\r\nconst extensionsTree = {\r\n KHR_lights_punctual: {\r\n lights: {\r\n __array__: {\r\n __target__: true,\r\n color: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"diffuse\", getColor3, () => 3)],\r\n intensity: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"intensity\", getFloat, () => 1)],\r\n range: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"range\", getFloat, () => 1)],\r\n spot: {\r\n innerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"innerAngle\", getFloatBy2, () => 1)],\r\n outerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"angle\", getFloatBy2, () => 1)],\r\n },\r\n },\r\n },\r\n },\r\n};\r\n\r\n/** @internal */\r\nexport const animationPointerTree = {\r\n nodes: nodesTree,\r\n materials: materialsTree,\r\n cameras: camerasTree,\r\n extensions: extensionsTree,\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_animation_pointer.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_animation_pointer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,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AE;gBACjB,cAAc,GAAG,eAAe,CAAC;aACpC;SACJ;QAED,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACzC,OAAO,IAAI,CAAC;SACf;QAED,OAAO;YACH,MAAM,EAAE,cAAc;YACtB,UAAU,EAAE,IAAI;SACnB,CAAC;IACN,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IAnimationTargetInfo } from \"../glTFLoader\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Animation } from \"core/Animations/animation\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { IAnimation, IAnimationChannel } from \"../glTFLoaderInterfaces\";\r\nimport type { IKHRAnimationPointer } from \"babylonjs-gltf2interface\";\r\nimport { AnimationChannelTargetPath } from \"babylonjs-gltf2interface\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { animationPointerTree } from \"./KHR_animation_pointer.data\";\r\n\r\nconst NAME = \"KHR_animation_pointer\";\r\n\r\n/**\r\n * [Specification PR](https://github.com/KhronosGroup/glTF/pull/2147)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_animation_pointer implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n }\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public get enabled(): boolean {\r\n return this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * Loads a glTF animation channel.\r\n * @param context The context when loading the asset\r\n * @param animationContext The context of the animation when loading the asset\r\n * @param animation The glTF animation property\r\n * @param channel The glTF animation channel property\r\n * @param onLoad Called for each animation loaded\r\n * @returns A void promise that resolves when the load is complete or null if not handled\r\n */\r\n public _loadAnimationChannelAsync(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Nullable<Promise<void>> {\r\n const extension = channel.target.extensions?.KHR_animation_pointer as IKHRAnimationPointer;\r\n if (!extension) {\r\n return null;\r\n }\r\n\r\n if (channel.target.path !== AnimationChannelTargetPath.POINTER) {\r\n Logger.Warn(`${context}/target/path: Value (${channel.target.path}) must be (${AnimationChannelTargetPath.POINTER}) when using the ${this.name} extension`);\r\n }\r\n\r\n if (channel.target.node != undefined) {\r\n Logger.Warn(`${context}/target/node: Value (${channel.target.node}) must not be present when using the ${this.name} extension`);\r\n }\r\n\r\n const extensionContext = `${context}/extensions/${this.name}`;\r\n\r\n const pointer = extension.pointer;\r\n if (!pointer) {\r\n throw new Error(`${extensionContext}: Pointer is missing`);\r\n }\r\n\r\n const targetInfo = this._parseAnimationPointer(`${extensionContext}/pointer`, pointer);\r\n if (!targetInfo) {\r\n Logger.Warn(`${extensionContext}/pointer: Invalid pointer (${pointer}) skipped`);\r\n return null;\r\n }\r\n\r\n return this._loader._loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad);\r\n }\r\n\r\n /**\r\n * The pointer string is represented by a [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901).\r\n * <animationPointer> := /<rootNode>/<assetIndex>/<propertyPath>\r\n * <rootNode> := \"nodes\" | \"materials\" | \"meshes\" | \"cameras\" | \"extensions\"\r\n * <assetIndex> := <digit> | <name>\r\n * <propertyPath> := <extensionPath> | <standardPath>\r\n * <extensionPath> := \"extensions\"/<name>/<standardPath>\r\n * <standardPath> := <name> | <name>/<standardPath>\r\n * <name> := W+\r\n * <digit> := D+\r\n *\r\n * Examples:\r\n * - \"/nodes/0/rotation\"\r\n * - \"/materials/2/emissiveFactor\"\r\n * - \"/materials/2/pbrMetallicRoughness/baseColorFactor\"\r\n * - \"/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength\"\r\n */\r\n private _parseAnimationPointer(context: string, pointer: string): Nullable<IAnimationTargetInfo> {\r\n if (!pointer.startsWith(\"/\")) {\r\n Logger.Warn(`${context}: Value (${pointer}) must start with a slash`);\r\n return null;\r\n }\r\n\r\n const parts = pointer.split(\"/\");\r\n\r\n // Remove the first part since it will be empty string as pointers must start with a slash.\r\n parts.shift();\r\n\r\n let node: any = animationPointerTree;\r\n let gltfCurrentNode: any = this._loader.gltf;\r\n let gltfTargetNode: any = undefined;\r\n for (const part of parts) {\r\n if (node.__array__) {\r\n node = node.__array__;\r\n } else {\r\n node = node[part];\r\n if (!node) {\r\n return null;\r\n }\r\n }\r\n\r\n gltfCurrentNode = gltfCurrentNode && gltfCurrentNode[part];\r\n\r\n if (node.__target__) {\r\n gltfTargetNode = gltfCurrentNode;\r\n }\r\n }\r\n\r\n if (!gltfTargetNode || !Array.isArray(node)) {\r\n return null;\r\n }\r\n\r\n return {\r\n target: gltfTargetNode,\r\n properties: node,\r\n };\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_animation_pointer(loader));\r\n"]}
1
+ {"version":3,"file":"KHR_animation_pointer.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_animation_pointer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,IAAI,GAAG,uBAAuB,C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,eAAe,CAAC;aACpC;SACJ;QAED,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACzC,OAAO,IAAI,CAAC;SACf;QAED,OAAO;YACH,MAAM,EAAE,cAAc;YACtB,UAAU,EAAE,IAAI;SACnB,CAAC;IACN,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IAnimationTargetInfo } from \"../glTFLoader\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Animation } from \"core/Animations/animation\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { IAnimation, IAnimationChannel } from \"../glTFLoaderInterfaces\";\r\nimport type { IKHRAnimationPointer } from \"babylonjs-gltf2interface\";\r\nimport { AnimationChannelTargetPath } from \"babylonjs-gltf2interface\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { animationPointerTree } from \"./KHR_animation_pointer.data\";\r\n\r\nconst NAME = \"KHR_animation_pointer\";\r\n\r\n/**\r\n * [Specification PR](https://github.com/KhronosGroup/glTF/pull/2147)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_animation_pointer implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n }\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public get enabled(): boolean {\r\n return this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * Loads a glTF animation channel.\r\n * @param context The context when loading the asset\r\n * @param animationContext The context of the animation when loading the asset\r\n * @param animation The glTF animation property\r\n * @param channel The glTF animation channel property\r\n * @param onLoad Called for each animation loaded\r\n * @returns A void promise that resolves when the load is complete or null if not handled\r\n */\r\n public _loadAnimationChannelAsync(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Nullable<Promise<void>> {\r\n const extension = channel.target.extensions?.KHR_animation_pointer as IKHRAnimationPointer;\r\n if (!extension) {\r\n return null;\r\n }\r\n\r\n if (channel.target.path !== AnimationChannelTargetPath.POINTER) {\r\n Logger.Warn(`${context}/target/path: Value (${channel.target.path}) must be (${AnimationChannelTargetPath.POINTER}) when using the ${this.name} extension`);\r\n }\r\n\r\n if (channel.target.node != undefined) {\r\n Logger.Warn(`${context}/target/node: Value (${channel.target.node}) must not be present when using the ${this.name} extension`);\r\n }\r\n\r\n const extensionContext = `${context}/extensions/${this.name}`;\r\n\r\n const pointer = extension.pointer;\r\n if (!pointer) {\r\n throw new Error(`${extensionContext}: Pointer is missing`);\r\n }\r\n\r\n const targetInfo = this._parseAnimationPointer(`${extensionContext}/pointer`, pointer);\r\n if (!targetInfo) {\r\n Logger.Warn(`${extensionContext}/pointer: Invalid pointer (${pointer}) skipped`);\r\n return null;\r\n }\r\n\r\n return this._loader._loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad);\r\n }\r\n\r\n /**\r\n * The pointer string is represented by a [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901).\r\n * <animationPointer> := /<rootNode>/<assetIndex>/<propertyPath>\r\n * <rootNode> := \"nodes\" | \"materials\" | \"meshes\" | \"cameras\" | \"extensions\"\r\n * <assetIndex> := <digit> | <name>\r\n * <propertyPath> := <extensionPath> | <standardPath>\r\n * <extensionPath> := \"extensions\"/<name>/<standardPath>\r\n * <standardPath> := <name> | <name>/<standardPath>\r\n * <name> := W+\r\n * <digit> := D+\r\n *\r\n * Examples:\r\n * - \"/nodes/0/rotation\"\r\n * - \"/materials/2/emissiveFactor\"\r\n * - \"/materials/2/pbrMetallicRoughness/baseColorFactor\"\r\n * - \"/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength\"\r\n */\r\n private _parseAnimationPointer(context: string, pointer: string): Nullable<IAnimationTargetInfo> {\r\n if (!pointer.startsWith(\"/\")) {\r\n Logger.Warn(`${context}: Value (${pointer}) must start with a slash`);\r\n return null;\r\n }\r\n\r\n const parts = pointer.split(\"/\");\r\n\r\n // Remove the first part since it will be empty string as pointers must start with a slash.\r\n parts.shift();\r\n\r\n let node: any = animationPointerTree;\r\n let gltfCurrentNode: any = this._loader.gltf;\r\n let gltfTargetNode: any = undefined;\r\n for (const part of parts) {\r\n if (node.__array__) {\r\n node = node.__array__;\r\n } else {\r\n node = node[part];\r\n if (!node) {\r\n return null;\r\n }\r\n }\r\n\r\n gltfCurrentNode = gltfCurrentNode && gltfCurrentNode[part];\r\n\r\n if (node.__target__) {\r\n gltfTargetNode = gltfCurrentNode;\r\n }\r\n }\r\n\r\n if (!gltfTargetNode || !Array.isArray(node)) {\r\n return null;\r\n }\r\n\r\n return {\r\n target: gltfTargetNode,\r\n properties: node,\r\n };\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_animation_pointer(loader));\r\n"]}