Results 1 to 3 of 3

Thread: Decoding the indices in p-elements

  1. #1

    Decoding the indices in p-elements

    Hello,

    please look at the following code:
    Code :
    //Collect total offset 
    int totalOffset = 0; 
    for(int j = 0; j < polygonsElement->getInput_array().getCount(); j++) 
    { 
    	domInputLocalOffset *inputElement =   
                 polygonsElement->getInput_array().get(i); 
    	if(!inputElement) { 
    		continue; 
    	} 
     
    	totalOffset += inputElement->getOffset(); 
    }

    My dae-document looks like this:
    Code :
    <polygons material="lambert1" count="6"> 
    <input semantic="VERTEX" offset="0" source="#pCubeShape1-lib-Vertex"/> 
     
    <input semantic="NORMAL" offset="1" source="#pCubeShape1-lib-Normal"/> 
     
    <input semantic="TEXCOORD" offset="2" set="0" source="#pCubeShape1-lib-map1"/>

    I expected the code above to set totalOffset = 3, but inputElement->getOffset(); returns 0 for all inputElements.

    Any ideas what's wrong with my code?

    I need to decode the indices in the p tags in order to store them separate (vertex-, normal-, texcoord-indices)

    Regards,
    Sebastian Jancke

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

    This may just be a problem in your post but if you really copied and pasted your code this most likely is your problem.

    You are looping on variable 'j' but you are getting 'i'.

    now if 'i' == 0 you will always get offset 0.

    So, if thats not really your problem I don't know whats going on. Its been a very long time since the DOM had any problem parsing primitives.

    Get back to me if that isn't it and I'll take some time to look into it further.

    -Andy

  3. #3
    well I see, should stop coding at 2 in the morning
    sorry for asking

Posting Permissions

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