API Docs for: 2.7.3
Show:

wnp.Assimp2jsonImporter Class

Module: Helpers
Parent Module: Wanaplan

An importer for assimp2json export.

Methods

_createWebGLTexture

(
  • image
  • [invertY]
)
WebGLTexture private

Creates a WebGL texture.

Parameters:

  • image Image

    The image to convert into WebGLTexture

  • [invertY] Boolean optional

    Sets to true to invert Y axis.

Returns:

WebGLTexture:

Returns a WebGLTexture.

_getTextureName

(
  • delimiter
  • textureName
)
String private

Gets the name of a texture by extracting it via its path.

Parameters:

  • delimiter String

    The delimiter to use in the split method.

  • textureName String

    The absolute path of the texture.

Returns:

String:

Returns the name of the texture.

_toColor

(
  • value
)
BABYLON.Color3 private

Gets a color from an array.

Parameters:

  • value Array

    An array with three elements that represents a color (RGB).

Returns:

BABYLON.Color3:

Returns a color object which can be used on a BABYLON.Mesh.

_toIndices

(
  • value
)
Array private

Gets an Array of indice from an array.

Parameters:

  • value Array

    An array of array which contains three elements that represents faces.

Returns:

Array:

Returns an array of indices.

applyTransform

(
  • mesh
  • transformation
)
private

Apply transformation to a mesh and sets its parent.

Parameters:

  • mesh BABYLON.Mesh

    The mesh to use.

  • transformation Array

    An array used as a transform matrix (right handed).

applyTransformRecursive

(
  • meshes
  • data
)
private

Apply transformations to a set of meshes recursively.

Parameters:

  • meshes Array

    An array of meshes.

  • data Object

    An object that contains informations about transformations.

build

(
  • json
  • options
  • success
  • fail
)
private

Build all meshes with JSON informations.

Parameters:

  • json Object

    A paresed JSON that contains informations about the model.

  • options Object

    See the docs in the load method.

  • success Function

    See the docs in the Load method.

  • fail Function

    See the docs in the Load method.

generateMaterials

(
  • json
  • textures
  • path
  • backFaceCulling
  • noTexture
  • importedTextures
)
Array private

Generate materials from json data.

Parameters:

  • json Object

    A paresed JSON that contains informations about materials.

  • textures Array

    An array of textures.

  • path String

    The path used for textures.

  • backFaceCulling Boolean

    A flag for enable or disable the backFaceCulling.

  • noTexture Boolean

    A flag to bypass all textures.

  • importedTextures Object

    An object which contains imported textures from the API.

Returns:

Array:

Returns an array of materials.

generateMeshes

(
  • json
  • material
  • [userUniqueName]
)
Array private

Generates meshes from json data.

Parameters:

  • json Object

    A paresed JSON that contains informations about meshes.

  • material Array

    An array of materials.

  • [userUniqueName] Boolean optional

    Sets to true to use a unique name for each meshes which haven't name.

Returns:

Array:

Returns an array of meshes.

generateTextures

(
  • json
)
Array private

Generate textures from json data.

Parameters:

  • json Object

    A paresed JSON that contains informations about textures.

Returns:

Array:

Returns an array of textures.

indexOf

(
  • meshes
  • name
)
Number private

Gets the index of a mesh by its name.

Parameters:

  • meshes Array

    An array of meshes.

  • name String

    The name of the desired mesh.

Returns:

Number:

Returns the index of the mesh in the collection if it exits, otherwise it returns -1.

load

(
  • path
  • options
  • success
  • fail
)
BABYLON.Mesh static

Load a model in JSON format.

Parameters:

  • path String

    The path of the model.

  • options Object

    A set of options: - position => BAYLON.Vector3 - rotation => BAYLON.Vector3 - scaling => BAYLON.Vector3 or Number - backFaceCulling => Boolean - centerGeometry => Boolean - path => String A path to use for texture (by default all textures have a relative path to the model). - importedTexture => Object An dictionary which as the name of the texture as name and a base64 encoded image as value. - noTexture => Boolean Force the loader to not use texture but only colors.

  • success Function

    A function called when the model is fully loaded and ready to use. the model is passed as parameter of the function.

  • fail Function

    A function called if the loading fails.

Returns:

BABYLON.Mesh:

Returns the root mesh which contains all submeshes.