Yage3D.net
 

yage.resource.collada

Authors:
Eric Poggel

License:
LGPL v3

class Collada ;
Collada loads and parses collada 3d model files and can convert their contents to the data structures used by Yage. This does not yet support the full Collada specification, but has been somewhat tested against Collada files from Blender and Milkshape 3D.

If any error occurs during parsing, an XmlException will be thrown. ResourceException will be thrown on errors loading external resources.

See Also:


http:
//khronos.org/collada

Example:
 Collada c = new Collada("someFile.dae");
 Material m = c.getMaterialById("material1");
 Geometry g = c.getMergedGeometry();


this(char[] filename);
Params:
char[] filename path to the collada file to load

this(char[] xml, char[] path);
Create and parse a new Collada file. Either filename or xml must be specified, but not both.

Params:
char[] xml Contents of a collada file.
char[] path Look for resources relative to this path.

Geometry getGeometryById (char[] id);
Geometry getGeometryById (char[] id, bool calledByGetMerged, out int[] vertexRemap);
Params:
char[] id
calledByGetMerged
vertexRemap Vertex indices are changed during loading. This is a map of their new indices back to their old ones.

Returns:


Material getMaterialById (char[] id);
Get a yage material from the Collada file by its id. This uses ResourceManager.material internally, so subsequent calls will return an already loaded Material.

These are Yage-specific notes for loading Collada materials:
  • profile_COMMON is read, any other profiles are ignored.
  • Trancparency opaque attributes of RGB_ONE are mapped to MaterialPass.Blend.ADD, RGB_ZERO is mapped to MaterialPass.Blend.MULTIPLY. Otherwise, AVERAGE or NONE are used depending on whether any transparency is specified or if the material has an alpha channel.
  • If the first child of profile_COMMON is <phong>, then A shader will be created to enable phong shading. If it's <lambert>, then flat shading from the fixed function pipeline will be used. Otherwise fixed-function gourard shading will be used.
  • The unofficial <phong><bump> texture is used for a normal texture, if present. A specular map will be used from the alpha channel, if present. See http://www.feelingsoftware.com/uploads/documents/ColladaMax.pdf, section 6.


Model getMergedGeometry ();
Get all geometry from the file merged into a single Yage Model.. This is usually the desired behavior when loading a collada file as a model.

Unlike getGeometryById, this takes into account the file's asset/up_axis.

Joint[] getJointsById (char[] id);


JointInfluence[][] getJointInfluencesByControllerId (char[] id, Model model, int[] vertexRemap);
Params:
char[] id
Model model A model with the joints and vertex arrays previously populated.

Returns:
An array the same length as the model's vertices, with each sub array a list of the joints that influence that vertex.

Texture getTextureById (char[] id);
Get a yage Texture from the Collada file by its id. This uses ResourceManager.texture internally, so subsequent calls will return an already loaded Texture.

These are Yage-specific notes for loading Collada textures:
  • An image's value determines whether texture compression is used. LOW (or not specified at all): 8 byte channels, texture compression

    MID:
    8 byte channels, no compression

    HIGH:
    16 bit float (not supported yet)

    MAX:
    32 bit float (not supported yet)


  • class XMLException : yage.core.object2.ResourceException;
    Any Collada loading errors will throw this exception.

    Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
    Documentation generated with CandyDoc on Wed Aug 11 11:14:28 2010