From 6004e8f4321f9f9687ddfa6bf03044e184b11e8d Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sun, 26 Oct 2008 04:13:39 +0000 Subject: [PATCH] matrix stack cleanup git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3271 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/md2.h | 3 --- source/src/md3.h | 3 --- source/src/vertmodel.h | 10 ++++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/source/src/md2.h b/source/src/md2.h index f248fbc5..e9b4c914 100644 --- a/source/src/md2.h +++ b/source/src/md2.h @@ -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); diff --git a/source/src/md3.h b/source/src/md3.h index 204f945f..18c5b73b 100644 --- a/source/src/md3.h +++ b/source/src/md3.h @@ -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); diff --git a/source/src/vertmodel.h b/source/src/vertmodel.h index 4502d5c0..bc187201 100644 --- a/source/src/vertmodel.h +++ b/source/src/vertmodel.h @@ -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;