Mesh

Return to Introduction  Previous page  Next page

A mesh is defined in a 3D scene and the same one can be referred to any number of times by world objects.

 

Properties

 

materials

A collection of all the named materials in the mesh file.

lodOrigin

A Vector that determines the origin for LOD calculations.

defaultScript

A string containing the script that will be used for all new objects that use this mesh.

title

A string descriptive title of the mesh.

tags

A string containing all the tags defined by the user for the mesh (comma separated).

 

Methods

 

loadFromFile(filename, inBackground)

Changes the mesh by loading a new file from disk or from a URL.  The inBackground property is a boolean value that when true will not interrupt the playback and instead load the mesh during idle time (defaults to false).  You can check on the load progress with system.getLoadProgress(filename).

materialsGetArray()

Returns all the material ids as an Array of Material objects.

subgroupAdd(name)

Adds a new subgroup into the root of the mesh and gives it an optional name.  Returns a Subgroup class or null if failed.

materialAdd(name)

Adds a new material into the mesh and gives the name supplied.  Returns a Material class or null if failed.

 

Examples

 

meshes.cube.materials.facemat.ambient = new Color(1.0,1.0,1.0);  // set the facemat material in 'cube' mesh.

 

meshes.cube.loadFromFile("c:\\demo\\mymesh.x"); // Changes the mesh file of the 'cube' mesh to a new one from disk.

meshes.cube.loadFromFile("http://www.dxstudio.com/examples/wooden_cart.dxmesh.zip"); // Changes the mesh file of the 'cube' mesh to a new one from a URL

 

See Also

 

Script Reference



Copyright ©2004 Worldweaver Ltd. DX Studio Home