Decoding the indices in p-elements


please look at the following code:

//Collect total offset 
int totalOffset = 0; 
for(int j = 0; j < polygonsElement->getInput_array().getCount(); j++) 
	domInputLocalOffset *inputElement =   
	if(!inputElement) { 
	totalOffset += inputElement->getOffset(); 

My dae-document looks like this:

<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)

Sebastian Jancke


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.


well I see, should stop coding at 2 in the morning :slight_smile:
sorry for asking :slight_smile: