Packageaway3d.tools.helpers
Classpublic class MeshHelper
InheritanceMeshHelper Inheritance Object

Helper Class for the Mesh object MeshHelper A series of methods usually usefull for mesh manipulations



Public Methods
 MethodDefined By
  
applyPosition(mesh:Mesh, dx:Number, dy:Number, dz:Number):void
[static] Applys an offset to a mesh at vertices level
MeshHelper
  
applyRotations(mesh:Mesh):void
[static] Applys the rotation values of a mesh in object space and resets rotations to zero.
MeshHelper
  
[static] Applys the rotation values of each mesh found into an ObjectContainer3D
MeshHelper
  
applyScales(mesh:Mesh, scaleX:Number, scaleY:Number, scaleZ:Number, parent:ObjectContainer3D = null):void
[static] Applys the scaleX, scaleY and scaleZ scale factors to the mesh vertices.
MeshHelper
  
applyScalesContainer(obj:ObjectContainer3D, scaleX:Number, scaleY:Number, scaleZ:Number, parent:ObjectContainer3D = null):void
[static] Applys the scale properties values of each mesh found into an ObjectContainer3D
MeshHelper
  
boundingRadius(mesh:Mesh):Number
[static] Returns the boundingRadius of an Entity of a Mesh.
MeshHelper
  
[static] Returns the boundingRadius of a ObjectContainer3D
MeshHelper
  
build(vertices:Vector.<Number>, indices:Vector.<uint>, uvs:Vector.<Number> = null, name:String, material:MaterialBase = null, shareVertices:Boolean = true, useDefaultMap:Boolean = true):Mesh
[static] Build a Mesh from Vectors
MeshHelper
  
clone(mesh:Mesh, newName:String):Mesh
[static] Clones a Mesh
MeshHelper
  
invertFaces(mesh:Mesh, invertU:Boolean = false):void
[static] Inverts the faces of a Mesh
MeshHelper
  
[static] Inverts the faces of all the Meshes into an ObjectContainer3D
MeshHelper
  
recenter(mesh:Mesh, keepPosition:Boolean = true):void
[static] Recenter geometry
MeshHelper
  
recenterContainer(obj:ObjectContainer3D, keepPosition:Boolean = true):void
[static] Recenter geometry of all meshes found into container
MeshHelper
  
splitMesh(mesh:Mesh, disposeSource:Boolean = false):Vector.<Mesh>
[static] Splits the subgeometries of a given mesh in a series of new meshes
MeshHelper
Method Detail
applyPosition()method
public static function applyPosition(mesh:Mesh, dx:Number, dy:Number, dz:Number):void

Applys an offset to a mesh at vertices level

Parameters

mesh:Mesh — Mesh. The Mesh to offset
 
dx:Number — Number. The offset along the x axis
 
dy:Number — Number. The offset along the y axis
 
dz:Number — Number. The offset along the z axis

applyRotations()method 
public static function applyRotations(mesh:Mesh):void

Applys the rotation values of a mesh in object space and resets rotations to zero.

Parameters

mesh:Mesh — Mesh. The Mesh to alter

applyRotationsContainer()method 
public static function applyRotationsContainer(obj:ObjectContainer3D):void

Applys the rotation values of each mesh found into an ObjectContainer3D

Parameters

obj:ObjectContainer3D — ObjectContainer3D. The ObjectContainer3D to alter

applyScales()method 
public static function applyScales(mesh:Mesh, scaleX:Number, scaleY:Number, scaleZ:Number, parent:ObjectContainer3D = null):void

Applys the scaleX, scaleY and scaleZ scale factors to the mesh vertices. Resets the mesh scaleX, scaleY and scaleZ properties to 1;

Parameters

mesh:Mesh — Mesh. The Mesh to rescale
 
scaleX:Number — Number. The scale factor to apply on all vertices x values.
 
scaleY:Number — Number. The scale factor to apply on all vertices y values.
 
scaleZ:Number — Number. The scale factor to apply on all vertices z values.
 
parent:ObjectContainer3D (default = null) — ObjectContainer3D. If a parent is set, the position of children is also scaled

applyScalesContainer()method 
public static function applyScalesContainer(obj:ObjectContainer3D, scaleX:Number, scaleY:Number, scaleZ:Number, parent:ObjectContainer3D = null):void

