Packagealternativa.engine3d.objects
Classpublic class Mesh
InheritanceMesh Inheritance Object3D
SubclassesBox, GeoSphere, Plane, Skin, SkyBox, Sphere

Poligonal object which consists of vertices and faces built throgh these vertices.

See also

alternativa.engine3d.core.Vertex
alternativa.engine3d.core.Face


Public Properties
 PropertyDefined by
 Inheritedalpha : Number = 1
Alpha transparency value.
Object3D
 InheritedblendMode : String = "normal"
A value from the flash.
Object3D
 InheritedboundMaxX : Number = 1e+22
Right bound of object in its space.
Object3D
 InheritedboundMaxY : Number = 1e+22
Front bound of object in its space.
Object3D
 InheritedboundMaxZ : Number = 1e+22
Top bound of object in its space.
Object3D
 InheritedboundMinX : Number = -1e+22
Left bound of object in its space.
Object3D
 InheritedboundMinY : Number = -1e+22
Back bound of object in its space.
Object3D
 InheritedboundMinZ : Number = -1e+22
Bottom bound of object in its space.
Object3D
  clipping : int = 2
Object clipping mode by camera frustum.
Mesh
 InheritedcolorTransform : ColorTransform = null
A ColorTransform object containing values that universally adjust the colors in the display object.
Object3D
 InheritedconcatenatedMatrix : Matrix3D
A Matrix3D object which is the combined result of transformation matrices of object and all its parens.
Object3D
 InheriteddoubleClickEnabled : Boolean = false
Specifies whether the object receives doubleClick events.
Object3D
  faces : Vector
[read-only] List of face instances.
Mesh
 Inheritedfilters : Array = null
An indexed array that contains each filter object currently associated with the display object.
Object3D
 Inheritedmatrix : Matrix3D
Matrix3D object.
Object3D
 InheritedmouseEnabled : Boolean = true
Specifies whether this object receives mouse messages.
Object3D
 Inheritedname : String
Object name.
Object3D
 Inheritedparent : Object3DContainer
Indicates the Object3DContainer object that contains this display object.
Object3D
 InheritedrotationX : Number = 0
Rotation angle by X axis (in radians).
Object3D
 InheritedrotationY : Number = 0
Rotation angle by Y axis (in radians).
Object3D
 InheritedrotationZ : Number = 0
Rotation angle by Z axis (in radians).
Object3D
 InheritedscaleX : Number = 1
Scale by X axis.
Object3D
 InheritedscaleY : Number = 1
Scale by Y axis.
Object3D
 InheritedscaleZ : Number = 1
Scale by Z axis.
Object3D
  sorting : int = 1
Faces sorting mode.
Mesh
  threshold : Number = 0.01
Geometrical threshold.
Mesh
 InheriteduseHandCursor : Boolean = false
Set this property to true to show "hand" mouse cursor while hovering the object, false otherwise.
Object3D
  vertices : Vector
[read-only] List of vertices instances.
Mesh
 Inheritedvisible : Boolean = true
Whether or not the display object is visible.
Object3D
 Inheritedx : Number = 0
X coordinate.
Object3D
 Inheritedy : Number = 0
Y coordinate.
Object3D
 Inheritedz : Number = 0
Z coordinate.
Object3D
Public Methods
 MethodDefined by
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
Object3D
  
addFace(vertices:Vector, material:Material = null, id:Object = null):Face
Creates and adds new face.
Mesh
  
addFaceByIds(vertexIds:Array, material:Material = null, id:Object = null):Face
Creates and adss face by vertices identifiers.
Mesh
  
addQuadFace(a:Vertex, b:Vertex, c:Vertex, d:Vertex, material:Material = null, id:Object = null):Face
Creates and adds new quad face.
Mesh
  
addTriFace(a:Vertex, b:Vertex, c:Vertex, material:Material = null, id:Object = null):Face
Creates and adds new triangle face.
Mesh
  
addVertex(x:Number, y:Number, z:Number, u:Number = 0, v:Number = 0, id:Object = null):Vertex
Creates and adds new vertex.
Mesh
  
addVerticesAndFaces(vertices:Vector, uvs:Vector, indices:Vector, poly:Boolean = false, material:Material = null):void
Creates and adds vertices and faces created of values supplied vectors.
Mesh
 Inherited
