[ODE] Added 16-bit indices support for TriMesh

David Walters hidden.asbestos at googlemail.com
Sat Nov 10 17:47:06 MST 2007

I've been going through the old patches and found one from March 2005
which adds support for 16 bit indices when using trimeshes. As this is
a common restriction of graphics cards it seemed reasonable to assume
that many applications would be using 16 bit buffers for triangle list
indices. However as OPCODE only ever supported 32 bit index data there
would be the nead to duplicate the data if you wished to use a
renderable model as a collision hull.

So I spent a bit of time on this, first taking Geoff's old patch
(which just changed OPCODE itself) and applying it relative to the
latest SVN revision, then taking it further so that it was properly
integrated into ODE proper.

Here are some notes to clarify:

* Bit resolution is specified using the dTRIMESH_16BIT_INDICES option
in config.h
eg. #define dTRIMESH_16BIT_INDICES 1

* The default is 32-bit to retain compatability / flexibility with
large data sets.

* A new global type 'dTriIndex' was added to allow automatic
declaration in the correct type. It will be either uint16 or uint32.

* GIMPACT is not currently supported and will default to 32-bit,
ignoring the build option. It would be great if someone could submit a
patch to support this.

* No extra checking is performed, if you pass in bad / 32 bit indices
into the code then it will attempt to parse them as 16 bit values.
Take care to ensure your indices don't exceed 65535 as you will suffer
the effects of wrapping.

* All samples that appeared to use trimeshes have been updated to work
with the new dTriIndex type and thus either build option. Please shout
if there are any ones I missed!

Hope this helps,
David Walters

ps. The oldest patch is now from 2005-10-23 :-)

More information about the ODE mailing list