@babylonjs/loaders
Advanced tools
@@ -15,3 +15,3 @@ import { Nullable } from "@babylonjs/core/types"; | ||
| import { IProperty } from "babylonjs-gltf2interface"; | ||
| import { IGLTF, INode, IScene, ICamera, IAnimation, IAnimationChannel, IBufferView, IMaterial, ITextureInfo, IImage, IArrayItem as IArrItem } from "./glTFLoaderInterfaces"; | ||
| import { IGLTF, INode, IScene, IMesh, ICamera, IAnimation, IAnimationChannel, IBufferView, IMaterial, ITextureInfo, IImage, IMeshPrimitive, IArrayItem as IArrItem } from "./glTFLoaderInterfaces"; | ||
| import { IGLTFLoaderExtension } from "./glTFLoaderExtension"; | ||
@@ -128,3 +128,13 @@ import { IGLTFLoader, GLTFFileLoader, GLTFLoaderState, IGLTFLoaderData } from "../glTFFileLoader"; | ||
| private _loadMeshAsync; | ||
| private _loadMeshPrimitiveAsync; | ||
| /** | ||
| * @hidden Define this method to modify the default behavior when loading data for mesh primitives. | ||
| * @param context The context when loading the asset | ||
| * @param name The mesh name when loading the asset | ||
| * @param node The glTF node when loading the asset | ||
| * @param mesh The glTF mesh when loading the asset | ||
| * @param primitive The glTF mesh primitive property | ||
| * @param assign A function called synchronously after parsing the glTF properties | ||
| * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled | ||
| */ | ||
| _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>; | ||
| private _loadVertexDataAsync; | ||
@@ -267,2 +277,3 @@ private _createMorphTargets; | ||
| private _extensionsLoadVertexDataAsync; | ||
| private _extensionsLoadMeshPrimitiveAsync; | ||
| private _extensionsLoadMaterialAsync; | ||
@@ -269,0 +280,0 @@ private _extensionsCreateMaterial; |
@@ -9,4 +9,5 @@ import { Nullable } from "@babylonjs/core/types"; | ||
| import { Mesh } from "@babylonjs/core/Meshes/mesh"; | ||
| import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; | ||
| import { IDisposable } from "@babylonjs/core/scene"; | ||
| import { IScene, INode, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation } from "./glTFLoaderInterfaces"; | ||
| import { IScene, INode, IMesh, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation } from "./glTFLoaderInterfaces"; | ||
| import { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from "../glTFFileLoader"; | ||
@@ -57,2 +58,13 @@ import { IProperty } from 'babylonjs-gltf2interface'; | ||
| /** | ||
| * @hidden Define this method to modify the default behavior when loading data for mesh primitives. | ||
| * @param context The context when loading the asset | ||
| * @param name The mesh name when loading the asset | ||
| * @param node The glTF node when loading the asset | ||
| * @param mesh The glTF mesh when loading the asset | ||
| * @param primitive The glTF mesh primitive property | ||
| * @param assign A function called synchronously after parsing the glTF properties | ||
| * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled | ||
| */ | ||
| _loadMeshPrimitiveAsync?(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>; | ||
| /** | ||
| * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties. | ||
@@ -59,0 +71,0 @@ * @param context The context when loading the asset |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"glTFLoaderExtension.js","sourceRoot":"","sources":["../../../../sourceES6/loaders/src/glTF/2.0/glTFLoaderExtension.ts"],"names":[],"mappings":"","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\r\nimport { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { IDisposable } from \"@babylonjs/core/scene\";\r\n\r\nimport { IScene, INode, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation } from \"./glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from \"../glTFFileLoader\";\r\nimport { IProperty } from 'babylonjs-gltf2interface';\r\n\r\n/**\r\n * Interface for a glTF loader extension.\r\n */\r\nexport interface IGLTFLoaderExtension extends IGLTFBaseLoaderExtension, IDisposable {\r\n /**\r\n * Called after the loader state changes to LOADING.\r\n */\r\n onLoading?(): void;\r\n\r\n /**\r\n * Called after the loader state changes to READY.\r\n */\r\n onReady?(): void;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading scenes.\r\n * @param context The context when loading the asset\r\n * @param scene The glTF scene property\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading nodes.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled\r\n */\r\n loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading cameras.\r\n * @param context The context when loading the asset\r\n * @param camera The glTF camera property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled\r\n */\r\n loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled\r\n */\r\n _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled\r\n */\r\n _loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when creating materials.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonDrawMode The draw mode for the Babylon material\r\n * @returns The Babylon material or null if not handled\r\n */\r\n createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading material properties.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading texture infos.\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled\r\n */\r\n loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading animations.\r\n * @param context The context when loading the asset\r\n * @param animation The glTF animation property\r\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled\r\n */\r\n loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading skins.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param skin The glTF skin property\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n _loadSkinAsync?(context: string, node: INode, skin: ISkin): Nullable<Promise<void>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading uris.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property associated with the uri\r\n * @param uri The uri to load\r\n * @returns A promise that resolves with the loaded data when the load is complete or null if not handled\r\n */\r\n _loadUriAsync?(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;\r\n}"]} | ||
| {"version":3,"file":"glTFLoaderExtension.js","sourceRoot":"","sources":["../../../../sourceES6/loaders/src/glTF/2.0/glTFLoaderExtension.ts"],"names":[],"mappings":"","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\r\nimport { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { IDisposable } from \"@babylonjs/core/scene\";\r\n\r\nimport { IScene, INode, IMesh, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation } from \"./glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from \"../glTFFileLoader\";\r\nimport { IProperty } from 'babylonjs-gltf2interface';\r\n\r\n/**\r\n * Interface for a glTF loader extension.\r\n */\r\nexport interface IGLTFLoaderExtension extends IGLTFBaseLoaderExtension, IDisposable {\r\n /**\r\n * Called after the loader state changes to LOADING.\r\n */\r\n onLoading?(): void;\r\n\r\n /**\r\n * Called after the loader state changes to READY.\r\n */\r\n onReady?(): void;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading scenes.\r\n * @param context The context when loading the asset\r\n * @param scene The glTF scene property\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading nodes.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled\r\n */\r\n loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading cameras.\r\n * @param context The context when loading the asset\r\n * @param camera The glTF camera property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled\r\n */\r\n loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled\r\n */\r\n _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param name The mesh name when loading the asset\r\n * @param node The glTF node when loading the asset\r\n * @param mesh The glTF mesh when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled\r\n */\r\n _loadMeshPrimitiveAsync?(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled\r\n */\r\n _loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when creating materials.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonDrawMode The draw mode for the Babylon material\r\n * @returns The Babylon material or null if not handled\r\n */\r\n createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading material properties.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading texture infos.\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled\r\n */\r\n loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when loading animations.\r\n * @param context The context when loading the asset\r\n * @param animation The glTF animation property\r\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled\r\n */\r\n loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading skins.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param skin The glTF skin property\r\n * @returns A promise that resolves when the load is complete or null if not handled\r\n */\r\n _loadSkinAsync?(context: string, node: INode, skin: ISkin): Nullable<Promise<void>>;\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading uris.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property associated with the uri\r\n * @param uri The uri to load\r\n * @returns A promise that resolves with the loaded data when the load is complete or null if not handled\r\n */\r\n _loadUriAsync?(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;\r\n}"]} |
@@ -0,1 +1,2 @@ | ||
| import { Vector2 } from "@babylonjs/core/Maths/math"; | ||
| import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup"; | ||
@@ -49,2 +50,6 @@ import { Skeleton } from "@babylonjs/core/Bones/skeleton"; | ||
| /** | ||
| * Defines custom scaling of UV coordinates of loaded meshes. | ||
| */ | ||
| UVScaling: Vector2; | ||
| /** | ||
| * Invert model on y-axis (does a model scaling inversion) | ||
@@ -54,2 +59,6 @@ */ | ||
| /** | ||
| * Invert Y-Axis of referenced textures on load | ||
| */ | ||
| InvertTextureY: boolean; | ||
| /** | ||
| * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard. | ||
@@ -85,2 +94,6 @@ */ | ||
| /** | ||
| * Invert Y-Axis of referenced textures on load | ||
| */ | ||
| static INVERT_TEXTURE_Y: boolean; | ||
| /** | ||
| * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard. | ||
@@ -94,2 +107,6 @@ */ | ||
| /** | ||
| * Defines custom scaling of UV coordinates of loaded meshes. | ||
| */ | ||
| static UV_SCALING: Vector2; | ||
| /** | ||
| * Skip loading the materials even if defined in the OBJ file (materials are ignored). | ||
@@ -96,0 +113,0 @@ */ |
+12
-2
@@ -215,3 +215,3 @@ import { Vector3, Vector2, Color3, Color4 } from "@babylonjs/core/Maths/math"; | ||
| } | ||
| return new Texture(url, scene); | ||
| return new Texture(url, scene, false, OBJFileLoader.INVERT_TEXTURE_Y); | ||
| }; | ||
@@ -281,2 +281,4 @@ return MTLFileLoader; | ||
| InvertY: OBJFileLoader.INVERT_Y, | ||
| InvertTextureY: OBJFileLoader.INVERT_TEXTURE_Y, | ||
| UVScaling: OBJFileLoader.UV_SCALING, | ||
| MaterialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY, | ||
@@ -764,3 +766,3 @@ OptimizeWithUV: OBJFileLoader.OPTIMIZE_WITH_UV, | ||
| //Add the Vector in the list of uvs | ||
| uvs.push(new Vector2(parseFloat(result[1]), parseFloat(result[2]))); | ||
| uvs.push(new Vector2(parseFloat(result[1]) * OBJFileLoader.UV_SCALING.x, parseFloat(result[2]) * OBJFileLoader.UV_SCALING.y)); | ||
| //Identify patterns of faces | ||
@@ -1028,2 +1030,6 @@ //Face could be defined in different type of pattern | ||
| /** | ||
| * Invert Y-Axis of referenced textures on load | ||
| */ | ||
| OBJFileLoader.INVERT_TEXTURE_Y = true; | ||
| /** | ||
| * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard. | ||
@@ -1037,2 +1043,6 @@ */ | ||
| /** | ||
| * Defines custom scaling of UV coordinates of loaded meshes. | ||
| */ | ||
| OBJFileLoader.UV_SCALING = new Vector2(1, 1); | ||
| /** | ||
| * Skip loading the materials even if defined in the OBJ file (materials are ignored). | ||
@@ -1039,0 +1049,0 @@ */ |
+3
-3
@@ -7,3 +7,3 @@ { | ||
| "description": "The Babylon.js file loaders library is an extension you can use to load different 3D file types into a Babylon scene.", | ||
| "version": "4.0.0-beta.4", | ||
| "version": "4.0.0-beta.5", | ||
| "repository": { | ||
@@ -138,4 +138,4 @@ "type": "git", | ||
| "dependencies": { | ||
| "babylonjs-gltf2interface": "4.0.0-beta.4", | ||
| "@babylonjs/core": "4.0.0-beta.4", | ||
| "babylonjs-gltf2interface": "4.0.0-beta.5", | ||
| "@babylonjs/core": "4.0.0-beta.5", | ||
| "tslib": "^1.9.3" | ||
@@ -142,0 +142,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1068240
0.7%9533
0.71%+ Added
+ Added
- Removed
- Removed
Updated