[ODE] Creating a TriList heightmap geom

Aras Pranckevicius nearaz at interamotion.com
Mon May 12 05:06:02 2003


This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C31898.0B170720
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

> So, now I'm faced with the problem of how to create the Tri-mesh for =
my
> heightmap. I'm sure there's a really simple solution, but I can't seem
> ...
> I have the vertices in correctly (just transferred them from my
> heightmap into a dcVector3 array) but the Indices have me stumped. How
> do I find / generate these? I tried a couple of things, but they

It's the same idea as in rendering (vertex&index buffers): the vertices =
are the vertices, and the indices represent the "faces" (triangles). 3 =
indices form a triangle, and their values are vertex indices in the =
vertices array.

Eg. in ASCII-art: a small (2x3) heightfield of 6 vertices:
0--1--2
|\ |\ |
| \| \|
3--4--5
The vertices are just these 6 vertices, and the indices are the 4 =
triangles that we need:
0,4,3;  0,1,4;  1,5,4;  1,2,5; (I've specified vertices in clockwise =
order, you may want to do otherwise).


Generally for OPCODE you just have to supply vertex xyz's and indices, =
both can be taken directly from your vertex/index buffers/arrays (though =
OPCODE uses 32 bit indices, not 16 bit that are often used for =
rendering).



Aras Pranckevicius aka NeARAZ
http://www.gim.ktu.lt/nesnausk/nearaz/


------=_NextPart_000_0009_01C31898.0B170720
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.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3D"Courier New" size=3D2>&gt; So, now I'm faced with the =
problem of=20
how to create the Tri-mesh for my<BR>&gt; heightmap. I'm sure there's a =
really=20
simple solution, but I can't seem</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>&gt; ...<BR>&gt; I have the =
vertices in=20
correctly (just transferred them from my<BR>&gt; heightmap into a =
dcVector3=20
array) but the Indices have me stumped. How<BR>&gt; do I find / generate =
these?=20
I tried a couple of things, but they</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>It's the same idea as in =
rendering=20
(vertex&amp;index buffers): the vertices are the vertices, and the =
indices=20
represent the "faces" (triangles).&nbsp;3 indices form a triangle, and =
their=20
values are vertex indices in the vertices array.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier New">Eg. in ASCII-art: a small =
(2x3)=20
heightfield of 6 vertices:</FONT></FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier =
New">0--1--2</FONT></FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier New">|\ |\ =
|</FONT></FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier New">| \| =
\|</FONT></FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier =
New">3--4--5</FONT></FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier New">The vertices are just =
these 6=20
vertices, and the indices are the 4 triangles that we =
need:</FONT></FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier New">0,4,3;&nbsp; 0,1,4;&nbsp; =

1,5,4;&nbsp; 1,2,5; (I've specified vertices in clockwise order, you may =
want to=20
do otherwise).</FONT></FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier =
New"></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Generally for OPCODE you just =
have to=20
supply vertex xyz's and indices, both can be taken directly from your=20
vertex/index buffers/arrays (though OPCODE uses 32 bit indices, not 16 =
bit=20
that&nbsp;are often used for rendering).</FONT></DIV>
<DIV><FONT size=3D2><FONT face=3D"Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New"><BR></FONT></DIV></FONT>
<DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Aras Pranckevicius aka =
NeARAZ<BR></FONT><A=20
href=3D"http://www.gim.ktu.lt/nesnausk/nearaz/"><FONT face=3D"Courier =
New"=20
size=3D2>http://www.gim.ktu.lt/nesnausk/nearaz/</FONT></A></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></DIV></BODY></HTML>

------=_NextPart_000_0009_01C31898.0B170720--