mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 20:31:30 +00:00
Merge branch 'md2-interpolation-fix' into 'master'
MD2 interpolation fix Closes #28 See merge request STJr/SRB2!212
This commit is contained in:
commit
b63bd97b1a
3 changed files with 16 additions and 17 deletions
|
@ -66,7 +66,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||||
|
|
||||||
//Hurdler: added for new development
|
//Hurdler: added for new development
|
||||||
EXPORT void HWRAPI(DrawMD2) (INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransform *pos, float scale);
|
EXPORT void HWRAPI(DrawMD2) (INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransform *pos, float scale);
|
||||||
EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color);
|
EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration, INT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color);
|
||||||
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
||||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||||
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
||||||
|
|
|
@ -1252,8 +1252,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
{
|
{
|
||||||
GLPatch_t *gpatch;
|
GLPatch_t *gpatch;
|
||||||
INT32 *buff;
|
INT32 *buff;
|
||||||
UINT32 durs = spr->mobj->state->tics;
|
INT32 durs = spr->mobj->state->tics;
|
||||||
UINT32 tics = spr->mobj->tics;
|
INT32 tics = spr->mobj->tics;
|
||||||
md2_frame_t *curr, *next = NULL;
|
md2_frame_t *curr, *next = NULL;
|
||||||
const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP);
|
const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP);
|
||||||
spritedef_t *sprdef;
|
spritedef_t *sprdef;
|
||||||
|
|
|
@ -1819,15 +1819,14 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
|
static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration, INT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
|
||||||
{
|
{
|
||||||
INT32 val, count, pindex;
|
INT32 val, count, pindex;
|
||||||
GLfloat s, t;
|
GLfloat s, t;
|
||||||
GLfloat ambient[4];
|
GLfloat ambient[4];
|
||||||
GLfloat diffuse[4];
|
GLfloat diffuse[4];
|
||||||
|
|
||||||
float pol;
|
float pol = 0.0f;
|
||||||
UINT32 newtime;
|
|
||||||
float scalex = scale, scaley = scale, scalez = scale;
|
float scalex = scale, scaley = scale, scalez = scale;
|
||||||
|
|
||||||
// Because Otherwise, scaling the screen negatively vertically breaks the lighting
|
// Because Otherwise, scaling the screen negatively vertically breaks the lighting
|
||||||
|
@ -1835,10 +1834,9 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
|
||||||
GLfloat LightPos[] = {0.0f, 1.0f, 0.0f, 0.0f};
|
GLfloat LightPos[] = {0.0f, 1.0f, 0.0f, 0.0f};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (duration == 0)
|
if (duration != 0 && duration != -1 && tics != -1) // don't interpolate if instantaneous or infinite in length
|
||||||
duration = 1;
|
{
|
||||||
|
UINT32 newtime = (duration - tics); // + 1;
|
||||||
newtime = (duration - tics) + 1;
|
|
||||||
|
|
||||||
pol = (newtime)/(float)duration;
|
pol = (newtime)/(float)duration;
|
||||||
|
|
||||||
|
@ -1847,6 +1845,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
|
||||||
|
|
||||||
if (pol < 0.0f)
|
if (pol < 0.0f)
|
||||||
pol = 0.0f;
|
pol = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (color)
|
if (color)
|
||||||
{
|
{
|
||||||
|
@ -1940,7 +1939,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
|
||||||
|
|
||||||
pglTexCoord2f(s, t);
|
pglTexCoord2f(s, t);
|
||||||
|
|
||||||
if (!nextframe)
|
if (!nextframe || pol == 0.0f)
|
||||||
{
|
{
|
||||||
pglNormal3f(frame->vertices[pindex].normal[0],
|
pglNormal3f(frame->vertices[pindex].normal[0],
|
||||||
frame->vertices[pindex].normal[1],
|
frame->vertices[pindex].normal[1],
|
||||||
|
@ -1990,7 +1989,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
|
||||||
// -----------------+
|
// -----------------+
|
||||||
// HWRAPI DrawMD2 : Draw an MD2 model with glcommands
|
// HWRAPI DrawMD2 : Draw an MD2 model with glcommands
|
||||||
// -----------------+
|
// -----------------+
|
||||||
EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
|
EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration, INT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
|
||||||
{
|
{
|
||||||
DrawMD2Ex(gl_cmd_buffer, frame, duration, tics, nextframe, pos, scale, flipped, color);
|
DrawMD2Ex(gl_cmd_buffer, frame, duration, tics, nextframe, pos, scale, flipped, color);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue