@babylonjs/loaders 7.1.0 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.d.ts +18 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js +11 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
- package/glTF/glTFValidation.js +1 -1
- package/glTF/glTFValidation.js.map +1 -1
- package/package.json +3 -3
@@ -141,6 +141,24 @@ export declare const animationPointerTree: {
|
|
141
141
|
iridescenceIor: MaterialAnimationPropertyInfo[];
|
142
142
|
iridescenceThicknessMinimum: MaterialAnimationPropertyInfo[];
|
143
143
|
iridescenceThicknessMaximum: MaterialAnimationPropertyInfo[];
|
144
|
+
iridescenceTexture: {
|
145
|
+
extensions: {
|
146
|
+
KHR_texture_transform: {
|
147
|
+
scale: MaterialAnimationPropertyInfo[];
|
148
|
+
offset: MaterialAnimationPropertyInfo[];
|
149
|
+
rotation: MaterialAnimationPropertyInfo[];
|
150
|
+
};
|
151
|
+
};
|
152
|
+
};
|
153
|
+
iridescenceThicknessTexture: {
|
154
|
+
extensions: {
|
155
|
+
KHR_texture_transform: {
|
156
|
+
scale: MaterialAnimationPropertyInfo[];
|
157
|
+
offset: MaterialAnimationPropertyInfo[];
|
158
|
+
rotation: MaterialAnimationPropertyInfo[];
|
159
|
+
};
|
160
|
+
};
|
161
|
+
};
|
144
162
|
};
|
145
163
|
KHR_materials_sheen: {
|
146
164
|
sheenColorFactor: MaterialAnimationPropertyInfo[];
|
@@ -126,7 +126,7 @@ const materialsTree = {
|
|
126
126
|
anisotropyRotation: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, "anisotropy.angle", getFloat, () => 1)],
|
127
127
|
anisotropyTexture: {
|
128
128
|
extensions: {
|
129
|
-
KHR_texture_transform: getTextureTransformTree("
|
129
|
+
KHR_texture_transform: getTextureTransformTree("anisotropy.texture"),
|
130
130
|
},
|
131
131
|
},
|
132
132
|
},
|
@@ -164,6 +164,16 @@ const materialsTree = {
|
|
164
164
|
iridescenceIor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, "iridescence.indexOfRefraction", getFloat, () => 1)],
|
165
165
|
iridescenceThicknessMinimum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, "iridescence.minimumThickness", getFloat, () => 1)],
|
166
166
|
iridescenceThicknessMaximum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, "iridescence.maximumThickness", getFloat, () => 1)],
|
167
|
+
iridescenceTexture: {
|
168
|
+
extensions: {
|
169
|
+
KHR_texture_transform: getTextureTransformTree("iridescence.texture"),
|
170
|
+
},
|
171
|
+
},
|
172
|
+
iridescenceThicknessTexture: {
|
173
|
+
extensions: {
|
174
|
+
KHR_texture_transform: getTextureTransformTree("iridescence.thicknessTexture"),
|
175
|
+
},
|
176
|
+
},
|
167
177
|
},
|
168
178
|
KHR_materials_sheen: {
|
169
179
|
sheenColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, "sheen.color", getColor3, () => 3)],
|
@@ -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,SAAS,QAAQ,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,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c,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(\"anisotropyTexture\"),\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 },\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 },\r\n },\r\n};\r\n\r\nconst extensionsTree = {\r\n KHR_lights_punctual: {\r\n lights: {\r\n __array__: {\r\n __target__: true,\r\n color: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"diffuse\", getColor3, () => 3)],\r\n intensity: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"intensity\", getFloat, () => 1)],\r\n range: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"range\", getFloat, () => 1)],\r\n spot: {\r\n innerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"innerAngle\", getFloatBy2, () => 1)],\r\n outerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"angle\", getFloatBy2, () => 1)],\r\n },\r\n },\r\n },\r\n },\r\n};\r\n\r\n/** @internal */\r\nexport const animationPointerTree = {\r\n nodes: nodesTree,\r\n materials: materialsTree,\r\n cameras: camerasTree,\r\n extensions: extensionsTree,\r\n};\r\n"]}
|
1
|
+
{"version":3,"file":"KHR_animation_pointer.data.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_animation_pointer.data.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,SAAS,EAAE,gDAAkC;AAGtD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,SAAS,SAAS,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAChF,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,QAAQ,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAC/E,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AACtC,CAAC;AAED,SAAS,QAAQ,CAAC,OAAY,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAa;IAC/E,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;AAClC,CAAC;AAED,SAAS,aAAa,CAAC,OAAY,EAAE,MAAoB,EAAE,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,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 },\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"]}
|
package/glTF/glTFValidation.js
CHANGED
@@ -71,7 +71,7 @@ export class GLTFValidation {
|
|
71
71
|
switch (data.id) {
|
72
72
|
case "getExternalResource": {
|
73
73
|
getExternalResource(data.uri).then((value) => {
|
74
|
-
worker.postMessage({ id: "getExternalResource.resolve", index: data.index, value: value }, [value]);
|
74
|
+
worker.postMessage({ id: "getExternalResource.resolve", index: data.index, value: value }, [value.buffer]);
|
75
75
|
}, (reason) => {
|
76
76
|
worker.postMessage({ id: "getExternalResource.reject", index: data.index, reason: reason });
|
77
77
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFValidation.js","sourceRoot":"","sources":["../../../../dev/loaders/src/glTF/glTFValidation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AASxC,SAAS,aAAa,CAClB,IAAyB,EACzB,OAAe,EACf,QAAgB,EAChB,mBAAyD;IAEzD,MAAM,OAAO,GAAiC;QAC1C,wBAAwB,EAAE,mBAAmB;KAChD,CAAC;IAEF,IAAI,QAAQ,EAAE;QACV,OAAO,CAAC,G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r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let GLTFValidator: GLTF2.IGLTFValidator;\r\n\r\n// WorkerGlobalScope\r\ndeclare function importScripts(...urls: string[]): void;\r\ndeclare function postMessage(message: any, transfer?: any[]): void;\r\n\r\nfunction validateAsync(\r\n data: string | Uint8Array,\r\n rootUrl: string,\r\n fileName: string,\r\n getExternalResource: (uri: string) => Promise<Uint8Array>\r\n): Promise<GLTF2.IGLTFValidationResults> {\r\n const options: GLTF2.IGLTFValidationOptions = {\r\n externalResourceFunction: getExternalResource,\r\n };\r\n\r\n if (fileName) {\r\n options.uri = rootUrl === \"file:\" ? fileName : rootUrl + fileName;\r\n }\r\n\r\n return ArrayBuffer.isView(data) ? GLTFValidator.validateBytes(data, options) : GLTFValidator.validateString(data, options);\r\n}\r\n\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction workerFunc(): void {\r\n const pendingExternalResources: Array<{ resolve: (data: any) => void; reject: (reason: any) => void }> = [];\r\n\r\n onmessage = (message) => {\r\n const data = message.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n importScripts(data.url);\r\n break;\r\n }\r\n case \"validate\": {\r\n validateAsync(\r\n data.data,\r\n data.rootUrl,\r\n data.fileName,\r\n (uri) =>\r\n new Promise((resolve, reject) => {\r\n const index = pendingExternalResources.length;\r\n pendingExternalResources.push({ resolve, reject });\r\n postMessage({ id: \"getExternalResource\", index: index, uri: uri });\r\n })\r\n ).then(\r\n (value) => {\r\n postMessage({ id: \"validate.resolve\", value: value });\r\n },\r\n (reason) => {\r\n postMessage({ id: \"validate.reject\", reason: reason });\r\n }\r\n );\r\n break;\r\n }\r\n case \"getExternalResource.resolve\": {\r\n pendingExternalResources[data.index].resolve(data.value);\r\n break;\r\n }\r\n case \"getExternalResource.reject\": {\r\n pendingExternalResources[data.index].reject(data.reason);\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Configuration for glTF validation\r\n */\r\nexport interface IGLTFValidationConfiguration {\r\n /**\r\n * The url of the glTF validator.\r\n */\r\n url: string;\r\n}\r\n\r\n/**\r\n * glTF validation\r\n */\r\nexport class GLTFValidation {\r\n /**\r\n * The configuration. Defaults to `{ url: \"https://cdn.babylonjs.com/gltf_validator.js\" }`.\r\n */\r\n public static Configuration: IGLTFValidationConfiguration = {\r\n url: `${Tools._DefaultCdnUrl}/gltf_validator.js`,\r\n };\r\n\r\n private static _LoadScriptPromise: Promise<void>;\r\n\r\n /**\r\n * Validate a glTF asset using the glTF-Validator.\r\n * @param data The JSON of a glTF or the array buffer of a binary glTF\r\n * @param rootUrl The root url for the glTF\r\n * @param fileName The file name for the glTF\r\n * @param getExternalResource The callback to get external resources for the glTF validator\r\n * @returns A promise that resolves with the glTF validation results once complete\r\n */\r\n public static ValidateAsync(\r\n data: string | Uint8Array,\r\n rootUrl: string,\r\n fileName: string,\r\n getExternalResource: (uri: string) => Promise<Uint8Array>\r\n ): Promise<GLTF2.IGLTFValidationResults> {\r\n if (typeof Worker === \"function\") {\r\n return new Promise((resolve, reject) => {\r\n const workerContent = `${validateAsync}(${workerFunc})()`;\r\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n const worker = new Worker(workerBlobUrl);\r\n\r\n const onError = (error: ErrorEvent) => {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n\r\n const onMessage = (message: MessageEvent) => {\r\n const data = message.data;\r\n switch (data.id) {\r\n case \"getExternalResource\": {\r\n getExternalResource(data.uri).then(\r\n (value) => {\r\n worker.postMessage({ id: \"getExternalResource.resolve\", index: data.index, value: value }, [value]);\r\n },\r\n (reason) => {\r\n worker.postMessage({ id: \"getExternalResource.reject\", index: data.index, reason: reason });\r\n }\r\n );\r\n break;\r\n }\r\n case \"validate.resolve\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(data.value);\r\n worker.terminate();\r\n break;\r\n }\r\n case \"validate.reject\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(data.reason);\r\n worker.terminate();\r\n }\r\n }\r\n };\r\n\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n\r\n worker.postMessage({ id: \"init\", url: Tools.GetBabylonScriptURL(this.Configuration.url) });\r\n\r\n if (ArrayBuffer.isView(data)) {\r\n // Slice the data to avoid copying the whole array buffer.\r\n const slicedData = data.slice();\r\n worker.postMessage({ id: \"validate\", data: slicedData, rootUrl: rootUrl, fileName: fileName }, [slicedData.buffer]);\r\n } else {\r\n worker.postMessage({ id: \"validate\", data: data, rootUrl: rootUrl, fileName: fileName });\r\n }\r\n });\r\n } else {\r\n if (!this._LoadScriptPromise) {\r\n this._LoadScriptPromise = Tools.LoadBabylonScriptAsync(this.Configuration.url);\r\n }\r\n\r\n return this._LoadScriptPromise.then(() => {\r\n return validateAsync(data, rootUrl, fileName, getExternalResource);\r\n });\r\n }\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"glTFValidation.js","sourceRoot":"","sources":["../../../../dev/loaders/src/glTF/glTFValidation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AASxC,SAAS,aAAa,CAClB,IAAyB,EACzB,OAAe,EACf,QAAgB,EAChB,mBAAyD;IAEzD,MAAM,OAAO,GAAiC;QAC1C,wBAAwB,EAAE,mBAAmB;KAChD,CAAC;IAEF,IAAI,QAAQ,EAAE;QACV,OAAO,CAAC,GAAG,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,GAAG,QAAQ,CAAC;KACrE;IAED,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,aA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CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC1B,0DAA0D;oBAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;oBAChC,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;iBACvH;qBAAM;oBACH,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;iBAC5F;YACL,CAAC,CAAC,CAAC;SACN;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;gBAC1B,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;aAClF;YAED,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE;gBACrC,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;SACN;IACL,CAAC;;AAvFD;;GAEG;AACW,4BAAa,GAAiC;IACxD,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,oBAAoB;CACnD,CAAC","sourcesContent":["import type * as GLTF2 from \"babylonjs-gltf2interface\";\r\nimport { Tools } from \"core/Misc/tools\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let GLTFValidator: GLTF2.IGLTFValidator;\r\n\r\n// WorkerGlobalScope\r\ndeclare function importScripts(...urls: string[]): void;\r\ndeclare function postMessage(message: any, transfer?: any[]): void;\r\n\r\nfunction validateAsync(\r\n data: string | Uint8Array,\r\n rootUrl: string,\r\n fileName: string,\r\n getExternalResource: (uri: string) => Promise<Uint8Array>\r\n): Promise<GLTF2.IGLTFValidationResults> {\r\n const options: GLTF2.IGLTFValidationOptions = {\r\n externalResourceFunction: getExternalResource,\r\n };\r\n\r\n if (fileName) {\r\n options.uri = rootUrl === \"file:\" ? fileName : rootUrl + fileName;\r\n }\r\n\r\n return ArrayBuffer.isView(data) ? GLTFValidator.validateBytes(data, options) : GLTFValidator.validateString(data, options);\r\n}\r\n\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction workerFunc(): void {\r\n const pendingExternalResources: Array<{ resolve: (data: any) => void; reject: (reason: any) => void }> = [];\r\n\r\n onmessage = (message) => {\r\n const data = message.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n importScripts(data.url);\r\n break;\r\n }\r\n case \"validate\": {\r\n validateAsync(\r\n data.data,\r\n data.rootUrl,\r\n data.fileName,\r\n (uri) =>\r\n new Promise((resolve, reject) => {\r\n const index = pendingExternalResources.length;\r\n pendingExternalResources.push({ resolve, reject });\r\n postMessage({ id: \"getExternalResource\", index: index, uri: uri });\r\n })\r\n ).then(\r\n (value) => {\r\n postMessage({ id: \"validate.resolve\", value: value });\r\n },\r\n (reason) => {\r\n postMessage({ id: \"validate.reject\", reason: reason });\r\n }\r\n );\r\n break;\r\n }\r\n case \"getExternalResource.resolve\": {\r\n pendingExternalResources[data.index].resolve(data.value);\r\n break;\r\n }\r\n case \"getExternalResource.reject\": {\r\n pendingExternalResources[data.index].reject(data.reason);\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Configuration for glTF validation\r\n */\r\nexport interface IGLTFValidationConfiguration {\r\n /**\r\n * The url of the glTF validator.\r\n */\r\n url: string;\r\n}\r\n\r\n/**\r\n * glTF validation\r\n */\r\nexport class GLTFValidation {\r\n /**\r\n * The configuration. Defaults to `{ url: \"https://cdn.babylonjs.com/gltf_validator.js\" }`.\r\n */\r\n public static Configuration: IGLTFValidationConfiguration = {\r\n url: `${Tools._DefaultCdnUrl}/gltf_validator.js`,\r\n };\r\n\r\n private static _LoadScriptPromise: Promise<void>;\r\n\r\n /**\r\n * Validate a glTF asset using the glTF-Validator.\r\n * @param data The JSON of a glTF or the array buffer of a binary glTF\r\n * @param rootUrl The root url for the glTF\r\n * @param fileName The file name for the glTF\r\n * @param getExternalResource The callback to get external resources for the glTF validator\r\n * @returns A promise that resolves with the glTF validation results once complete\r\n */\r\n public static ValidateAsync(\r\n data: string | Uint8Array,\r\n rootUrl: string,\r\n fileName: string,\r\n getExternalResource: (uri: string) => Promise<Uint8Array>\r\n ): Promise<GLTF2.IGLTFValidationResults> {\r\n if (typeof Worker === \"function\") {\r\n return new Promise((resolve, reject) => {\r\n const workerContent = `${validateAsync}(${workerFunc})()`;\r\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n const worker = new Worker(workerBlobUrl);\r\n\r\n const onError = (error: ErrorEvent) => {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n\r\n const onMessage = (message: MessageEvent) => {\r\n const data = message.data;\r\n switch (data.id) {\r\n case \"getExternalResource\": {\r\n getExternalResource(data.uri).then(\r\n (value) => {\r\n worker.postMessage({ id: \"getExternalResource.resolve\", index: data.index, value: value }, [value.buffer]);\r\n },\r\n (reason) => {\r\n worker.postMessage({ id: \"getExternalResource.reject\", index: data.index, reason: reason });\r\n }\r\n );\r\n break;\r\n }\r\n case \"validate.resolve\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(data.value);\r\n worker.terminate();\r\n break;\r\n }\r\n case \"validate.reject\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(data.reason);\r\n worker.terminate();\r\n }\r\n }\r\n };\r\n\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n\r\n worker.postMessage({ id: \"init\", url: Tools.GetBabylonScriptURL(this.Configuration.url) });\r\n\r\n if (ArrayBuffer.isView(data)) {\r\n // Slice the data to avoid copying the whole array buffer.\r\n const slicedData = data.slice();\r\n worker.postMessage({ id: \"validate\", data: slicedData, rootUrl: rootUrl, fileName: fileName }, [slicedData.buffer]);\r\n } else {\r\n worker.postMessage({ id: \"validate\", data: data, rootUrl: rootUrl, fileName: fileName });\r\n }\r\n });\r\n } else {\r\n if (!this._LoadScriptPromise) {\r\n this._LoadScriptPromise = Tools.LoadBabylonScriptAsync(this.Configuration.url);\r\n }\r\n\r\n return this._LoadScriptPromise.then(() => {\r\n return validateAsync(data, rootUrl, fileName, getExternalResource);\r\n });\r\n }\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/loaders",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.2.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"module": "index.js",
|
6
6
|
"types": "index.d.ts",
|
@@ -18,10 +18,10 @@
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
|
-
"@babylonjs/core": "^7.
|
21
|
+
"@babylonjs/core": "^7.2.0",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/loaders": "^1.0.0",
|
24
|
-
"babylonjs-gltf2interface": "^7.
|
24
|
+
"babylonjs-gltf2interface": "^7.2.0"
|
25
25
|
},
|
26
26
|
"peerDependencies": {
|
27
27
|
"@babylonjs/core": "^7.0.0",
|