@babylonjs/loaders
Advanced tools
Comparing version
@@ -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 |
@@ -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 @@ */ |
@@ -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 @@ */ |
@@ -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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1068240
0.7%9533
0.71%+ Added
+ Added
- Removed
- Removed
Updated