mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-14 17:00:39 +00:00
More Softwarification
This commit is contained in:
parent
a8165a2ce9
commit
d1b1edcf39
10 changed files with 45 additions and 21 deletions
|
@ -320,12 +320,12 @@ void gld_clipper_Clear(void)
|
|||
|
||||
#define RMUL (1.6f/1.333333f)
|
||||
|
||||
angle_t gld_FrustumAngle(void)
|
||||
angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
{
|
||||
double floatangle;
|
||||
angle_t a1;
|
||||
|
||||
float tilt = (float)fabs(((double)(int)aimingangle) / ANG1);
|
||||
float tilt = (float)fabs(((double)(int)tiltangle) / ANG1);
|
||||
|
||||
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
||||
|
||||
|
@ -334,12 +334,10 @@ angle_t gld_FrustumAngle(void)
|
|||
float render_multiplier = 64.0f / render_fovratio / RMUL;
|
||||
|
||||
if (tilt > 90.0f)
|
||||
{
|
||||
tilt = 90.0f;
|
||||
}
|
||||
|
||||
// If the pitch is larger than this you can look all around at a FOV of 90
|
||||
if (abs((signed)aimingangle) > 46 * ANG1)
|
||||
if (abs((signed)tiltangle) > 46 * ANG1)
|
||||
return 0xffffffff;
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
|
||||
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
|
||||
void gld_clipper_Clear(void);
|
||||
angle_t gld_FrustumAngle(void);
|
||||
angle_t gld_FrustumAngle(angle_t tiltangle);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
void gld_FrustrumSetup(void);
|
||||
boolean gld_SphereInFrustum(float x, float y, float z, float radius);
|
||||
|
|
|
@ -157,6 +157,7 @@ typedef struct
|
|||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
#endif
|
||||
boolean shearing; // 14042019
|
||||
} FTransform;
|
||||
|
||||
// Transformed vector, as passed to HWR API
|
||||
|
|
|
@ -48,7 +48,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
|||
//Hurdler: added for new development
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface);
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform, angle_t viewaiming);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
|
|
|
@ -118,6 +118,7 @@ FTransform atransform;
|
|||
// Float variants of viewx, viewy, viewz, etc.
|
||||
static float gr_viewx, gr_viewy, gr_viewz;
|
||||
static float gr_viewsin, gr_viewcos;
|
||||
static angle_t gr_aimingangle;
|
||||
|
||||
static INT32 drawcount = 0;
|
||||
|
||||
|
@ -3843,9 +3844,10 @@ void HWR_RenderDrawNodes(void)
|
|||
} //i++
|
||||
} // loop++
|
||||
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
HWD.pfnSetShader(0);
|
||||
// Okay! Let's draw it all! Woo!
|
||||
HWD.pfnSetTransform(&atransform, aimingangle);
|
||||
HWD.pfnSetShader(0);
|
||||
|
||||
for (i = 0; i < p; i++)
|
||||
{
|
||||
if (sortnode[sortindex[i]].plane)
|
||||
|
@ -4464,7 +4466,19 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
|||
atransform.scaley = (float)vid.width/vid.height;
|
||||
atransform.scalez = 1;
|
||||
|
||||
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
// 14042019
|
||||
if (!cv_grshearing.value)
|
||||
{
|
||||
gr_aimingangle = aimingangle;
|
||||
atransform.shearing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
gr_aimingangle = 0;
|
||||
atransform.shearing = true;
|
||||
}
|
||||
|
||||
atransform.anglex = (float)(gr_aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
|
||||
atransform.fovxangle = fpov; // Tails
|
||||
|
@ -4492,7 +4506,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
|||
if (skybox)
|
||||
drewsky = true;
|
||||
|
||||
a1 = gld_FrustumAngle();
|
||||
a1 = gld_FrustumAngle(gr_aimingangle);
|
||||
gld_clipper_Clear();
|
||||
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
|
@ -4500,7 +4514,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
|||
#endif
|
||||
|
||||
// Set transform and shader
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
HWD.pfnSetTransform(&atransform, aimingangle);
|
||||
HWD.pfnSetShader(0);
|
||||
|
||||
// Check for shaders
|
||||
|
@ -4529,7 +4543,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
|||
HWR_RenderDrawNodes();
|
||||
|
||||
// Unset transform and shader
|
||||
HWD.pfnSetTransform(NULL);
|
||||
HWD.pfnSetTransform(NULL, 0.0f);
|
||||
HWD.pfnUnSetShader();
|
||||
|
||||
// Disable fog
|
||||
|
|
|
@ -127,6 +127,7 @@ void HWR_CorrectSWTricks(void);
|
|||
|
||||
// Console variables
|
||||
extern consvar_t cv_grshaders;
|
||||
extern consvar_t cv_grshearing;
|
||||
extern consvar_t cv_grfov;
|
||||
extern consvar_t cv_grmd2;
|
||||
extern consvar_t cv_grfog;
|
||||
|
|
|
@ -185,8 +185,6 @@ FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
|
|||
#define pglEnable glEnable
|
||||
#define pglDisable glDisable
|
||||
#define pglGetFloatv glGetFloatv
|
||||
//glGetIntegerv
|
||||
//glGetString
|
||||
|
||||
/* Depth Buffer */
|
||||
#define pglClearDepth glClearDepth
|
||||
|
@ -253,7 +251,6 @@ FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
|
|||
/* Miscellaneous */
|
||||
typedef void (APIENTRY * PFNglClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
static PFNglClearColor pglClearColor;
|
||||
//glClear
|
||||
typedef void (APIENTRY * PFNglColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
static PFNglColorMask pglColorMask;
|
||||
typedef void (APIENTRY * PFNglAlphaFunc) (GLenum func, GLclampf ref);
|
||||
|
@ -272,8 +269,6 @@ typedef void (APIENTRY * PFNglDisable) (GLenum cap);
|
|||
static PFNglDisable pglDisable;
|
||||
typedef void (APIENTRY * PFNglGetFloatv) (GLenum pname, GLfloat *params);
|
||||
static PFNglGetFloatv pglGetFloatv;
|
||||
//glGetIntegerv
|
||||
//glGetString
|
||||
|
||||
/* Depth Buffer */
|
||||
typedef void (APIENTRY * PFNglClearDepth) (GLclampd depth);
|
||||
|
@ -2183,7 +2178,7 @@ EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration,
|
|||
// -----------------+
|
||||
// SetTransform :
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform, angle_t viewaiming)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
pglLoadIdentity();
|
||||
|
@ -2204,12 +2199,27 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
else
|
||||
pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
pglRotatef(stransform->anglex, 1.0f, 0.0f, 0.0f);
|
||||
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
||||
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
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)
|
||||
|
|
|
@ -71,7 +71,6 @@ boolean SetupGLfunc(void);
|
|||
void SetupGLFunc4(void);
|
||||
void Flush(void);
|
||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||
int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepthBits);
|
||||
void SetModelView(GLint w, GLint h);
|
||||
void SetStates(void);
|
||||
#ifdef USE_PALETTED_TEXTURE
|
||||
|
|
|
@ -1395,6 +1395,7 @@ void R_RegisterEngineStuff(void)
|
|||
CV_RegisterVar(&cv_grsoftwarefog);
|
||||
CV_RegisterVar(&cv_grfogdensity);
|
||||
CV_RegisterVar(&cv_grmd2);
|
||||
CV_RegisterVar(&cv_grshearing);
|
||||
CV_RegisterVar(&cv_grshaders);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ consvar_t cv_grgammagreen = {"gr_gammagreen", "127", CV_SAVE|CV_CALL, grgamma_co
|
|||
consvar_t cv_grgammablue = {"gr_gammablue", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
||||
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
|
||||
// console variables in development
|
||||
consvar_t cv_grmd2 = {"gr_md2", "Off", CV_SAVE, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue