mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 20:50:42 +00:00
high precision software mdl rendering
This commit is contained in:
parent
abf73ea80a
commit
42456845f0
4 changed files with 58 additions and 23 deletions
|
@ -238,7 +238,6 @@ void R_ZDrawSubmodelPolys (model_t *clmodel);
|
||||||
|
|
||||||
// Alias models ===========================================
|
// Alias models ===========================================
|
||||||
|
|
||||||
#define MAXALIASVERTS 1024
|
|
||||||
#define ALIAS_Z_CLIP_PLANE 5
|
#define ALIAS_Z_CLIP_PLANE 5
|
||||||
|
|
||||||
extern int numverts;
|
extern int numverts;
|
||||||
|
|
|
@ -184,6 +184,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
||||||
mod->flags = LittleLong (pinmodel->flags);
|
mod->flags = LittleLong (pinmodel->flags);
|
||||||
|
|
||||||
// endian-adjust and copy the data, starting with the alias model header
|
// endian-adjust and copy the data, starting with the alias model header
|
||||||
|
pmodel->ident = LittleLong (pinmodel->ident);
|
||||||
pmodel->boundingradius = LittleFloat (pinmodel->boundingradius);
|
pmodel->boundingradius = LittleFloat (pinmodel->boundingradius);
|
||||||
pmodel->numskins = LittleLong (pinmodel->numskins);
|
pmodel->numskins = LittleLong (pinmodel->numskins);
|
||||||
pmodel->skinwidth = LittleLong (pinmodel->skinwidth);
|
pmodel->skinwidth = LittleLong (pinmodel->skinwidth);
|
||||||
|
|
|
@ -95,7 +95,6 @@ void R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
|
||||||
trivertx_t *pverts, stvert_t *pstverts);
|
trivertx_t *pverts, stvert_t *pstverts);
|
||||||
void R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av);
|
void R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av);
|
||||||
|
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
R_AliasCheckBBox (void)
|
R_AliasCheckBBox (void)
|
||||||
{
|
{
|
||||||
|
@ -374,7 +373,8 @@ R_AliasSetUpTransform (int trivial_accept)
|
||||||
// Also scale down z, so 1/z is scaled 31 bits for free, and scale down x and y
|
// Also scale down z, so 1/z is scaled 31 bits for free, and scale down x and y
|
||||||
// correspondingly so the projected x and y come out right
|
// correspondingly so the projected x and y come out right
|
||||||
// FIXME: make this work for clipped case too?
|
// FIXME: make this work for clipped case too?
|
||||||
if (trivial_accept) {
|
|
||||||
|
if (trivial_accept && pmdl->ident != POLYHEADER16) {
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
aliastransform[0][i] *= aliasxscale *
|
aliastransform[0][i] *= aliasxscale *
|
||||||
(1.0 / ((float) 0x8000 * 0x10000));
|
(1.0 / ((float) 0x8000 * 0x10000));
|
||||||
|
@ -385,7 +385,6 @@ R_AliasSetUpTransform (int trivial_accept)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
|
R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
|
||||||
trivertx_t *pverts, stvert_t *pstverts)
|
trivertx_t *pverts, stvert_t *pstverts)
|
||||||
|
@ -393,12 +392,31 @@ R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
|
||||||
int temp;
|
int temp;
|
||||||
float lightcos, *plightnormal;
|
float lightcos, *plightnormal;
|
||||||
|
|
||||||
|
if (pmdl->ident == POLYHEADER16)
|
||||||
|
{
|
||||||
|
trivertx_t * pextra;
|
||||||
|
float vextra[3];
|
||||||
|
|
||||||
|
pextra = pverts + pmdl->numverts;
|
||||||
|
vextra[0] = pverts->v[0] + pextra->v[0] / (float)256;
|
||||||
|
vextra[1] = pverts->v[1] + pextra->v[1] / (float)256;
|
||||||
|
vextra[2] = pverts->v[2] + pextra->v[2] / (float)256;
|
||||||
|
av->fv[0] = DotProduct (vextra, aliastransform[0]) +
|
||||||
|
aliastransform[0][3];
|
||||||
|
av->fv[1] = DotProduct (vextra, aliastransform[1]) +
|
||||||
|
aliastransform[1][3];
|
||||||
|
av->fv[2] = DotProduct (vextra, aliastransform[2]) +
|
||||||
|
aliastransform[2][3];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
av->fv[0] = DotProduct (pverts->v, aliastransform[0]) +
|
av->fv[0] = DotProduct (pverts->v, aliastransform[0]) +
|
||||||
aliastransform[0][3];
|
aliastransform[0][3];
|
||||||
av->fv[1] = DotProduct (pverts->v, aliastransform[1]) +
|
av->fv[1] = DotProduct (pverts->v, aliastransform[1]) +
|
||||||
aliastransform[1][3];
|
aliastransform[1][3];
|
||||||
av->fv[2] = DotProduct (pverts->v, aliastransform[2]) +
|
av->fv[2] = DotProduct (pverts->v, aliastransform[2]) +
|
||||||
aliastransform[2][3];
|
aliastransform[2][3];
|
||||||
|
}
|
||||||
|
|
||||||
fv->v[2] = pstverts->s;
|
fv->v[2] = pstverts->s;
|
||||||
fv->v[3] = pstverts->t;
|
fv->v[3] = pstverts->t;
|
||||||
|
@ -422,7 +440,6 @@ R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
|
||||||
fv->v[4] = temp;
|
fv->v[4] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
#undef USE_INTEL_ASM //XXX asm pic hack
|
#undef USE_INTEL_ASM //XXX asm pic hack
|
||||||
#endif
|
#endif
|
||||||
|
@ -475,7 +492,6 @@ R_AliasTransformAndProjectFinalVerts (finalvert_t *fv, stvert_t *pstverts)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av)
|
R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av)
|
||||||
{
|
{
|
||||||
|
@ -490,7 +506,6 @@ R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av)
|
||||||
fv->v[1] = (av->fv[1] * aliasyscale * zi) + aliasycenter;
|
fv->v[1] = (av->fv[1] * aliasyscale * zi) + aliasycenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
R_AliasPrepareUnclippedPoints (void)
|
R_AliasPrepareUnclippedPoints (void)
|
||||||
{
|
{
|
||||||
|
@ -652,7 +667,7 @@ R_AliasSetupFrame (void)
|
||||||
((byte *) paliashdr + paliasgroup->frames[i].frame);
|
((byte *) paliashdr + paliasgroup->frames[i].frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAXALIASVERTS 1024
|
||||||
void
|
void
|
||||||
R_AliasDrawModel (alight_t *plighting)
|
R_AliasDrawModel (alight_t *plighting)
|
||||||
{
|
{
|
||||||
|
@ -696,7 +711,7 @@ R_AliasDrawModel (alight_t *plighting)
|
||||||
else
|
else
|
||||||
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
||||||
|
|
||||||
if (currententity->trivial_accept)
|
if (currententity->trivial_accept && pmdl->ident != POLYHEADER16)
|
||||||
R_AliasPrepareUnclippedPoints ();
|
R_AliasPrepareUnclippedPoints ();
|
||||||
else
|
else
|
||||||
R_AliasPreparePoints ();
|
R_AliasPreparePoints ();
|
||||||
|
|
|
@ -393,12 +393,31 @@ R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
|
||||||
int temp;
|
int temp;
|
||||||
float lightcos, *plightnormal;
|
float lightcos, *plightnormal;
|
||||||
|
|
||||||
|
if (pmdl->ident == POLYHEADER16)
|
||||||
|
{
|
||||||
|
trivertx_t * pextra;
|
||||||
|
float vextra[3];
|
||||||
|
|
||||||
|
pextra = pverts + pmdl->numverts;
|
||||||
|
vextra[0] = pverts->v[0] + pextra->v[0] / (float)256;
|
||||||
|
vextra[1] = pverts->v[1] + pextra->v[1] / (float)256;
|
||||||
|
vextra[2] = pverts->v[2] + pextra->v[2] / (float)256;
|
||||||
|
av->fv[0] = DotProduct (vextra, aliastransform[0]) +
|
||||||
|
aliastransform[0][3];
|
||||||
|
av->fv[1] = DotProduct (vextra, aliastransform[1]) +
|
||||||
|
aliastransform[1][3];
|
||||||
|
av->fv[2] = DotProduct (vextra, aliastransform[2]) +
|
||||||
|
aliastransform[2][3];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
av->fv[0] = DotProduct (pverts->v, aliastransform[0]) +
|
av->fv[0] = DotProduct (pverts->v, aliastransform[0]) +
|
||||||
aliastransform[0][3];
|
aliastransform[0][3];
|
||||||
av->fv[1] = DotProduct (pverts->v, aliastransform[1]) +
|
av->fv[1] = DotProduct (pverts->v, aliastransform[1]) +
|
||||||
aliastransform[1][3];
|
aliastransform[1][3];
|
||||||
av->fv[2] = DotProduct (pverts->v, aliastransform[2]) +
|
av->fv[2] = DotProduct (pverts->v, aliastransform[2]) +
|
||||||
aliastransform[2][3];
|
aliastransform[2][3];
|
||||||
|
}
|
||||||
|
|
||||||
fv->v[2] = pstverts->s;
|
fv->v[2] = pstverts->s;
|
||||||
fv->v[3] = pstverts->t;
|
fv->v[3] = pstverts->t;
|
||||||
|
@ -640,6 +659,7 @@ R_AliasSetupFrame (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MAXALIASVERTS 1024
|
||||||
void
|
void
|
||||||
R_AliasDrawModel (alight_t *plighting)
|
R_AliasDrawModel (alight_t *plighting)
|
||||||
{
|
{
|
||||||
|
@ -682,7 +702,7 @@ R_AliasDrawModel (alight_t *plighting)
|
||||||
else
|
else
|
||||||
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
|
||||||
|
|
||||||
if (currententity->trivial_accept)
|
if (currententity->trivial_accept && pmdl->ident != POLYHEADER16)
|
||||||
R_AliasPrepareUnclippedPoints ();
|
R_AliasPrepareUnclippedPoints ();
|
||||||
else
|
else
|
||||||
R_AliasPreparePoints ();
|
R_AliasPreparePoints ();
|
||||||
|
|
Loading…
Reference in a new issue