mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Support spritexoffset/spriteyoffset for 3D models
This commit is contained in:
parent
88bbe8875d
commit
76112c0321
3 changed files with 16 additions and 9 deletions
|
|
@ -148,7 +148,7 @@ static fixed_t dup_viewx, dup_viewy, dup_viewz;
|
||||||
static angle_t dup_viewangle;
|
static angle_t dup_viewangle;
|
||||||
|
|
||||||
static float gl_viewx, gl_viewy, gl_viewz;
|
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!)
|
// Maybe not necessary with the new T&L code (needs to be checked!)
|
||||||
static float gl_viewludsin, gl_viewludcos; // look up down kik test
|
static float gl_viewludsin, gl_viewludcos; // look up down kik test
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ extern float gl_viewwindowx, gl_basewindowcentery;
|
||||||
// BP: big hack for a test in lighting ref : 1249753487AB
|
// BP: big hack for a test in lighting ref : 1249753487AB
|
||||||
extern fixed_t *hwbbox;
|
extern fixed_t *hwbbox;
|
||||||
extern FTransform atransform;
|
extern FTransform atransform;
|
||||||
|
extern float gl_viewsin, gl_viewcos;
|
||||||
|
|
||||||
|
|
||||||
// Render stats
|
// Render stats
|
||||||
|
|
|
||||||
|
|
@ -1377,7 +1377,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
||||||
spritedef_t *sprdef;
|
spritedef_t *sprdef;
|
||||||
spriteframe_t *sprframe;
|
spriteframe_t *sprframe;
|
||||||
INT32 mod;
|
INT32 mod;
|
||||||
float finalscale;
|
|
||||||
interpmobjstate_t interp;
|
interpmobjstate_t interp;
|
||||||
|
|
||||||
if (R_UsingFrameInterpolation() && !paused)
|
if (R_UsingFrameInterpolation() && !paused)
|
||||||
|
|
@ -1507,7 +1506,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
||||||
}
|
}
|
||||||
|
|
||||||
//HWD.pfnSetBlend(blend); // This seems to actually break translucency?
|
//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
|
//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
|
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
|
||||||
|
|
@ -1690,17 +1688,25 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
||||||
p.anglez = FIXED_TO_FLOAT(AngleFixed(R_InterpolateAngle(spr->mobj->old_pitch, spr->mobj->pitch)));
|
p.anglez = FIXED_TO_FLOAT(AngleFixed(R_InterpolateAngle(spr->mobj->old_pitch, spr->mobj->pitch)));
|
||||||
p.anglex = FIXED_TO_FLOAT(AngleFixed(R_InterpolateAngle(spr->mobj->old_roll, spr->mobj->roll)));
|
p.anglex = FIXED_TO_FLOAT(AngleFixed(R_InterpolateAngle(spr->mobj->old_roll, spr->mobj->roll)));
|
||||||
|
|
||||||
// SRB2CBTODO: MD2 scaling support
|
|
||||||
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
|
||||||
|
|
||||||
p.flip = atransform.flip;
|
p.flip = atransform.flip;
|
||||||
p.mirror = atransform.mirror;
|
p.mirror = atransform.mirror;
|
||||||
|
|
||||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||||
{
|
{
|
||||||
float xs = finalscale * FIXED_TO_FLOAT(spr->mobj->spritexscale);
|
float this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||||
float ys = finalscale * FIXED_TO_FLOAT(spr->mobj->spriteyscale);
|
|
||||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, xs, ys, flip, hflip, &Surf);
|
float xs = this_scale * FIXED_TO_FLOAT(spr->mobj->spritexscale);
|
||||||
|
float ys = this_scale * FIXED_TO_FLOAT(spr->mobj->spriteyscale);
|
||||||
|
|
||||||
|
float ox = xs * FIXED_TO_FLOAT(spr->mobj->spritexoffset);
|
||||||
|
float oy = ys * FIXED_TO_FLOAT(spr->mobj->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…
Add table
Reference in a new issue