Calculates object bounds in its space.
Object3D
  
calculateNormals(normalize:Boolean = true):void
Calculates normals of faces.
Mesh
  
calculateResolution(textureWidth:int, textureHeight:int, type:int = 1, matrix:Matrix3D = null):Number
Calculates how many units of 3D space correspond to one pixel of texture.
Mesh
  
Returns an object that is an exact copy of the original object.
Mesh
  
containsFace(face:Face):Boolean
Checks if there is a face in the object.
Mesh
  
containsFaceWithId(id:Object):Boolean
Checks if there is a face in the object with indentifier.
Mesh
  
containsVertex(vertex:Vertex):Boolean
Checks if there is a vertex in the object.
Mesh
  
containsVertexWithId(id:Object):Boolean
Checks if there is a vertex in the object with indentifier.
Mesh
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
Object3D
  
getFaceById(id:Object):Face
Returns face by identifier.
Mesh
  
getVertexById(id:Object):Vertex
Returns vertex by identifier.
Mesh
 Inherited
globalToLocal(point:Vector3D):Vector3D
Transforms a point from global space to local spce of the object.
Object3D
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
Object3D
  
intersectRay(origin:Vector3D, direction:Vector3D, exludedObjects:Dictionary = null, camera:Camera3D = null):RayIntersectionData
Searches for the ray intersection.
Mesh
 Inherited
localToGlobal(point:Vector3D):Vector3D
Transforms a point from local space of object to global spce.
Object3D
  
optimizeForDynamicBSP(iterations:int = 1):void
Puts faces in specified sequence to minimize amount of splits in Sorting.
Mesh
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
Object3D
  
Removes face by instance.
Mesh
  
removeFaceById(id:Object):Face
Removes face by identifier.
Mesh
  
Removes face by instance.
Mesh
  
Removes vertex by identifier.
Mesh
  
Sets material to all faces.
Mesh
 Inherited
toString():String
Returns the string presentation of the specified object.
Object3D
  
weldFaces(angleThreshold:Number = 0, uvThreshold:Number = 0, convexThreshold:Number = 0, pairWeld:Boolean = false):void
Weld neighboring faces which form flat convex.
Mesh
  
weldVertices(distanceThreshold:Number = 0, uvThreshold:Number = 0):void
Welds vertices with the same coordinates and UV.
Mesh
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
Object3D
Protected Methods
 MethodDefined by
  
Copies the base properties.
Mesh
Events
 EventSummaryDefined by
 Inherited Dispatched when a user presses and releases the main button of the user's pointing device over the same object.Object3D
 Inherited Dispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same object when that object's doubleClickEnabled flag is set to true.Object3D
 Inherited Dispatched when a user presses the pointing device button over an object.Object3D
 Inherited Dispatched when a user moves the pointing device while it is over an object.Object3D
 Inherited Dispatched when the user moves a pointing device away from an object.Object3D
 Inherited Dispatched when the user moves a pointing device over an object.Object3D
 Inherited Dispatched when a user releases the pointing device button over an object.Object3D
 Inherited Dispatched when a mouse wheel is spun over an object.Object3D
 Inherited Dispatched when the user moves a pointing device away from an object.Object3D
 Inherited Dispatched when the user moves a pointing device over an object.Object3D
Property detail
clippingproperty
public var clipping:int = 2

Object clipping mode by camera frustum. You can use following constants of Clipping class: Clipping.BOUND_CULLING, Clipping.FACE_CULLING, Clipping.FACE_CLIPPING. Default value is Clipping.FACE_CLIPPING.

See also

facesproperty 
faces:Vector  [read-only]

List of face instances.

Implementation
    public function get faces():Vector

See also

sortingproperty 
public var sorting:int = 1

Faces sorting mode. You can use the following constants to set sorting property: Sorting.NONE, Sorting.AVERAGE_Z, Sorting.DYNAMIC_BSP. Default value is Sorting.AVERAGE_Z.

See also

thresholdproperty 
public var threshold:Number = 0.01

Geometrical threshold. It is small quantity where it is possible not to take into account values difference. It is used for temporary BSP-tree building in the Sorting.DYNAMIC_BSP mode. Default value is 0.01.

