mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-20 19:02:34 +00:00
Support spritexoffset/spriteyoffset for 3D models
This commit is contained in:
parent
6d9512d290
commit
a71a7f2710
3 changed files with 16 additions and 9 deletions
|
@ -140,7 +140,7 @@ static fixed_t dup_viewx, dup_viewy, dup_viewz;
|
|||
static angle_t dup_viewangle;
|
||||
|
||||
static float gl_viewx, gl_viewy, gl_viewz;
|
||||
static float gl_viewsin, gl_viewcos;
|
||||
float gl_viewsin, gl_viewcos;
|
||||
|
||||
// Maybe not necessary with the new T&L code (needs to be checked!)
|
||||
static float gl_viewludsin, gl_viewludcos; // look up down kik test
|
||||
|
|
|
@ -115,6 +115,7 @@ extern float gl_viewwindowx, gl_basewindowcentery;
|
|||
// BP: big hack for a test in lighting ref : 1249753487AB
|
||||
extern fixed_t *hwbbox;
|
||||
extern FTransform atransform;
|
||||
extern float gl_viewsin, gl_viewcos;
|
||||
|
||||
|
||||
// Render stats
|
||||
|
|
|
@ -1347,7 +1347,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
INT32 mod;
|
||||
float finalscale;
|
||||
interpmobjstate_t interp;
|
||||
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
|
@ -1451,7 +1450,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
}
|
||||
|
||||
//HWD.pfnSetBlend(blend); // This seems to actually break translucency?
|
||||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
|
||||
if (gpatch && hwrPatch && hwrPatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
|
@ -1635,17 +1633,25 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
p.anglez = FIXED_TO_FLOAT(AngleFixed(interp.pitch));
|
||||
p.anglex = FIXED_TO_FLOAT(AngleFixed(interp.roll));
|
||||
|
||||
// SRB2CBTODO: MD2 scaling support
|
||||
finalscale *= FIXED_TO_FLOAT(interp.scale);
|
||||
|
||||
p.flip = atransform.flip;
|
||||
p.mirror = atransform.mirror;
|
||||
|
||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
float xs = finalscale * FIXED_TO_FLOAT(spr->mobj->spritexscale);
|
||||
float ys = finalscale * FIXED_TO_FLOAT(spr->mobj->spriteyscale);
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, xs, ys, flip, hflip, &Surf);
|
||||
float this_scale = FIXED_TO_FLOAT(interp.scale);
|
||||
|
||||
float xs = this_scale * FIXED_TO_FLOAT(interp.spritexscale);
|
||||
float ys = this_scale * FIXED_TO_FLOAT(interp.spriteyscale);
|
||||
|
||||
float ox = xs * FIXED_TO_FLOAT(interp.spritexoffset);
|
||||
float oy = ys * FIXED_TO_FLOAT(interp.spriteyoffset);
|
||||
|
||||
// offset perpendicular to the camera angle
|
||||
p.x -= ox * gl_viewsin;
|
||||
p.y += ox * gl_viewcos;
|
||||
p.z += oy;
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue