@babylonjs/loaders 7.34.4 → 7.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/solidParser.js +2 -2
- package/OBJ/solidParser.js.map +1 -1
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -1
- package/glTF/2.0/Extensions/interactivityFunctions.js +2 -2
- package/glTF/2.0/Extensions/interactivityFunctions.js.map +1 -1
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -1
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.js.map +1 -1
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/package.json +3 -3
@@ -1 +1 @@
|
|
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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Content":["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 * @returns true if set, else false\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 * @returns the wrap mode (TEXTURE_WRAP_ADDRESSMODE, MIRROR_ADDRESSMODE or CLAMP_ADDRESSMODE)\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 * @returns the byte stride\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 * @returns an array buffer view\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 * @returns a string\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 * @returns the default Babylon material\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,kB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K;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;QACvF,CAAC;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 * @returns true if set, else false\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 * @returns the wrap mode (TEXTURE_WRAP_ADDRESSMODE, MIRROR_ADDRESSMODE or CLAMP_ADDRESSMODE)\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 * @returns the byte stride\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 * @returns an array buffer view\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 * @returns a string\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 * @returns the default Babylon material\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":["../../../../../dev/loaders/src/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,EAAE,4CAA8B;AAwDlD;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,mBAAmB;IACjE;QACI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAClC,CAAC;IAEe,0BAA0B,CAAC,WAAyB;QAChE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;YACzB,OAAO,KAAK,CAAC;SAChB;QAED,MAAM,SAAS,GAAgC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO,KAAK,CAAC;SAChB;QAED,gBAAgB;QAChB,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAChC,IAAI,MAAM,EAAE;YACR,KAAK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,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 override 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 override 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/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,S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,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9F,CAAC;QAED,WAAW;QACX,IAAI,OAAO,SAAS,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAChD,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC5G,CAAC;aAAM,CAAC;YACJ,gBAAgB,CAAC,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9F,CAAC;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 override 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 override 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":"EXT_lights_image_based.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/EXT_lights_image_based.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qDAAuC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,6CAA+B;AAE5D,OAAO,EAAE,cAAc,EAAE,6DAA+C;AAKxE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,wBAAwB,CAAC;AAsBtC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,sBAAsB;IAc/B;;OAEG;IACH,YAAY,MAAkB;QAhB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAcxB,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;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,gBAAgB;IACT,SAAS;QACZ,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;QAChD,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACrC,MAAM,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AAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBAElF,qFAAqF;gBACrF,MAAM,kBAAkB,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACvF,OAAO,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;YAC9F,CAAC,CAAC,CAAC;SACN;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YAC3B,OAAO,KAAK,CAAC,eAAgB,CAAC;QAClC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\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\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"EXT_lights_image_based\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the EXT_lights_image_based extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"EXT_lights_image_based\"]: {};\r\n }\r\n}\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 this._loader._allMaterialsDirtyRequired = true;\r\n\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) / Math.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\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (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,kBAAkB,EAAE,mBAAmB,EAAE,qDAAuC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,6CAA+B;AAE5D,OAAO,EAAE,cAAc,EAAE,6DAA+C;AAKxE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,wBAAwB,CAAC;AAsBtC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,sBAAsB;IAc/B;;OAEG;IACH,YAAY,MAAkB;QAhB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAcxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;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AAC;gBACtF,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC;oBAChC,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,uCAAuC,CAAC,CAAC;gBACvE,CAAC;gBAED,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,SAAS,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBACtF,kBAAkB,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBAEjD,kBAAkB,CAAC,qCAAqC,EAAE,CAAC;gBAC3D,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBAElF,qFAAqF;gBACrF,MAAM,kBAAkB,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACvF,OAAO,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;YAC9F,CAAC,CAAC,CAAC;QACP,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YAC3B,OAAO,KAAK,CAAC,eAAgB,CAAC;QAClC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\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\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"EXT_lights_image_based\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the EXT_lights_image_based extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"EXT_lights_image_based\"]: {};\r\n }\r\n}\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 this._loader._allMaterialsDirtyRequired = true;\r\n\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) / Math.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\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new EXT_lights_image_based(loader));\r\n"]}
|
@@ -1 +1 @@
|
|
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;AAItD,OAAO,EAAE,qBAAqB,EAAE,uB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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\nimport type { IEXTMeshGpuInstancing } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nimport \"core/Meshes/thinInstanceMesh\";\r\n\r\nconst NAME = \"EXT_mesh_gpu_instancing\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the EXT_mesh_gpu_instancing extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"EXT_mesh_gpu_instancing\"]: {};\r\n }\r\n}\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\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new EXT_mesh_gpu_instancing(loader));\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EXT_meshopt_compression.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/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;AAChF,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAiBvC;;;;;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;
|
1
|
+
{"version":3,"file":"EXT_meshopt_compression.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/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;AAChF,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAiBvC;;;;;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,CAAC;gBACjC,OAAO,iBAAiB,CAAC,YAAY,CAAC;YAC1C,CAAC;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,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,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\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"EXT_meshopt_compression\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the EXT_meshopt_compression extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"EXT_meshopt_compression\"]: {};\r\n }\r\n}\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\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new EXT_meshopt_compression(loader));\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExtrasAsMetadata.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/ExtrasAsMetadata.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAiBhC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAajB,aAAa,CAAC,aAAiC,EAAE,QAAmB;QACxE,IAAI,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;
|
1
|
+
{"version":3,"file":"ExtrasAsMetadata.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/ExtrasAsMetadata.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAiBhC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAajB,aAAa,CAAC,aAAiC,EAAE,QAAmB;QACxE,IAAI,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7D,MAAM,QAAQ,GAAG,CAAC,aAAa,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;YACzE,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACn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9B,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,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 type { GLTFLoader } from \"../glTFLoader\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"ExtrasAsMetadata\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the ExtrasAsMetadata extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"ExtrasAsMetadata\"]: {};\r\n }\r\n}\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\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, false, (loader) => new ExtrasAsMetadata(loader));\r\n"]}
|
@@ -1 +1 @@
|
|
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,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AC7B,UAAU,EAAE;wBACR,qBAAqB,EAAE,uBAAuB,CAAC,qCAAqC,CAAC;qBACxF;iBACJ;aACJ;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,cAAc,GAAG;IACnB,mBAAmB,EAAE;QACjB,MAAM,EAAE;YACJ,SAAS,EAAE;gBACP,UAAU,EAAE,IAAI;gBAChB,KAAK,EAAE,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,oBAAoB,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 metallicRoughnessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"metallicTexture\"),\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 extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"bumpTexture\"),\r\n },\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_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 anisotropyTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"anisotropy.texture\"),\r\n },\r\n },\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 clearcoatTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"clearCoat.texture\"),\r\n },\r\n },\r\n clearcoatNormalTexture: {\r\n scale: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.bumpTexture.level\", getFloat, () => 1)],\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"clearCoat.bumpTexture\"),\r\n },\r\n },\r\n clearcoatRoughnessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"clearCoat.textureRoughness\"),\r\n },\r\n },\r\n },\r\n KHR_materials_dispersion: {\r\n dispersion: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.dispersion\", getFloat, () => 1)],\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_ior: {\r\n ior: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"indexOfRefraction\", 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 iridescenceTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"iridescence.texture\"),\r\n },\r\n },\r\n iridescenceThicknessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"iridescence.thicknessTexture\"),\r\n },\r\n },\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 sheenColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"sheen.texture\"),\r\n },\r\n },\r\n sheenRoughnessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"sheen.textureRoughness\"),\r\n },\r\n },\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 specularTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"metallicReflectanceTexture\"),\r\n },\r\n },\r\n specularColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"reflectanceTexture\"),\r\n },\r\n },\r\n },\r\n KHR_materials_transmission: {\r\n transmissionFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.refractionIntensity\", getFloat, () => 1)],\r\n transmissionTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.refractionIntensityTexture\"),\r\n },\r\n },\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 thicknessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.thicknessTexture\"),\r\n },\r\n },\r\n },\r\n KHR_materials_diffuse_transmission: {\r\n diffuseTransmissionFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.translucencyIntensity\", getFloat, () => 1)],\r\n diffuseTransmissionTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.translucencyIntensityTexture\"),\r\n },\r\n },\r\n diffuseTransmissionColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"subSurface.translucencyColor\", getColor3, () => 3)],\r\n diffuseTransmissionColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.translucencyColorTexture\"),\r\n },\r\n },\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,OA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QACjB,MAAM,EAAE;YACJ,SAAS,EAAE;gBACP,UAAU,EAAE,IAAI;gBAChB,KAAK,EAAE,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,oBAAoB,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 metallicRoughnessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"metallicTexture\"),\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 extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"bumpTexture\"),\r\n },\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_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 anisotropyTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"anisotropy.texture\"),\r\n },\r\n },\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 clearcoatTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"clearCoat.texture\"),\r\n },\r\n },\r\n clearcoatNormalTexture: {\r\n scale: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.bumpTexture.level\", getFloat, () => 1)],\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"clearCoat.bumpTexture\"),\r\n },\r\n },\r\n clearcoatRoughnessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"clearCoat.textureRoughness\"),\r\n },\r\n },\r\n },\r\n KHR_materials_dispersion: {\r\n dispersion: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.dispersion\", getFloat, () => 1)],\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_ior: {\r\n ior: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"indexOfRefraction\", 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 iridescenceTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"iridescence.texture\"),\r\n },\r\n },\r\n iridescenceThicknessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"iridescence.thicknessTexture\"),\r\n },\r\n },\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 sheenColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"sheen.texture\"),\r\n },\r\n },\r\n sheenRoughnessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"sheen.textureRoughness\"),\r\n },\r\n },\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 specularTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"metallicReflectanceTexture\"),\r\n },\r\n },\r\n specularColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"reflectanceTexture\"),\r\n },\r\n },\r\n },\r\n KHR_materials_transmission: {\r\n transmissionFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.refractionIntensity\", getFloat, () => 1)],\r\n transmissionTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.refractionIntensityTexture\"),\r\n },\r\n },\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 thicknessTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.thicknessTexture\"),\r\n },\r\n },\r\n },\r\n KHR_materials_diffuse_transmission: {\r\n diffuseTransmissionFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.translucencyIntensity\", getFloat, () => 1)],\r\n diffuseTransmissionTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.translucencyIntensityTexture\"),\r\n },\r\n },\r\n diffuseTransmissionColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"subSurface.translucencyColor\", getColor3, () => 3)],\r\n diffuseTransmissionColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: getTextureTransformTree(\"subSurface.translucencyColorTexture\"),\r\n },\r\n },\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":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_animation_pointer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAarC;;;GAGG;AACH,MAAM,qCAAsC,SAAQ,yBAAkD;IAClG,YAAmB,IAAW;QAC1B,KAAK,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACtC,CAAC;CACJ;AAED;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,qBAAqB;IAS9B;;OAEG;IACH,YAAY,MAAkB;QAX9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QASxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,sBAAsB,GAAG,IAAI,qCAAqC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,KAAK;IAC7C,CAAC;IAED;;;;;;;;OAQG;IACI,0BAA0B,CAC7B,OAAe,EACf,gBAAwB,EACxB,SAAqB,EACrB,OAA0B,EAC1B,MAA6E;QAE7E,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,qBAA6C,CAAC;QAC3F,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;
|
1
|
+
{"version":3,"file":"KHR_animation_pointer.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_animation_pointer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAarC;;;GAGG;AACH,MAAM,qCAAsC,SAAQ,yBAAkD;IAClG,YAAmB,IAAW;QAC1B,KAAK,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACtC,CAAC;CACJ;AAED;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,qBAAqB;IAS9B;;OAEG;IACH,YAAY,MAAkB;QAX9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QASxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,sBAAsB,GAAG,IAAI,qCAAqC,CAAC,IAAI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,CAAC;YACD,MAAM,UAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC,OAAO,CAAC,wCAAwC,CAAC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACpI,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,8BAA8B,OAAO,WAAW,CAAC,CAAC;YACjF,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport type { GLTFLoader } 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, IGLTF } 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\nimport { GLTFPathToObjectConverter } from \"./gltfPathToObjectConverter\";\r\nimport type { AnimationPropertyInfo } from \"../glTFLoaderAnimation\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_animation_pointer\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the KHR_animation_pointer extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_animation_pointer\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * Class to convert an animation pointer path to a smart object that\r\n * gets data from the animation buffer and creates animations.\r\n */\r\nclass AnimationPointerPathToObjectConverter extends GLTFPathToObjectConverter<AnimationPropertyInfo[]> {\r\n public constructor(gltf: IGLTF) {\r\n super(gltf, animationPointerTree);\r\n }\r\n}\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 private _pathToObjectConverter?: AnimationPointerPathToObjectConverter;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this._pathToObjectConverter = new AnimationPointerPathToObjectConverter(this._loader.gltf);\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 delete this._pathToObjectConverter; // GC\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 || !this._pathToObjectConverter) {\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 try {\r\n const targetInfo = this._pathToObjectConverter.convert(pointer);\r\n return this._loader._loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad);\r\n } catch (e) {\r\n Logger.Warn(`${extensionContext}/pointer: Invalid pointer (${pointer}) skipped`);\r\n return null;\r\n }\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_animation_pointer(loader));\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_draco_mesh_compression.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+DAAiD;AAE5E,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAQnD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAiB1C;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,0BAA0B;IAuBnC;;OAEG;IACH,YAAY,MAAkB;QAzB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAY5B;;WAEG;QACI,kCAA6B,GAAG,IAAI,CAAC;QAQxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,gBAAgB,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3F,CAAC;IAED,gBAAgB;IACT,OAAO;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC5B,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,OAAe,EAAE,SAAyB,EAAE,WAAiB;QACrF,OAAO,UAAU,CAAC,kBAAkB,CAAqC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE;YACpI,IAAI,SAAS,CAAC,IAAI,IAAI,SAAS,EAAE;
|
1
|
+
{"version":3,"file":"KHR_draco_mesh_compression.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+DAAiD;AAE5E,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAQnD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAiB1C;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,0BAA0B;IAuBnC;;OAEG;IACH,YAAY,MAAkB;QAzB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAY5B;;WAEG;QACI,kCAA6B,GAAG,IAAI,CAAC;QAQxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,gBAAgB,IAAI,IAAI,CAAC,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,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,UAAU,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBAC9H,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,CAAC;oBAC3E,OAAO,gBAAgB,CAAC,iCAAiC,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;wBACjJ,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACpD,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC;YAED,OAAO,UAAU,CAAC,qBAAqB,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import { DracoCompression } from \"core/Meshes/Compression/dracoCompression\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { Geometry } from \"core/Meshes/geometry\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport { MeshPrimitiveMode } from \"babylonjs-gltf2interface\";\r\nimport type { IKHRDracoMeshCompression } from \"babylonjs-gltf2interface\";\r\nimport type { IMeshPrimitive, IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_draco_mesh_compression\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the KHR_draco_mesh_compression extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_draco_mesh_compression\"]: {};\r\n }\r\n}\r\n\r\ninterface IBufferViewDraco extends IBufferView {\r\n _dracoBabylonGeometry?: Promise<Geometry>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_draco_mesh_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 * The draco compression used to decode vertex data or DracoCompression.Default if not defined\r\n */\r\n public dracoCompression?: DracoCompression;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines whether to use the normalized flag from the glTF accessor instead of the Draco data. Defaults to true.\r\n */\r\n public useNormalizedFlagFromAccessor = true;\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 = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n delete this.dracoCompression;\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRDracoMeshCompression, Geometry>(context, primitive, this.name, (extensionContext, extension) => {\r\n if (primitive.mode != undefined) {\r\n if (primitive.mode !== MeshPrimitiveMode.TRIANGLES && primitive.mode !== MeshPrimitiveMode.TRIANGLE_STRIP) {\r\n throw new Error(`${context}: Unsupported mode ${primitive.mode}`);\r\n }\r\n }\r\n\r\n const attributes: { [kind: string]: number } = {};\r\n const normalized: { [kind: string]: boolean } = {};\r\n const loadAttribute = (name: string, kind: string) => {\r\n const uniqueId = extension.attributes[name];\r\n if (uniqueId == undefined) {\r\n return;\r\n }\r\n\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n\r\n attributes[kind] = uniqueId;\r\n\r\n if (this.useNormalizedFlagFromAccessor) {\r\n const accessor = ArrayItem.TryGet(this._loader.gltf.accessors, primitive.attributes[name]);\r\n if (accessor) {\r\n normalized[kind] = accessor.normalized || false;\r\n }\r\n }\r\n };\r\n\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\r\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\r\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\r\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\r\n\r\n const bufferView = ArrayItem.Get(extensionContext, this._loader.gltf.bufferViews, extension.bufferView) as IBufferViewDraco;\r\n if (!bufferView._dracoBabylonGeometry) {\r\n bufferView._dracoBabylonGeometry = this._loader.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n const dracoCompression = this.dracoCompression || DracoCompression.Default;\r\n return dracoCompression._decodeMeshToGeometryForGltfAsync(babylonMesh.name, this._loader.babylonScene, data, attributes, normalized).catch((error) => {\r\n throw new Error(`${context}: ${error.message}`);\r\n });\r\n });\r\n }\r\n\r\n return bufferView._dracoBabylonGeometry;\r\n });\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_draco_mesh_compression(loader));\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_interactivity.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,0DAA4C;AAC3E,OAAO,EAAE,SAAS,EAAE,+CAAiC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAajC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAY1B;;;OAGG;IACH,YAAoB,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QAfvC;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAaxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,cAAc,GAAG,IAAI,kCAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpF,CAAC;IAEM,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,cAAc,CAAC;I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AErG,MAAM,IAAI,GAAG,gCAAgC,CAAC,uBAAuB,CAAC,CAAC;QACvE,MAAM,WAAW,GAAG,IAAI,oBAAoB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxD,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAE3E,WAAW,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { IKHRInteractivity } from \"babylonjs-gltf2interface\";\r\nimport type { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { FlowGraphCoordinator } from \"core/FlowGraph/flowGraphCoordinator\";\r\nimport { FlowGraph } from \"core/FlowGraph/flowGraph\";\r\nimport { convertGLTFToSerializedFlowGraph } from \"./interactivityFunctions\";\r\nimport { InteractivityPathToObjectConverter } from \"./interactivityPathToObjectConverter\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_interactivity\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the KHR_interactivity extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_interactivity\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * Loader extension for KHR_interactivity\r\n */\r\nexport class KHR_interactivity implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _pathConverter?: InteractivityPathToObjectConverter;\r\n\r\n /**\r\n * @internal\r\n * @param _loader\r\n */\r\n constructor(private _loader: GLTFLoader) {\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n this._pathConverter = new InteractivityPathToObjectConverter(this._loader.gltf);\r\n }\r\n\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._pathConverter;\r\n }\r\n\r\n public onReady(): void {\r\n if (!this._loader.babylonScene || !this._pathConverter) {\r\n return;\r\n }\r\n const scene = this._loader.babylonScene;\r\n const interactivityDefinition = this._loader.gltf.extensions?.KHR_interactivity as IKHRInteractivity;\r\n\r\n const json = convertGLTFToSerializedFlowGraph(interactivityDefinition);\r\n const coordinator = new FlowGraphCoordinator({ scene });\r\n FlowGraph.Parse(json, { coordinator, pathConverter: this._pathConverter });\r\n\r\n coordinator.start();\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_interactivity(loader));\r\n"]}
|