[ODE] 16 bits indices and TriMesh
Hannes Norda
mt00hno at student.bth.se
Tue Jul 15 09:04:01 2003
This is a multi-part message in MIME format.
------=_NextPart_000_005B_01C34AFB.94312000
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
when experimenting with TriMesh today i couldn't get =
dGeomTriMeshDataBuild() to work, I crashed somewhere deep in OPCODE.
(Opcode::AABBTreeOfTrianglesBuilder::ComputeGlobalBox())
My call was like this:
dGeomTriMeshDataBuild(triMeshData, pVertices, =
pMesh->GetVertexByteSize(), pMesh->GetVertexCount(), pIndices, =
pMesh->GetIndexCount(), 3 *sizeof(uint16));
(uint16 is a unsigned short..)
After quite some time I noticed that OPCODE only deals with 32 bit =
indices....
bool MeshInterface::SetStrides(udword tri_stride, udword vertex_stride)
{
if(tri_stride<sizeof(IndexedTriangle)) return =
SetIceError("MeshInterface::SetStrides: invalid triangle stride", null);
if(vertex_stride<sizeof(Point)) return =
SetIceError("MeshInterface::SetStrides: invalid vertex stride", null);
mTriStride =3D tri_stride;
mVertexStride =3D vertex_stride;
return true;
}
sizeof(IndexedTriangle) is 12 ... my 3*sizeof(uint16) is 6
Ok, I cloned my indexbuffers and stored them as unsigned int* instead of =
unsigned short*, which works.
Obviously this is only a temporary solution, I rather not store my =
indexbuffers twice.
Is there any other way working around this problem than me cloning =
indexbuffers or changing my renderingengine to using 32bits indices =
instead of 16bits?
/Hannes Norda
------=_NextPart_000_005B_01C34AFB.94312000
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>Hi,<BR><BR>when=20
experimenting with TriMesh today i couldn't get dGeomTriMeshDataBuild() =
to work,=20
I crashed somewhere deep in=20
OPCODE.<BR>(Opcode::AABBTreeOfTrianglesBuilder::ComputeGlobalBox())<BR><B=
R>My=20
call was like this:<BR>dGeomTriMeshDataBuild(triMeshData, pVertices,=20
pMesh->GetVertexByteSize(), pMesh->GetVertexCount(), pIndices,=20
pMesh->GetIndexCount(), 3 *sizeof(uint16));<BR>(uint16 is a unsigned=20
short..)<BR><BR>After quite some time I noticed that OPCODE only deals =
with 32=20
bit indices....<BR>bool MeshInterface::SetStrides(udword tri_stride, =
udword=20
vertex_stride)<BR>{<BR> =20
if(tri_stride<sizeof(IndexedTriangle)) return=20
SetIceError("MeshInterface::SetStrides: invalid triangle stride",=20
null);<BR> if(vertex_stride<sizeof(Point)) return=20
SetIceError("MeshInterface::SetStrides: invalid vertex stride",=20
null);<BR><BR> mTriStride =3D =
tri_stride;<BR> =20
mVertexStride =3D vertex_stride;<BR> return=20
true;<BR>}<BR>sizeof(IndexedTriangle) is 12 ... my 3*sizeof(uint16) is=20
6<BR><BR>Ok, I cloned my indexbuffers and stored them as unsigned int* =
instead=20
of unsigned short*, which works.<BR>Obviously this is only a temporary =
solution,=20
I rather not store my indexbuffers twice.<BR>Is there any other way =
working=20
around this problem than me cloning indexbuffers or changing my =
renderingengine=20
to using 32bits indices instead of 16bits?<BR><BR>/Hannes=20
Norda</FONT><BR></FONT><FONT face=3DArial =
size=3D2><BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_005B_01C34AFB.94312000--