See also

verticesproperty 
vertices:Vector  [read-only]

List of vertices instances.

Implementation
    public function get vertices():Vector

See also

Method detail
addFace()method
public function addFace(vertices:Vector, material:Material = null, id:Object = null):Face

Creates and adds new face.

Parameters
vertices:VectorVector of instances of vertices.
 
material:Material (default = null)Material.
 
id:Object (default = null)Face identifier.

Returns
FaceNew face.

See also

addFaceByIds()method 
public function addFaceByIds(vertexIds:Array, material:Material = null, id:Object = null):Face

Creates and adss face by vertices identifiers.

Parameters
vertexIds:ArrayVertices identifiers array.
 
material:Material (default = null)Material.
 
id:Object (default = null)Face identifier.

Returns
FaceNew face.

See also

addQuadFace()method 
public function addQuadFace(a:Vertex, b:Vertex, c:Vertex, d:Vertex, material:Material = null, id:Object = null):Face

Creates and adds new quad face.

Parameters
a:VertexVertex.
 
b:VertexVertex.
 
c:VertexVertex.
 
d:VertexVertex.
 
material:Material (default = null)Material.
 
id:Object (default = null)Face identifier.

Returns
FaceNew face.

See also

addTriFace()method 
public function addTriFace(a:Vertex, b:Vertex, c:Vertex, material:Material = null, id:Object = null):Face

Creates and adds new triangle face.

Parameters
a:VertexVertex.
 
b:VertexVertex.
 
c:VertexVertex.
 
material:Material (default = null)Material.
 
id:Object (default = null)Face identifier.

Returns
FaceNew face.

See also

addVertex()method 
public function addVertex(x:Number, y:Number, z:Number, u:Number = 0, v:Number = 0, id:Object = null):Vertex

Creates and adds new vertex.

Parameters
x:NumberX coordinate.
 
y:NumberY coordinate.
 
z:NumberZ coordinate.
 
u:Number (default = 0)U texture coordinate.
 
v:Number (default = 0)V texture coordinate.
 
id:Object (default = null)Vertex identifier.

Returns
VertexNew vertex.

See also

addVerticesAndFaces()method 
public function addVerticesAndFaces(vertices:Vector, uvs:Vector, indices:Vector, poly:Boolean = false, material:Material = null):void

Creates and adds vertices and faces created of values supplied vectors.

Parameters
vertices:VectorVertices coordinates vector. Vertices coordinates are represented as x1, y1, z1, x2, y2, z2 and so on.
 
uvs:VectorTexture coordinates vector corresponding to vertices vector. Texture coordinates are represented as u1, v1, u2, v2 and so on.
 
indices:VectorVector of indices.
 
poly:Boolean (default = false)Option for faces presentation as triangles or polygons. If false then indices will be interpreted as sequence of triangles, i.e. 1,2,3,4,3,2. If true then indices will be interpreted as sequence of polygons with amount of vertices indication, i.e. 3, 1,2,3, 4, 5,4,3,2.
 
material:Material (default = null)Material for all faces.

See also

calculateNormals()method 
public function calculateNormals(normalize:Boolean = true):void

Calculates normals of faces.

Parameters
normalize:Boolean (default = true)Normalization option. If true, then lengths of normals will be equal to one.

See also

calculateResolution()method 
public override function calculateResolution(textureWidth:int, textureHeight:int, type:int = 1, matrix:Matrix3D = null):Number

Calculates how many units of 3D space correspond to one pixel of texture. It is useful for mipmapping.

Parameters
textureWidth:intTexture width.
 
textureHeight:intTexture height.
 
type:int (default = 1)Calculation method: 0 - by first edge, 1 - average value, 2 - max value, 3 - min value.
 
matrix:Matrix3D (default = null)Transformation matrix.

Returns
NumberResolution.
clone()method 
public override function clone():Object3D

Returns an object that is an exact copy of the original object.

Returns
Object3DOriginal object clone.
clonePropertiesFrom()method 
protected override function clonePropertiesFrom(source:Object3D):void

Copies the base properties.

Parameters
source:Object3DSource object.
containsFace()method 
public function containsFace(face:Face):Boolean

