Original Post
Hi!
I''m currently calculating vertices, texcoords and indices this way:
bool SwitchSides = true;
for(int x=0;x<=size-2;x+=step)
{
if(SwitchSides)
{
for(int y=size-1;y>=0;y-=step)
{
mpVertices[mNumVer].x = x;
mpVertices[mNumVer].y =(int)GetHeight(x, y);
mpVertices[mNumVer].z =y;
mpTexcoords[mNumVer].x = mpVertices[x1].x / (float)size;
mpTexcoords[mNumVer].y = mpVertices[x1].z / (float)size;
mNumVer++;
mpVertices[mNumVer].x = x + step;
mpVertices[mNumVer].y = (int)GetHeight(x + step, y);
mpVertices[mNumVer].z = (int)y;
mpTexcoords[mNumVer].x = mpVertices[x1].x / (float)size;
mpTexcoords[mNumVer].y = mpVertices[x1].z / (float)size;
mNumVer++;
}
}
else
{
for(int y=0;y<=size-1;y+=step)
{
mpVertices[mNumVer].x = x + step;
mpVertices[mNumVer].y =(int)GetHeight(x + step, y);
mpVertices[mNumVer].z =(int) y;
mpTexcoords[mNumVer].x = mpVertices[x1].x / (float)size;
mpTexcoords[mNumVer].y = mpVertices[x1].z / (float)size;
mNumVer++;
mpVertices[mNumVer].x = (int)x;
mpVertices[mNumVer].y = (int)GetHeight(x, y);
mpVertices[mNumVer].z = (int)y;
mpTexcoords[mNumVer].x = mpVertices[x1].x / (float)size;
mpTexcoords[mNumVer].y = mpVertices[x1].z / (float)size;
mNumVer++;
}
}
SwitchSides = !SwitchSides;
}
int idx = 0;
mNumInd = mNumVer;
mpIndices = new int[mNumInd];
for (idx=0; idx < mNumInd; idx++)
mpIndices[idx] = idx;
[/CODE]
My problem is that I don''t have an idea how to calculate normals for triangle strips.
Maybe this sounds kind of impertinent, but would somebody please post the source code that calculates these normals (I tried it for a long time and now I''m really sick of this...)
thanks in advance ...
guts