matrix stack cleanup

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3271 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-10-26 04:13:39 +00:00
parent 4c80752aac
commit 6004e8f432
3 changed files with 6 additions and 10 deletions
-3
View File
@@ -199,16 +199,13 @@ struct md2 : vertmodel
modelyaw = yaw;
modelpitch = pitch;
glPushMatrix();
matrixpos = 0;
matrixstack[0].identity();
matrixstack[0].translate(o);
matrixstack[0].rotate_around_z((yaw+180)*RAD);
matrixstack[0].rotate_around_y(-pitch*RAD);
if(anim&ANIM_MIRROR || scale!=1) matrixstack[0].scale(scale, anim&ANIM_MIRROR ? -scale : scale, scale);
glMultMatrixf(matrixstack[0].v);
parts[0]->render(anim, varseed, speed, basetime, d);
glPopMatrix();
if(!cullface) glEnable(GL_CULL_FACE);
else if(anim&ANIM_MIRROR) glCullFace(GL_FRONT);
-3
View File
@@ -182,16 +182,13 @@ struct md3 : vertmodel
modelyaw = yaw;
modelpitch = pitch;
glPushMatrix();
matrixpos = 0;
matrixstack[0].identity();
matrixstack[0].translate(o);
matrixstack[0].rotate_around_z((yaw+180)*RAD);
matrixstack[0].rotate_around_y(-pitch*RAD);
if(anim&ANIM_MIRROR || scale!=1) matrixstack[0].scale(scale, anim&ANIM_MIRROR ? -scale : scale, scale);
glMultMatrixf(matrixstack[0].v);
parts[0]->render(anim, varseed, speed, basetime, d);
glPopMatrix();
if(!cullface) glEnable(GL_CULL_FACE);
else if(anim&ANIM_MIRROR) glCullFace(GL_FRONT);
+6 -4
View File
@@ -865,7 +865,10 @@ struct vertmodel : model
ai_t = (lastmillis-d->lastanimswitchtime[index])/(float)animationinterpolationtime;
}
glPushMatrix();
glMultMatrixf(matrixstack[matrixpos].v);
loopv(meshes) meshes[i]->render(as, cur, doai ? &prev : NULL, ai_t);
glPopMatrix();
loopi(numtags)
{
@@ -877,7 +880,9 @@ struct vertmodel : model
gentagmatrix(cur, doai ? &prev : NULL, ai_t, i, linkmat.v);
matrixpos++;
matrixstack[matrixpos].mul(matrixstack[matrixpos-1].v, linkmat.v);
matrixstack[matrixpos].mul(matrixstack[matrixpos-1], linkmat);
if(link.pos) *link.pos = matrixstack[matrixpos].gettranslation();
if(link.p)
{
@@ -891,7 +896,6 @@ struct vertmodel : model
linkmat.invertvertex(shadowpos);
}
glLoadMatrixf(matrixstack[matrixpos].v);
link.p->render(anim, varseed, speed, basetime, d);
if(stenciling)
@@ -901,8 +905,6 @@ struct vertmodel : model
}
}
if(link.pos) *link.pos = matrixstack[matrixpos].gettranslation();
if(anim&ANIM_PARTICLE && link.emitter)
{
particleemitter &p = *link.emitter;