Loader3D can load any file format that Away3D supports (or for which a third-party parser has been plugged in) and be added directly to the scene. As assets are encountered they are added to the Loader3D container. Assets that can not be displayed in the scene graph (e.g. unused bitmaps/materials/skeletons etc) will be ignored.

This provides a fast and easy way to load models (no need for event listeners) but is not very versatile since many types of assets are ignored.

Loader3D by default uses the Asset3DLibrary to load all assets, which means that they also ends up in the library. To circumvent this, Loader3D can be configured to not use the Asset3DLibrary in which case it will use the AssetLoader directly.

See also:

  • away3d.loaders.AssetLoader

  • away3d.library.Asset3DLibrary

Static methods

staticenableParser(parserClass:Class<ParserBase>):Void

Enables a specific parser. When no specific parser is set for a loading/parsing opperation, loader3d can autoselect the correct parser to use. A parser must have been enabled, to be considered when autoselecting the parser.

Parameters:

parserClass

The parser class to enable.

See also:

  • away3d.loaders.parsers.Parsers

staticenableParsers(parserClasses:Array<Dynamic>):Void

Enables a list of parsers. When no specific parser is set for a loading/parsing opperation, loader3d can autoselect the correct parser to use. A parser must have been enabled, to be considered when autoselecting the parser.

Parameters:

parserClasses

A Vector of parser classes to enable.

See also:

  • away3d.loaders.parsers.Parsers

Constructor

@:value({ asset3DLibraryId : null, useAsset3DLibrary : true })new(useAsset3DLibrary:Bool = true, ?asset3DLibraryId:String)

Methods

@:value({ parser : null, ns : null, context : null })load(req:URLRequest, ?context:AssetLoaderContext, ?ns:String, ?parser:ParserBase):AssetLoaderToken

Loads a file and (optionally) all of its dependencies.

Parameters:

req

The URLRequest object containing the URL of the file to be loaded.

context

An optional context object providing additional parameters for loading

ns

An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

parser

An optional parser object for translating the loaded data into a usable resource. If not provided, AssetLoader will attempt to auto-detect the file type.

@:value({ parser : null, ns : null, context : null })loadData(data:Dynamic, ?context:AssetLoaderContext, ?ns:String, ?parser:ParserBase):AssetLoaderToken

Loads a resource from already loaded data.

Parameters:

data

The data object containing all resource information.

context

An optional context object providing additional parameters for loading

ns

An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

parser

An optional parser object for translating the loaded data into a usable resource. If not provided, AssetLoader will attempt to auto-detect the file type.

stopLoad():Void

Stop the current loading/parsing process.

Inherited Variables

Defined by ObjectContainer3D

read onlyassetType:String

read onlyinverseSceneTransform:Matrix3D

read onlymaxX:Float

read onlymaxY:Float

read onlymaxZ:Float

read onlyminX:Float

read onlyminY:Float

read onlyminZ:Float

read onlynumChildren:Int

read onlyscenePosition:Vector3D

read onlysceneTransform:Matrix3D

visible:Bool

Defined by Object3D

read onlybackVector:Vector3D

read onlydownVector:Vector3D

eulers:Vector3D

extra:Dynamic

An object that can contain any extra data.

read onlyforwardVector:Vector3D

read onlyleftVector:Vector3D

pivotPoint:Vector3D

position:Vector3D

read onlyrightVector:Vector3D

rotationX:Float

rotationY:Float

rotationZ:Float

scaleX:Float

scaleY:Float

scaleZ:Float

transform:Matrix3D

read onlyupVector:Vector3D

x:Float

y:Float

z:Float

Defined by NamedAssetBase

read onlyassetFullPath:Array<Dynamic>

read onlyassetNamespace:String

id:String

name:String

read onlyoriginalName:String

Inherited Methods

Defined by ObjectContainer3D

addChild(child:ObjectContainer3D):ObjectContainer3D

Adds a child ObjectContainer3D to the current object. The child's transformation will become relative to the current object's transformation.