Checks if there is a face in the object.

Parameters
face:FaceFace.

Returns
Booleantrue, if there is a face in the object; false otherwise.

See also

containsFaceWithId()method 
public function containsFaceWithId(id:Object):Boolean

Checks if there is a face in the object with indentifier.

Parameters
id:ObjectIdentifier.

Returns
Booleantrue, if there is a face in the object; false otherwise.

See also

containsVertex()method 
public function containsVertex(vertex:Vertex):Boolean

Checks if there is a vertex in the object.

Parameters
vertex:VertexVertex.

Returns
Booleantrue, if there is a vertex in the object; false otherwise.

See also

containsVertexWithId()method 
public function containsVertexWithId(id:Object):Boolean

Checks if there is a vertex in the object with indentifier.

Parameters
id:ObjectIdentifier.

Returns
Booleantrue, if there is a vertex in the object; false otherwise.

See also

getFaceById()method 
public function getFaceById(id:Object):Face

Returns face by identifier.

Parameters
id:ObjectIdentifier.

Returns
FaceFace.

See also

getVertexById()method 
public function getVertexById(id:Object):Vertex

Returns vertex by identifier.

Parameters
id:ObjectIdentifier.

Returns
VertexVertex.

See also

intersectRay()method 
public override function intersectRay(origin:Vector3D, direction:Vector3D, exludedObjects:Dictionary = null, camera:Camera3D = null):RayIntersectionData

Searches for the ray intersection.

Parameters
origin:Vector3DRay origin.
 
direction:Vector3DRay direction.
 
exludedObjects:Dictionary (default = null)The objects that are keys of this dictionary will be exluded from intersection test.
 
camera:Camera3D (default = null)The camera for Sprite3D objects intersection test.

Returns
RayIntersectionDataIntersection test result - RayIntersectionData object. If there is no intersection the value of null will be returned.
optimizeForDynamicBSP()method 
public function optimizeForDynamicBSP(iterations:int = 1):void

Puts faces in specified sequence to minimize amount of splits in Sorting.DYNAMIC_BSP mode.

Parameters
iterations:int (default = 1)Analysis quality option.

See also

removeFace()method 
public function removeFace(face:Face):Face

Removes face by instance.

Parameters
face:FaceFace.

Returns
FaceRemovable face.

See also

removeFaceById()method 
public function removeFaceById(id:Object):Face

Removes face by identifier.

Parameters
id:ObjectIdentifier.

Returns
FaceRemovable face.

See also

removeVertex()method 
public function removeVertex(vertex:Vertex):Vertex

Removes face by instance.

Parameters
vertex:VertexVertex.

Returns
VertexRemovable vertex.

See also

removeVertexById()method 
public function removeVertexById(id:Object):Vertex

Removes vertex by identifier.

Parameters
id:ObjectIdentifier.

Returns
VertexRemovable vertex.

See also

setMaterialToAllFaces()method 
public function setMaterialToAllFaces(material:Material):void

Sets material to all faces.

Parameters
material:MaterialMaterial.

See also

weldFaces()method 
public function weldFaces(angleThreshold:Number = 0, uvThreshold:Number = 0, convexThreshold:Number = 0, pairWeld:Boolean = false):void

Weld neighboring faces which form flat convex. Faces get new digital identifiers after the welding. weldFaces() should be called after weldVertices().

Parameters
angleThreshold:Number (default = 0)Acceptable angle between normals of welding neighboring faces.
 
uvThreshold:Number (default = 0)Acceptable treshold of uv-coordinates to connect welding faces through UV.
 
convexThreshold:Number (default = 0)Quantity that reduce acceptable angle between allied edges of welding faces.
 
pairWeld:Boolean (default = false)Option of welding by pairs.

See also

weldVertices()method 
public function weldVertices(distanceThreshold:Number = 0, uvThreshold:Number = 0):void

Welds vertices with the same coordinates and UV. Coordinates equality is checked taking into account the treshold. Vertices get new digital identifiers after the welding. weldVertices() should be called before weldFaces().

Parameters
distanceThreshold:Number (default = 0)Acceptable coordinates difference.
 
uvThreshold:Number (default = 0)Acceptable UV-coordinates difference.

See also