Packageaway3d.tools.commands
Classpublic class Merge
InheritanceMerge Inheritance Object

Class Merge merges two or more static meshes into one.Merge



Public Properties
 PropertyDefined By
  disposeSources : Boolean
Defines if the mesh(es) sources used for the merging are kept or disposed.
Merge
  keepMaterial : Boolean
Defines if mesh2 will be merged using its own material information.
Merge
  objectSpace : Boolean
Defines if mesh2 is merged using its objectSpace.
Merge
Public Methods
 MethodDefined By
  
Merge(keepMaterial:Boolean = false, disposeSources:Boolean = false, objectSpace:Boolean = false)
Merge
  
apply(mesh1:Mesh, mesh2:Mesh):void
Merge 2 meshes into one.
Merge
  
Merges all the children of a container as one single Mesh.
Merge
  
applyToMeshes(receiver:Mesh, meshes:Vector.<Mesh>):Mesh
Merges all the meshes found into the Vector.<Mesh> parameter with the receiver Mesh.
Merge
Property Detail
disposeSourcesproperty
disposeSources:Boolean

Defines if the mesh(es) sources used for the merging are kept or disposed.


Implementation
    public function get disposeSources():Boolean
    public function set disposeSources(value:Boolean):void
keepMaterialproperty 
keepMaterial:Boolean

Defines if mesh2 will be merged using its own material information.


Implementation
    public function get keepMaterial():Boolean
    public function set keepMaterial(value:Boolean):void
objectSpaceproperty 
objectSpace:Boolean

Defines if mesh2 is merged using its objectSpace.


Implementation
    public function get objectSpace():Boolean
    public function set objectSpace(value:Boolean):void
Constructor Detail
Merge()Constructor
public function Merge(keepMaterial:Boolean = false, disposeSources:Boolean = false, objectSpace:Boolean = false)

Parameters
keepMaterial:Boolean (default = false) — [optional] Boolean. Defines if the merged object uses the mesh1 material information or keeps its material(s). Default is false. If set to false and receiver object has multiple materials, the last material found in mesh1 submeshes is applied to mesh2 submeshes.
 
disposeSources:Boolean (default = false) — [optional] Boolean. Defines if mesh2 (or sources meshes in case applyToContainer is used) are kept untouched or disposed. Default is false. If keepMaterial is true, only geometry and eventual ObjectContainers3D are cleared from memory.
 
objectSpace:Boolean (default = false) — [optional] Boolean. Defines if mesh2 is merge using its objectSpace or worldspace. Default is false.
Method Detail
apply()method
public function apply(mesh1:Mesh, mesh2:Mesh):void

Merge 2 meshes into one. It is recommand to use apply when 2 meshes are to be merged. If more need to be merged, use either applyToMeshes or applyToContainer methods.

Parameters

mesh1:Mesh — Mesh. The receiver object that will hold both meshes information.
 
mesh2:Mesh — Mesh. The Mesh object to be merge with mesh1.

applyToContainer()method 
public function applyToContainer(object:ObjectContainer3D, name:String):Mesh

Merges all the children of a container as one single Mesh. The first Mesh child encountered becomes the receiver. This is mesh that is returned. If no Mesh object is found, class returns null.

Parameters

object:ObjectContainer3D — The ObjectContainer3D holding meshes to merge as one mesh.
 
name:String — [optional] As the class picks the first mesh it finds, the name is applied to the merged mesh.

Returns
Mesh — The merged Mesh instance renamed to the name parameter if one was provided.
applyToMeshes()method 
public function applyToMeshes(receiver:Mesh, meshes:Vector.<Mesh>):Mesh

Merges all the meshes found into the Vector.<Mesh> parameter with the receiver Mesh.

Parameters

receiver:Mesh — Mesh. The Mesh receiver.
 
meshes:Vector.<Mesh> — Vector.<Mesh>. A series of Meshes to be merged with the reciever mesh.

Returns
Mesh — The merged receiver Mesh instance.