Parameters:

child

The object to be added as a child.

Returns:

A reference to the added child object.

addChildren(childarray:Vector<ObjectContainer3D>):Void

Adds an array of 3d objects to the scene as children of the container

Parameters:

...childarray

An array of 3d objects to be added

clone():Object3D

Clones this ObjectContainer3D instance along with all it's children, and returns the result (which will be a copy of this container, containing copies of all it's children.)

dispatchEvent(event:Event):Bool

@inheritDoc

dispose():Void

@inheritDoc

disposeWithChildren():Void

Disposes the current ObjectContainer3D including all of its children. This is a merely a convenience method.

getChildAt(index:Int):ObjectContainer3D

Retrieves the child object at the given index.

Parameters:

index

The index of the object to be retrieved.

Returns:

The child object at the given index.

@:value({ upAxis : null })lookAt(target:Vector3D, ?upAxis:Vector3D):Void

@inheritDoc

removeChild(child:ObjectContainer3D):Void

Removes a 3d object from the child array of the container

Parameters:

child

The 3d object to be removed

Throws:

Error

ObjectContainer3D.removeChild(null)

removeChildAt(index:Int):Void

Removes a 3d object from the child array of the container

Parameters:

index

Index of 3d object to be removed

Defined by Object3D

disposeAsset():Void

@inheritDoc

@:value({ v : null })getPosition(?v:Vector3D):Vector3D

Defines the position of the 3d object, relative to the local coordinates of the parent ObjectContainer3D. @return

Parameters:

v

the destination Vector3D

moveBackward(distance:Float):Void

Moves the 3d object backwards along it's local z axis

Parameters:

distance

The length of the movement

moveDown(distance:Float):Void

Moves the 3d object backwards along it's local y axis

Parameters:

distance

The length of the movement

moveForward(distance:Float):Void

Moves the 3d object forwards along it's local z axis

Parameters:

distance

The length of the movement

moveLeft(distance:Float):Void

Moves the 3d object backwards along it's local x axis

Parameters:

distance

The length of the movement

movePivot(dx:Float, dy:Float, dz:Float):Void

Moves the local point around which the object rotates.

Parameters:

dx

The amount of movement along the local x axis.

dy

The amount of movement along the local y axis.

dz

The amount of movement along the local z axis.

moveRight(distance:Float):Void

Moves the 3d object forwards along it's local x axis

Parameters:

distance

The length of the movement

moveTo(dx:Float, dy:Float, dz:Float):Void

Moves the 3d object directly to a point in space

Parameters:

dx

The amount of movement along the local x axis.

dy

The amount of movement along the local y axis.

dz

The amount of movement along the local z axis.

moveUp(distance:Float):Void

Moves the 3d object forwards along it's local y axis

Parameters:

distance

The length of the movement

pitch(angle:Float):Void

Rotates the 3d object around it's local x-axis

Parameters:

angle

The amount of rotation in degrees

roll(angle:Float):Void

Rotates the 3d object around it's local z-axis

Parameters:

angle

The amount of rotation in degrees

rotateTo(ax:Float, ay:Float, az:Float):Void

Rotates the 3d object directly to a euler angle

Parameters:

ax

The angle in degrees of the rotation around the x axis.

ay

The angle in degrees of the rotation around the y axis.

az

The angle in degrees of the rotation around the z axis.

scale(value:Float):Void

Appends a uniform scale to the current transformation.

Parameters:

value

The amount by which to scale.

translate(axis:Vector3D, distance:Float):Void

Moves the 3d object along a vector by a defined length

Parameters:

axis

The vector defining the axis of movement

distance

The length of the movement

yaw(angle:Float):Void

Rotates the 3d object around it's local y-axis

Parameters:

angle

The amount of rotation in degrees

Defined by NamedAssetBase

assetPathEquals(name:String, ns:String):Bool

@:value({ overrideOriginal : true, ns : null })resetAssetPath(name:String, ?ns:String, overrideOriginal:Bool = true):Void