mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-17 23:21:05 +00:00
Match Kart-Public's next since it got merged anyway
and fix something else
This commit is contained in:
parent
6b6485159f
commit
2ff4a3ca75
5 changed files with 48 additions and 41 deletions
|
@ -428,13 +428,17 @@ INT32 I_GetKey(void);
|
||||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef M_PIl
|
||||||
|
#define M_PIl 3.1415926535897932384626433832795029L
|
||||||
|
#endif
|
||||||
|
|
||||||
// Floating point comparison epsilons from float.h
|
// Floating point comparison epsilons from float.h
|
||||||
#ifndef FLT_EPSILON
|
#ifndef FLT_EPSILON
|
||||||
#define FLT_EPSILON 1.1920928955078125e-7f
|
#define FLT_EPSILON 1.1920928955078125e-7f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DBL_EPSILON
|
#ifndef DBL_EPSILON
|
||||||
#define DBL_EPSILON 2.2204460492503131e-16
|
#define DBL_EPSILON 2.2204460492503131e-16l
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// An assert-type mechanism.
|
// An assert-type mechanism.
|
||||||
|
|
|
@ -114,7 +114,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||||
// (do not accept hit with the extensions)
|
// (do not accept hit with the extensions)
|
||||||
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
||||||
frac = num / den;
|
frac = num / den;
|
||||||
if (frac < 0.0 || frac > 1.0)
|
if (frac < 0.0l || frac > 1.0l)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// now get the frac along the BSP line
|
// now get the frac along the BSP line
|
||||||
|
|
|
@ -59,9 +59,6 @@
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
#ifndef M_PIl
|
|
||||||
#define M_PIl 3.1415926535897932384626433832795029L
|
|
||||||
#endif
|
|
||||||
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
||||||
|
|
||||||
void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/;
|
void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/;
|
||||||
|
|
|
@ -1894,6 +1894,10 @@ static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
|
pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
|
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
|
// Don't leave the array buffer bound to the model,
|
||||||
|
// since this is called mid-frame
|
||||||
|
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||||
|
@ -1935,6 +1939,10 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
|
pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
|
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
|
// Don't leave the array buffer bound to the model,
|
||||||
|
// since this is called mid-frame
|
||||||
|
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||||
|
@ -2181,10 +2189,13 @@ EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration,
|
||||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform, angle_t viewaiming)
|
EXPORT void HWRAPI(SetTransform) (FTransform *stransform, angle_t viewaiming)
|
||||||
{
|
{
|
||||||
static boolean special_splitscreen;
|
static boolean special_splitscreen;
|
||||||
|
GLdouble used_fov;
|
||||||
|
boolean shearing = false;
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
if (stransform)
|
if (stransform)
|
||||||
{
|
{
|
||||||
boolean fovx90;
|
used_fov = stransform->fovxangle;
|
||||||
|
shearing = stransform->shearing;
|
||||||
// keep a trace of the transformation for md2
|
// keep a trace of the transformation for md2
|
||||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||||
|
|
||||||
|
@ -2204,46 +2215,41 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform, angle_t viewaiming)
|
||||||
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
||||||
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
||||||
|
|
||||||
pglMatrixMode(GL_PROJECTION);
|
special_splitscreen = (stransform->splitscreen == 1);
|
||||||
pglLoadIdentity();
|
|
||||||
|
|
||||||
// jimita 14042019
|
|
||||||
// Simulate Software's y-shearing
|
|
||||||
// https://zdoom.org/wiki/Y-shearing
|
|
||||||
if (stransform->shearing)
|
|
||||||
{
|
|
||||||
float tilt = (float)(viewaiming>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
|
||||||
if (tilt >= 270.0f)
|
|
||||||
tilt = -(90.0f - (tilt - 270.0f));
|
|
||||||
tilt /= 24.0f; // ?????????
|
|
||||||
|
|
||||||
pglTranslatef(0.0f, -tilt, 0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
fovx90 = stransform->fovxangle > 0.0f && fabsf(stransform->fovxangle - 90.0f) < 0.5f;
|
|
||||||
special_splitscreen = (stransform->splitscreen && fovx90);
|
|
||||||
if (special_splitscreen)
|
|
||||||
GLPerspective(53.13f, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
|
||||||
else
|
|
||||||
GLPerspective(stransform->fovxangle, ASPECT_RATIO);
|
|
||||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
|
||||||
pglMatrixMode(GL_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//Hurdler: is "fov" correct?
|
||||||
|
used_fov = fov;
|
||||||
pglScalef(1.0f, 1.0f, -1.0f);
|
pglScalef(1.0f, 1.0f, -1.0f);
|
||||||
|
|
||||||
pglMatrixMode(GL_PROJECTION);
|
|
||||||
pglLoadIdentity();
|
|
||||||
if (special_splitscreen)
|
|
||||||
GLPerspective(53.13f, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
|
||||||
else
|
|
||||||
//Hurdler: is "fov" correct?
|
|
||||||
GLPerspective(fov, ASPECT_RATIO);
|
|
||||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
|
||||||
pglMatrixMode(GL_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pglMatrixMode(GL_PROJECTION);
|
||||||
|
pglLoadIdentity();
|
||||||
|
|
||||||
|
// jimita 14042019
|
||||||
|
// Simulate Software's y-shearing
|
||||||
|
// https://zdoom.org/wiki/Y-shearing
|
||||||
|
if (shearing)
|
||||||
|
{
|
||||||
|
float tilt = (float)(viewaiming>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||||
|
if (tilt >= 270.0f)
|
||||||
|
tilt = -(90.0f - (tilt - 270.0f));
|
||||||
|
tilt /= 24.0f; // ?????????
|
||||||
|
|
||||||
|
pglTranslatef(0.0f, -tilt, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (special_splitscreen)
|
||||||
|
{
|
||||||
|
used_fov = atan(tan(used_fov*M_PIl/360)*0.8)*360/M_PIl;
|
||||||
|
GLPerspective((GLfloat)used_fov, 2*ASPECT_RATIO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
GLPerspective((GLfloat)used_fov, ASPECT_RATIO);
|
||||||
|
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||||
|
pglMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -973,7 +973,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
|
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
|
||||||
zeroheight = FIXED_TO_FLOAT(temp);
|
zeroheight = FIXED_TO_FLOAT(temp);
|
||||||
|
|
||||||
#define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180)
|
#define ANG2RAD(angle) ((float)((angle)*M_PIl)/ANGLE_180)
|
||||||
|
|
||||||
// p is the texture origin in view space
|
// p is the texture origin in view space
|
||||||
// Don't add in the offsets at this stage, because doing so can result in
|
// Don't add in the offsets at this stage, because doing so can result in
|
||||||
|
|
Loading…
Reference in a new issue