Packageaway3d.loaders
Classpublic class Obj
InheritanceObj Inheritance AbstractParser Inheritance flash.events.EventDispatcher

File loader for the OBJ file format.

note: Multiple objects support and autoload mtls are supported since Away v 2.1.
Class tested with the following 3D apps:
- Strata CX mac 5.5
- Biturn ver 0.87b4 PC
- LightWave 3D OBJ Export v2.1 PC
- Max2Obj Version 4.0 PC
- AC3D 6.2.025 mac
- Carrara (file provided)
- Hexagon (file provided)
- geometry supported tags: f,v,vt, g
- geometry unsupported tags:vn,ka, kd r g b, kd, ks r g b,ks,ke r g b,ke,d alpha,d,tr alpha,tr,ns s,ns,illum n,illum,map_Ka,map_Bump
- mtl unsupported tags: kd,ka,ks,ns,tr

export from apps as polygon group or mesh as .obj file.
added support for 3dmax negative vertexes references

Public Properties
 PropertyDefined by
 Inheritedcontainer : Object3D
3d container object used for storing the parsed 3d object.
AbstractParser
  mesh : Mesh
Obj
 InheritedparsedChunks : int
Returns the total number of data chunks parsed
AbstractParser
 InheritedparseTimeout : int
Defines a timeout period for file parsing (in milliseconds).
AbstractParser
 InheritedtotalChunks : int
Returns the total number of data chunks available
AbstractParser
Protected Properties
 PropertyDefined by
 Inheritedini : Init
Instance of the Init object used to hold and parse default property values specified by the initialiser object in the parser constructor.
AbstractParser
Public Methods
 MethodDefined by
  
Obj
(init:Object = null)
Creates a new Obj object.
Obj
 Inherited
addOnError(listener:Function):void
Default method for adding a parseError event listener
AbstractParser
 Inherited
addOnProgress(listener:Function):void
Default method for adding a parseProgress event listener
AbstractParser
 Inherited
addOnSuccess(listener:Function):void
Default method for adding a parseSuccess event listener
AbstractParser
  
load(url:String, init:Object = null):Loader3D
[static] Loads and parses a obj file into a 3d mesh object.
Obj
  
parse(data:*, init:Object = null):Object3D
[static] Creates a 3d mesh object from the raw ascii data of a obj file.
Obj
 Inherited
removeOnError(listener:Function):void
Default method for removing a parseError event listener
AbstractParser
 Inherited
removeOnProgress(listener:Function):void
Default method for removing a parseProgress event listener
AbstractParser
 Inherited
removeOnSuccess(listener:Function):void
Default method for removing a parseSuccess event listener
AbstractParser
Events
 EventSummaryDefined by
 Inherited Dispatched when the 3d object parser fails to parse a file.AbstractParser
 Inherited Dispatched when the 3d object parser progresses by one chunk.AbstractParser
 Inherited Dispatched when the 3d object parser completes a file parse successfully.AbstractParser
Property detail
meshproperty
public var mesh:Mesh
Constructor detail
Obj()constructor
public function Obj(init:Object = null)Parameters
init:Object (default = null) — [optional] An initialisation object for specifying default instance properties.
Init Parameters
 mtlPath:String (default = "")
 scaling:Number (default = 1)

See also

Method detail
load()method
public static function load(url:String, init:Object = null):Loader3D

Loads and parses a obj file into a 3d mesh object.

Parameters
url:String — The url location of the file to load.
 
init:Object (default = null) — [optional] An initialisation object for specifying default instance properties.

Returns
Loader3D — A 3d loader object that can be used as a placeholder in a scene while the file is loading.
parse()method 
public static function parse(data:*, init:Object = null):Object3D

Creates a 3d mesh object from the raw ascii data of a obj file.

Parameters
data:* — The ascii data of a loaded file.
 
init:Object (default = null) — [optional] An initialisation object for specifying default instance properties.

Returns
Object3D — A 3d mesh object representation of the obj file.
Wiki link
Click to go to the wiki page for 'away3d.loaders.Obj'

Code examples

Comments