Page 2 of 2

Re: Loading obj mesh files with 32bit index type

Posted: Fri Nov 13, 2015 9:53 am
by robmar
Its really easy, don't worry! Just search for all u16 references related to indices, add a switch like:

#ifndefine _INDICES_32
u16 *indices;
#else
u32 *indices;
#endif

Do a good search for all indices reference calls, and make sure the functions use the 32-bit value if _INDICES_32 is used.

Doing this isn't difficult and its a good way to learn you way around the code.

Re: Loading obj mesh files with 32bit index type

Posted: Fri Nov 13, 2015 11:05 am
by AReichl
> Just search for all u16 references related to indices ...

fine again - but where all?
Only in the .stl loader or all over the library?

Re: Loading obj mesh files with 32bit index type

Posted: Fri Nov 13, 2015 11:07 am
by CuteAlien
AReichl: Both answers are correct :-) Basically you only have to fix the loader to get 32-bit meshes working. But I think there are also still places in the library which don't support 32-bit yet. So drawing will work, some mesh-manipulation stuff might not.

Re: Loading obj mesh files with 32bit index type

Posted: Fri Nov 13, 2015 12:54 pm
by AReichl
Got it!

I changed the stl loader in the shader-pipeline branch similar to the TerrainSceneNode. If during loading the number of indices exceeds 16bit-max (65536 or a little less) then i switch to 32bit. You could also begin with 32bit, but that would be a giveaway for small meshes.

And guess what - it runs faster than other stl-viewers i tried (specially with Directx11).

I will also try to get it working with trunk (CDynamicMeshBuffer?), but in principle the problem is solved.