No subject

Wed Apr 28 21:25:55 PDT 2010

at are offsets to vertexes in the vertex buffer. Read it as the vertexes no=
rmals and all this other stuff being in static arrays. It then runs through=
 the indice list and runs the associated glVertex3f commands or whatever on=
 the vertex at the specified index on the array. This is done for all data =

<br>vector&lt;LLVector3&gt; verts;<br>vector&lt;LLVector4&gt; colors;<br>ve=
ctor&lt;LLVector3&gt; normals;<br>U16 indices[3] =3D {0, 1, 2, 1};<br><br>f=
or(U16 i =3D 0; i &lt; 3; ++i)<br>{<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 U16 x =3D indices[i];<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 glNormal3f(normals[x].mV[0],norm=
=A0 glVertex3f(verts[x].mV[0],verts[x].mV[1],verts[x].mV[2]);<br>}<br><br>I=
s the most simple example I can think of that would demonstrate how it work=
s internally.<br>

<br>In the code example you have, the vertexes are drawn one by one in imme=
diate mode, which is both slow, and undesired. You will have to do some res=
earch into using proper vertex buffers to properly convert the code.<br>

<br><div class=3D"gmail_quote">On Wed, Jun 2, 2010 at 19:35, Rob Nelson <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:nexisentertainment at">nexisent=
ertainment at</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_qu=
ote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 20=
4, 204); padding-left: 1ex;">

I am almost to the point of going crazy. =C2=A0I was going to write a<br>
notecard to a Linden, but I&#39;ve been knocked out of SL for reasons<br>
unknown, so I&#39;ll have to ask here.<br>
In my infinite lack of wisdom, I decided to start working on a project<br>
where I replace the heightmap terrain in Second Life with one based on<br>
voxels. =C2=A0To get to the core of the reasoning behind this switch so I<b=
don&#39;t spend too much time on it:<br>
=C2=A0* Voxel-based land allows creation of overhangs/caves/floating chunks=
of land (not possible with heightmaps)<br>
=C2=A0* Also adds the ability to handle up to 255 terrain materials<br>
(textures, eventually detail shaders) instead of 4, and the materials<br>
are placed where desired instead of at fractional heights.<br>
I am working on the rendering code in the SL viewer at the moment,<br>
having completed the server-side code and some of the client-side<br>
packet-handling classes. =C2=A0However, I have zero familiarity with OpenGL=
so bear with me.<br>
My viewer needs to construct a terrain surface (a mesh) for display. =C2=A0=
have completed an LLViewerObject to this end, except for:<br>
::getGeometry(LLStrider&lt;LLVector3&gt; &amp;verticesp,<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0LLStrider&lt;LLVector3&gt; &amp;normalsp,<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0LLStrider&lt;LLColor4U&gt; &amp;colorsp,<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0LLStrider&lt;LLVector2&gt; &amp;texCoords0p,<br=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0LLStrider&lt;LLVector2&gt; &amp;texCoords1p,<br=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0LLStrider&lt;U16&gt; &amp;indicesp)<br>
What is confusing me is indicesp. =C2=A0I think it has something to do with=
connecting vertices, but I&#39;m not sure how. =C2=A0The example code I am<=
working with uses a mess of lookup tables in the following loop for each<br=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0//Draw the triangles that were found. =C2=A0The=
re can be up to five per cube<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0for(iTriangle =3D 0; iTriangle &lt; 5; iTriangl=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if(a2iTriangleConnectionTable[iFl=
agIndex][3*iTriangle] &lt; 0)<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for(iCorner =3D 0; iCorner &lt; 3=
; iCorner++)<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iVertex =3D<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vGetColor(sColor, a=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0glColor4f(sColor.fX=
, sColor.fY, sColor.fZ, 0.6);<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0glNormal3f(asEdgeNo=
asEdgeNorm[iVertex].fY, =C2=A0 asEdgeNorm[iVertex].fZ);<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0glVertex3f(asEdgeVe=
asEdgeVertex[iVertex].fY, asEdgeVertex[iVertex].fZ);<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
Can anyone give me any pointers on getting this converted?<br>
Policies and (un)subscribe information available here:<br>
<a href=3D"" target=3D"_blank=
Please read the policies before posting to keep unmoderated posting privile=


More information about the opensource-dev mailing list