Results 1 to 3 of 3

Thread: Bug in DeIndexer sample

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Posts
    4

    Bug in DeIndexer sample

    Hello,

    I noticed a bug in the deindexer sample. It works if the accessors look like

    Code :
                   <input semantic="VERTEX" source="#Cone01-obj-vertex" offset="0"></input>
                   <input semantic="NORMAL" source="#Cone01-obj-normal" offset="1"></input>
                   <input semantic="TEXCOORD" source="#Cone01-obj-mapchan-1" offset="2" set="1"></input>

    but if it looks like

    Code :
                   <input semantic="VERTEX" source="#Cone01-obj-vertex" offset="0"></input>
                   <input semantic="NORMAL" source="#Cone01-obj-normal" offset="0"></input>
                   <input semantic="TEXCOORD" source="#Cone01-obj-mapchan-1" offset="1" set="1"></input>

    then the code fails, because the maximum offset (1) is not identical to the number of inputs (3). It fails at this line:

    Code :
    	myVertexIndex.indices[k] = thisTriangles->getP()->getValue()[currentTriangleIndex + k];

    Here it needs to access something like

    Code :
    myVertexIndex.indices[k] = thisTriangles->getP()->getValue()[currentTriangleIndex + inputs[k].offset];

    Without it the app crashes. You get this kind of offsets when you are exporting with the 3ds max exporter with tangents/binormals turned on for example.

    -Matthias

  2. #2
    Senior Member
    Join Date
    Aug 2005
    Location
    California
    Posts
    165
    Hello Matthias,

    The Deindexer is just a sample. It was never meant to handle all the different COLLADA cases that could be thrown at it.

    Thank you for this fix. I will add it to the deindexer sample soon.

    -Andy

  3. #3
    Junior Member
    Join Date
    Apr 2006
    Posts
    4
    Ahh ok, if it's just a sample then I don't care I built up on it to make our collada-to-custom-format converter and ran into that bug.
    Actually there are many more lines like the one I've shown that need to be changed, almost all the indices + offsets are wrong. If I had a version without our own code in-between I could send the file to you, but with all the code in-between it will make it even harder for you to fix.
    You could also just add a notice somewhere that the deindexer has this restriction and then leave it as is. The DeIndexer is a very good example by the way and I am sure a lot of people need it!

    -Matthias

Posting Permissions

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