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

Static methods

staticapplyPosition(mesh:Mesh, dx:Float, dy:Float, dz:Float):Void

Applys an offset to a mesh at vertices level

Parameters:

mesh

Mesh. The Mesh to offset

dx

Number. The offset along the x axis

dy

Number. The offset along the y axis

dz

Number. The offset along the z axis

staticapplyRotations(mesh:Mesh):Void

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

Parameters:

mesh

Mesh. The Mesh to alter

staticapplyRotationsContainer(obj:ObjectContainer3D):Void

Applys the rotation values of each mesh found into an ObjectContainer3D

Parameters:

obj

ObjectContainer3D. The ObjectContainer3D to alter

@:value({ parent : null })staticapplyScales(mesh:Mesh, scaleX:Float, scaleY:Float, scaleZ:Float, ?parent:ObjectContainer3D):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. The Mesh to rescale

scaleX

Number. The scale factor to apply on all vertices x values.

scaleY

Number. The scale factor to apply on all vertices y values.

scaleZ

Number. The scale factor to apply on all vertices z values.

parent

ObjectContainer3D. If a parent is set, the position of children is also scaled

@:value({ parent : null })staticapplyScalesContainer(obj:ObjectContainer3D, scaleX:Float, scaleY:Float, scaleZ:Float, ?parent:ObjectContainer3D):Void

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

Parameters:

obj

ObjectContainer3D. The ObjectContainer3D to alter

scaleX

Number. The scale factor to apply on all vertices x values.

scaleY

Number. The scale factor to apply on all vertices y values.

scaleZ

Number. The scale factor to apply on all vertices z values.

staticboundingRadius(mesh:Mesh):Float

Returns the boundingRadius of an Entity of a Mesh.

Parameters:

mesh

Mesh. The mesh to get the boundingRadius from.

staticboundingRadiusContainer(container:ObjectContainer3D):Float

Returns the boundingRadius of a ObjectContainer3D

Parameters:

container

ObjectContainer3D. The ObjectContainer3D and its children to get the boundingRadius from.

@:value({ useCompactSubGeometry : true, useDefaultMap : true, shareVertices : true, material : null, name : "", uvs : null })staticbuild(vertices:Vector<Float>, indices:Vector<UInt>, ?uvs:Vector<Float>, name:String = "", ?material:MaterialBase, shareVertices:Bool = true, useDefaultMap:Bool = true, useCompactSubGeometry:Bool = true):Mesh

Build a Mesh from Vectors @ returns Mesh

Parameters:

vertices

Vector.<Number>. The vertices Vector.<Number>, must hold a multiple of 3 numbers.

indices

Vector.<uint>. The indices Vector.<uint>, holding the face order

uvs

[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

[optional] String. new name for the generated mesh. Default = "";

material

[optional] MaterialBase. new name for the duplicated mesh. Default = null;

shareVertices

[optional] Boolean. Defines if the vertices are shared or not. When true surface gets a smoother appearance when exposed to light. Default = true;

useDefaultMap

[optional] Boolean. Defines if the mesh receives the default engine map if no material is passes. Default = true;

@:value({ newName : "" })staticclone(mesh:Mesh, newName:String = ""):Mesh

Clones a Mesh @ returns Mesh

Parameters:

mesh

Mesh. The mesh to clone

newname

[optional] String. new name for the duplicated mesh. Default = "";

@:value({ invertU : false })staticinvertFaces(mesh:Mesh, invertU:Bool = false):Void

Inverts the faces of a Mesh

Parameters:

mesh

Mesh. The Mesh to invert.

invertUV

Boolean. If the uvs are inverted too. Default is false;

staticinvertFacesInContainer(obj:ObjectContainer3D):Void

Inverts the faces of all the Meshes into an ObjectContainer3D

Parameters:

obj

ObjectContainer3D. The ObjectContainer3D to invert.

@:value({ keepPosition : true })staticrecenter(mesh:Mesh, keepPosition:Bool = true):Void

Recenter geometry

Parameters:

mesh

Mesh. The Mesh to recenter in its own objectspace

keepPosition

Boolean. KeepPosition applys the offset to the object position. Object is "visually" at same position.

@:value({ keepPosition : true })staticrecenterContainer(obj:ObjectContainer3D, keepPosition:Bool = true):Void

Recenter geometry of all meshes found into container

Parameters:

mesh

Mesh. The Mesh to recenter in its own objectspace

keepPosition

Boolean. KeepPosition applys the offset to the object position. Object is "visually" at same position.

@:value({ disposeSource : false })staticsplitMesh(mesh:Mesh, disposeSource:Bool = false):Vector<Mesh>

Splits the subgeometries of a given mesh in a series of new meshes @ returns Vector..<Mesh>

Parameters:

mesh

Mesh. The mesh to split in a series of independant meshes from its subgeometries.

disposeSource

Boolean. If the mesh source must be destroyed after the split. Default is false;