mirror of
https://github.com/Pinsplash/halflife2chaos.git
synced 2024-10-29 23:32:38 +01:00
slight improvement with fastindex2
This commit is contained in:
parent
0dc97b4509
commit
b0c595f0e1
@ -1935,7 +1935,7 @@ int C_NPC_Blob::DrawModel(int flags)
|
|||||||
//now build mesh
|
//now build mesh
|
||||||
for (int iVert = 0; iVert < vertices.Count(); iVert++)
|
for (int iVert = 0; iVert < vertices.Count(); iVert++)
|
||||||
{
|
{
|
||||||
int iVertInTri = iVert % 3;
|
//int iVertInTri = iVert % 3;
|
||||||
/*
|
/*
|
||||||
if (iVertInTri == 0)
|
if (iVertInTri == 0)
|
||||||
{
|
{
|
||||||
@ -1964,12 +1964,12 @@ int C_NPC_Blob::DrawModel(int flags)
|
|||||||
//DevMsg("Vert %i at %f %f %f\n", iVert, vertices[iVert].x, vertices[iVert].y, vertices[iVert].z);
|
//DevMsg("Vert %i at %f %f %f\n", iVert, vertices[iVert].x, vertices[iVert].y, vertices[iVert].z);
|
||||||
BlobVert bvert = vertices[iVert];
|
BlobVert bvert = vertices[iVert];
|
||||||
meshBuilder.Position3fv(bvert.pos.Base());
|
meshBuilder.Position3fv(bvert.pos.Base());
|
||||||
if (iVertInTri == 0)
|
//if (iVertInTri == 0)
|
||||||
meshBuilder.TexCoord2f(0, 0, 0);
|
// meshBuilder.TexCoord2f(0, 0, 0);
|
||||||
else if (iVertInTri == 1)
|
//else if (iVertInTri == 1)
|
||||||
meshBuilder.TexCoord2f(0, 0, 1);
|
// meshBuilder.TexCoord2f(0, 0, 1);
|
||||||
else
|
//else
|
||||||
meshBuilder.TexCoord2f(0, 1, 0);
|
// meshBuilder.TexCoord2f(0, 1, 0);
|
||||||
Vector vecNorm = bvert.normal;
|
Vector vecNorm = bvert.normal;
|
||||||
vecNorm = -vecNorm.Normalized();
|
vecNorm = -vecNorm.Normalized();
|
||||||
meshBuilder.Normal3fv(vecNorm.Base());
|
meshBuilder.Normal3fv(vecNorm.Base());
|
||||||
@ -1991,14 +1991,18 @@ int C_NPC_Blob::DrawModel(int flags)
|
|||||||
//Msg("vecNorm %f %f %f\n", vecNorm.x, vecNorm.y, vecNorm.z);
|
//Msg("vecNorm %f %f %f\n", vecNorm.x, vecNorm.y, vecNorm.z);
|
||||||
meshBuilder.AdvanceVertex();
|
meshBuilder.AdvanceVertex();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
for (int iInd = 0; iInd < indices.Count(); iInd += 3)
|
for (int iInd = 0; iInd < indices.Count(); iInd += 3)
|
||||||
{
|
{
|
||||||
meshBuilder.FastIndex(indices[iInd + 0]);
|
meshBuilder.FastIndex(indices[iInd + 0]);
|
||||||
meshBuilder.FastIndex(indices[iInd + 1]);
|
meshBuilder.FastIndex(indices[iInd + 1]);
|
||||||
meshBuilder.FastIndex(indices[iInd + 2]);
|
meshBuilder.FastIndex(indices[iInd + 2]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
for (int iInd = 0; iInd < indices.Count(); iInd += 2)
|
||||||
|
{
|
||||||
|
meshBuilder.FastIndex2(indices[iInd], indices[iInd + 1]);
|
||||||
|
}
|
||||||
meshBuilder.End();
|
meshBuilder.End();
|
||||||
pMesh->Draw();
|
pMesh->Draw();
|
||||||
vertices.RemoveAll();
|
vertices.RemoveAll();
|
||||||
|
Loading…
Reference in New Issue
Block a user