Packageaway3d.tools
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
  
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
  
duplicate(mesh:Mesh, newName:String):Mesh
[static] Duplicates a Mesh
MeshHelper
  
[static] Inverts the faces of all the Meshes into an ObjectContainer3D
MeshHelper
  
invertFaces(mesh:Mesh):void
[static] Inverts the faces of a Mesh
MeshHelper
  
recenter(mesh:Mesh):void
[static] Recenter geometry, (its pivot is at center of geometry)
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

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
duplicate()method 
public static function duplicate(mesh:Mesh, newName:String):Mesh

Duplicates a Mesh

Parameters

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

Returns
Mesh
invertContainerFaces()method 
public static function invertContainerFaces(obj:ObjectContainer3D):void

Inverts the faces of all the Meshes into an ObjectContainer3D

Parameters

obj:ObjectContainer3D — ObjectContainer3D. The ObjectContainer3D to invert.

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

Inverts the faces of a Mesh

Parameters

mesh:Mesh — Mesh. The Mesh to invert.

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

Recenter geometry, (its pivot is at center of geometry)

Parameters

mesh:Mesh — Mesh. The Mesh to offset