Applys the scale properties values of each mesh found into an ObjectContainer3D

Parameters

obj:ObjectContainer3D — ObjectContainer3D. The ObjectContainer3D to alter
 
scaleX:Number — Number. The scale factor to apply on all vertices x values.
 
scaleY:Number — Number. The scale factor to apply on all vertices y values.
 
scaleZ:Number — Number. The scale factor to apply on all vertices z values.
 
parent:ObjectContainer3D (default = null)

boundingRadius()method 
public static function boundingRadius(mesh:Mesh):Number

Returns the boundingRadius of an Entity of a Mesh.

Parameters

mesh:Mesh — Mesh. The mesh to get the boundingRadius from.

Returns
Number
boundingRadiusContainer()method 
public static function boundingRadiusContainer(container:ObjectContainer3D):Number

Returns the boundingRadius of a ObjectContainer3D

Parameters

container:ObjectContainer3D — ObjectContainer3D. The ObjectContainer3D and its children to get the boundingRadius from.

Returns
Number
build()method 
public static function build(vertices:Vector.<Number>, indices:Vector.<uint>, uvs:Vector.<Number> = null, name:String, material:MaterialBase = null, shareVertices:Boolean = true, useDefaultMap:Boolean = true):Mesh

Build a Mesh from Vectors

Parameters

vertices:Vector.<Number> — Vector.<Number>. The vertices Vector.<Number>, must hold a multiple of 3 numbers.
 
indices:Vector.<uint> — Vector.<uint>. The indices Vector.<uint>, holding the face order
 
uvs:Vector.<Number> (default = null) — [optional] Vector.<Number>. The uvs Vector, must hold a series of numbers of (vertices.length/3 2) entries. If none is set, default uv's are applied if no uv's are defined, default uv mapping is set.
 
name:String — [optional] String. new name for the generated mesh. Default = "";
 
material:MaterialBase (default = null) — [optional] MaterialBase. new name for the duplicated mesh. Default = null;
 
shareVertices:Boolean (default = true) — [optional] Boolean. Defines if the vertices are shared or not. When true surface gets a smoother appearance when exposed to light. Default = true;
 
useDefaultMap:Boolean (default = true) — [optional] Boolean. Defines if the mesh receives the default engine map if no material is passes. Default = true;

Returns
Mesh
clone()method 
public static function clone(mesh:Mesh, newName:String):Mesh

Clones a Mesh

Parameters

mesh:Mesh — Mesh. The mesh to clone
 
newName:String — [optional] String. new name for the duplicated mesh. Default = "";

Returns
Mesh
invertFaces()method 
public static function invertFaces(mesh:Mesh, invertU:Boolean = false):void

Inverts the faces of a Mesh

Parameters

mesh:Mesh — Mesh. The Mesh to invert.
 
invertU:Boolean (default = false) — Boolean. If the uvs are inverted too. Default is false;

invertFacesInContainer()method 
public static function invertFacesInContainer(obj:ObjectContainer3D):void

Inverts the faces of all the Meshes into an ObjectContainer3D

Parameters

obj:ObjectContainer3D — ObjectContainer3D. The ObjectContainer3D to invert.

recenter()method 
public static function recenter(mesh:Mesh, keepPosition:Boolean = true):void

Recenter geometry

Parameters

mesh:Mesh — Mesh. The Mesh to recenter in its own objectspace
 
keepPosition:Boolean (default = true) — Boolean. KeepPosition applys the offset to the object position. Object is "visually" at same position.

recenterContainer()method 
public static function recenterContainer(obj:ObjectContainer3D, keepPosition:Boolean = true):void

Recenter geometry of all meshes found into container

Parameters

obj:ObjectContainer3D — Mesh. The Mesh to recenter in its own objectspace
 
keepPosition:Boolean (default = true) — Boolean. KeepPosition applys the offset to the object position. Object is "visually" at same position.

splitMesh()method 
public static function splitMesh(mesh:Mesh, disposeSource:Boolean = false):Vector.<Mesh>

Splits the subgeometries of a given mesh in a series of new meshes

Parameters

mesh:Mesh — Mesh. The mesh to split in a series of independant meshes from its subgeometries.
 
disposeSource:Boolean (default = false) — Boolean. If the mesh source must be destroyed after the split. Default is false;

Returns
Vector.<Mesh>