| Package | alternativa.engine3d.loaders |
| Class | public class ParserOBJ |
content property will contain all objects. The property materialFileNames will contain names of material library files.
Following OBJ commands are supported:
| Command | Description | Action |
|---|---|---|
| o object_name | Definition of a new object with name object_name | If there were defined faces for current object, command creates new object with given name, otherwise current object just changes name to given one. |
| v x y z | Definition of vertex with x y z coordinates | Vertex is put in general list of scene vertices for further usage |
| vt u [v] | Defining texture vertex with u v coordinates | Vertex is put to general texture vertices list for further usage |
| f v0[/vt0] v1[/vt1] ... vN[/vtN] | Defining face, which consist of given vertices and optional texture coordinates for vertices. | Face is added to a current active object. If there is an active material, face is added to surface of a current object, corresponding to a current material. |
| usemtl material_name | Set current material with name material_name | From the moment of setting current material, all the faces being created are put into current surface, corresponding to this material and having identifier equal to it's name. |
| mtllib file1 file2 ... | Declaration of material library files | File names are stored in the materialFileNames property. |
| Property | Defined by | ||
|---|---|---|---|
| content : Object3D
[read-only] This property contains all objects defined in OBJ data that was parsed by the
parse method. | ParserOBJ | ||
| materialFileNames : Array [read-only] This property contains a list of material library files defined in OBJ data that was parsed by the
parse method. | ParserOBJ | ||
| mobility : int The value of the
mobility property of 3d objects. | ParserOBJ | ||
| objectsAsGroups : Boolean If
true, then objects will be recognized by keyword "g" instead of "o". | ParserOBJ | ||
| rotateModel : Boolean If
true, the loaded objects will be rotated around X axis by 90 degrees. | ParserOBJ | ||
| scale : Number The scaling coefficient wich is applied to all loaded objects.
| ParserOBJ | ||
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new instance of the class.
| ParserOBJ | ||
|
parse(data:String):void
Parses specified OBJ data.
| ParserOBJ | ||
| content | property |
content:Object3D [read-only]This property contains all objects defined in OBJ data that was parsed by the parse method.
public function get content():Object3D
| materialFileNames | property |
materialFileNames:Array [read-only]This property contains a list of material library files defined in OBJ data that was parsed by the parse method.
public function get materialFileNames():Array
| mobility | property |
mobility:int [read-write]The value of the mobility property of 3d objects.
The default value is 0.
public function get mobility():int
public function set mobility(value:int):void
See also
| objectsAsGroups | property |
objectsAsGroups:Boolean [read-write]If true, then objects will be recognized by keyword "g" instead of "o".
The default value is false.
public function get objectsAsGroups():Boolean
public function set objectsAsGroups(value:Boolean):void
| rotateModel | property |
rotateModel:Boolean [read-write]If true, the loaded objects will be rotated around X axis by 90 degrees.
The default value is false.
public function get rotateModel():Boolean
public function set rotateModel(value:Boolean):void
| scale | property |
scale:Number [read-write]The scaling coefficient wich is applied to all loaded objects.
The default value is 1.
public function get scale():Number
public function set scale(value:Number):void
| ParserOBJ | () | constructor |
public function ParserOBJ()Creates a new instance of the class.
| parse | () | method |
public function parse(data:String):voidParses specified OBJ data. After parsing have been completed, the content property will contain 3d objects and the materialFileNames will contain names of material library files.
data:String — OBJ data |