Hello Collada-Experts
I’m trying to implement a Collada-parser in C# and view the meshes in Managed-DirectX.
To me it is a bit unclear how to read the
-tags to get the indices to build a mesh.
First, a example of a plane:
<polylist material="ColorMaterial" count="1">
<input semantic="VERTEX" source="#Plane01-mesh-vertices" offset="0"/>
<input semantic="TEXCOORD" source="#Plane01-mesh-map-channel1" offset="1" set="1"/>
<vcount>4</vcount>
2 2 0 0 1 1 3 3</p>
</polylist>
My intention was to read it that way:
1st iteration
2 2 0 0 1 1 3 3
2nd iteration
2 2 0 0 1 1 3 3
so I have:
indices = new short[] {
2,0,1,
1,3,2
Works fine for the case of a plane, but I would like to read more complex meshes, in the following case a box:
<polylist material="ColorMaterial" count="6">
<input semantic="VERTEX" source="#Box-mesh-vertices" offset="0"/>
<input semantic="TEXCOORD" source="#Box-mesh-map-channel1" offset="1" set="1"/>
<vcount>4 4 4 4 4 4</vcount>
0 0 2 2 3 3 1 1 4 4 5 5 7 7 6 6 0 8 1 9 5 11 4 10 1 12 3 13 7 15 5 14 3 16 2 17 6 19 7 18 2 20 0 21 4 23 6 22</p>
</polylist>
I would get something like that:
indices = new short[] {
0,2,3,
1,4,5,
7,6,0,
1,5,4,
1,3,7,
5,3,2,
6,7,2,
0,4,6
};
What I get when I read it like that is everything but not a box. So it seems I had misunderstood the system of reading this index.
Could anyone say what went wrong?
Thank you for help and sorry for the poor english.
Goodbye
UNKLE