Results 1 to 2 of 2

Thread: How to read <p> in polygons

  1. #1
    UNKLE
    Guest

    How to read <p> in polygons

    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:
    Code :
    <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</p>
    2nd iteration


    2 2 0 0 1 1 3 3</p>

    so I have:
    Code :
    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:

    Code :
    <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:

    Code :
    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

  2. #2
    Junior Member
    Join Date
    Jun 2006
    Location
    Morrison, CO
    Posts
    22
    Ok, I'm heading out in 5 minutes, I don't do C#, and don't want to take the time to pull up the specs, so off the top of my head, this may help.

    Let's use

    0 1 2 3 4 5 6 7</p> to make things clearer.

    You'd have 4 verts at (0, 2, 4, 6) with texture indices of (1, 3, 5, 7). HTH.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •