Closed dimumurray closed 10 years ago
Hey Yeah. I should fix this.
To clear this:
There is SubMesh and there is SubGeometry.
A Mesh is a visible instance on the screen. A Geometry is a object that holds Geometry-data needed by the renderer.
A Mesh references a Geometry. Multiple Meshes can reference the same Geometry.
To allow the usage of multiple materials on the same Geometry, Mesh and Geometry have SubMesh and SubGeometry.
If a Mesh references a Geometry with 3 SubGeometries, it will also have 3 SubMeshes. So you could set 3 different materials for the 3 different parts of the Geometry. for example, this is how you would set up a mesh for a Geometry with 3 SubGeometries:
var myMesh:Mesh= new Mesh(myGeometry, new ColorMaterial()); // now all SubGeometries will be rendered with same material myMesh.subMeshes.length; // the number of subMehses / subGeometries available for this Mesh / Geometry // for example you can assign different material to each subMesh: myMesh.subMehses[0].material = new ColorMaterial(0xff00ff); myMesh.subMehses[1].material = new ColorMaterial(0xffff00); myMesh.subMehses[2].material = new ColorMaterial(0x0000ff);
Hope this makes it more clear.
A more general tip: i found it to be much more easy to understand the AWD format by looking at the available parsers and encoders, than to read through the specs. Of course at the beginning i did a lot of reading in the specs to get grasp on how it all works, but in the end, it became much faster to check things by just looking at the parsing / encoding functions available in as3 / python / cpp.
Works the other way around for me...I need to read the specs before I can make heads or tails of the parsing/encoding functions.
Thanks for the clearing up the differences between sub-geometry and sub-meshes.
One more thing...you might want to put the example you just provided into the specification at some point (assuming you're the one currently maintaining it).
The section on Sub-geometry (page 21, last paragraph) in the AWD Specification seems unclear. The paragraph defines the term "sub-geometry" but goes on to use the term "sub-mesh" in its stead. It's unclear whether the two terms means the same thing or if they differ in some way.