Interim MD2 support for polymer. Interim because it relies on a change

in the model conversion code that breaks the HRP oozfilter model. It can 
be reverted pretty easily, see comment in mdsprite.c.


git-svn-id: https://svn.eduke32.com/eduke32@755 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2008-06-01 09:41:56 +00:00
parent f661a56e2f
commit fa405211ed
2 changed files with 17 additions and 11 deletions

View file

@ -1095,7 +1095,11 @@ static md2model *md2load(int fil, const char *filnam)
m3 = (md3model *)calloc(1, sizeof(md3model)); if (!m3) { free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); } m3 = (md3model *)calloc(1, sizeof(md3model)); if (!m3) { free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
m3->mdnum = 3; m3->texid = 0; m3->scale = m->scale; m3->mdnum = 3; m3->texid = 0; m3->scale = m->scale;
m3->head.id = 0x33504449; m3->head.vers = 15; m3->head.id = 0x33504449; m3->head.vers = 15;
m3->head.flags = 1337; m3->head.numframes = m->numframes; // this changes the conversion code to do real MD2->MD3 conversion
// it breaks HRP MD2 oozfilter, change the flags to 1337 to revert
// to the old, working code
m3->head.flags = 0;
m3->head.numframes = m->numframes;
m3->head.numtags = 0; m3->head.numsurfs = 1; m3->head.numtags = 0; m3->head.numsurfs = 1;
m3->head.numskins = 0; m3->head.numskins = 0;
@ -1169,12 +1173,17 @@ static md2model *md2load(int fil, const char *filnam)
while (k < m->numframes) while (k < m->numframes)
{ {
f = (md2frame_t *)&m->frames[k*m->framebytes]; f = (md2frame_t *)&m->frames[k*m->framebytes];
//s->xyzn[(k*s->numverts) + (i*3) + j].x = ((f->verts[m->tris[i].v[j]].v[0] * f->mul.x) + f->add.x); if (m3->head.flags == 1337)
//s->xyzn[(k*s->numverts) + (i*3) + j].y = ((f->verts[m->tris[i].v[j]].v[1] * f->mul.y) + f->add.y); {
//s->xyzn[(k*s->numverts) + (i*3) + j].z = ((f->verts[m->tris[i].v[j]].v[2] * f->mul.z) + f->add.z); s->xyzn[(k*s->numverts) + (i*3) + j].x = f->verts[m->tris[i].v[j]].v[0];
s->xyzn[(k*s->numverts) + (i*3) + j].x = f->verts[m->tris[i].v[j]].v[0]; s->xyzn[(k*s->numverts) + (i*3) + j].y = f->verts[m->tris[i].v[j]].v[1];
s->xyzn[(k*s->numverts) + (i*3) + j].y = f->verts[m->tris[i].v[j]].v[1]; s->xyzn[(k*s->numverts) + (i*3) + j].z = f->verts[m->tris[i].v[j]].v[2];
s->xyzn[(k*s->numverts) + (i*3) + j].z = f->verts[m->tris[i].v[j]].v[2]; } else {
s->xyzn[(k*s->numverts) + (i*3) + j].x = ((f->verts[m->tris[i].v[j]].v[0] * f->mul.x) + f->add.x) * 64;
s->xyzn[(k*s->numverts) + (i*3) + j].y = ((f->verts[m->tris[i].v[j]].v[1] * f->mul.y) + f->add.y) * 64;
s->xyzn[(k*s->numverts) + (i*3) + j].z = ((f->verts[m->tris[i].v[j]].v[2] * f->mul.z) + f->add.z) * 64;
}
k++; k++;
} }
j++; j++;

View file

@ -2158,9 +2158,6 @@ static void polymer_drawmdsprite(spritetype *tspr)
if ((pr_vbos > 1) && (m->indices == NULL)) if ((pr_vbos > 1) && (m->indices == NULL))
polymer_loadmodelvbos(m); polymer_loadmodelvbos(m);
if (m->head.flags == 1337)
return;
spos[0] = tspr->y; spos[0] = tspr->y;
spos[1] = -(float)(tspr->z) / 16.0f; spos[1] = -(float)(tspr->z) / 16.0f;
spos[2] = -tspr->x; spos[2] = -tspr->x;
@ -2168,7 +2165,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
bglMatrixMode(GL_MODELVIEW); bglMatrixMode(GL_MODELVIEW);
bglPushMatrix(); bglPushMatrix();
scale = (m->head.flags == 1337) ? 1.0 : (1.0/64.0); scale = (1.0/64.0);
scale *= m->scale; scale *= m->scale;
scale *= m->bscale; scale *= m->bscale;
scale *= 1024; scale *= 1024;