mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-25 20:20:52 +00:00
Wireframe mode for OpenGL
This commit is contained in:
parent
2d8230cb27
commit
2fb1c5f1ef
4 changed files with 34 additions and 0 deletions
|
@ -295,6 +295,7 @@ enum hwdsetspecialstate
|
|||
HWD_SET_SHADERS,
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
HWD_SET_WIREFRAME,
|
||||
HWD_NUMSTATE
|
||||
};
|
||||
|
||||
|
|
|
@ -178,6 +178,11 @@ static boolean HWR_UseShader(void)
|
|||
return (cv_glshaders.value && gl_shadersavailable);
|
||||
}
|
||||
|
||||
static boolean HWR_IsWireframeMode(void)
|
||||
{
|
||||
return (cv_glwireframe.value && cv_debug);
|
||||
}
|
||||
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap)
|
||||
{
|
||||
RGBA_t poly_color, tint_color, fade_color;
|
||||
|
@ -5642,6 +5647,9 @@ void HWR_BuildSkyDome(void)
|
|||
|
||||
static void HWR_DrawSkyBackground(player_t *player)
|
||||
{
|
||||
if (HWR_IsWireframeMode())
|
||||
return;
|
||||
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
|
||||
if (cv_glskydome.value)
|
||||
|
@ -5994,6 +6002,9 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
|
|||
// Reset the shader state.
|
||||
HWR_SetShaderState();
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 1);
|
||||
|
||||
validcount++;
|
||||
|
||||
if (cv_glbatching.value)
|
||||
|
@ -6056,6 +6067,9 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
|
|||
HWR_CreateDrawNodes();
|
||||
}
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 0);
|
||||
|
||||
HWD.pfnSetTransform(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
|
||||
|
@ -6208,6 +6222,9 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
|||
// Reset the shader state.
|
||||
HWR_SetShaderState();
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 1);
|
||||
|
||||
ps_numbspcalls = 0;
|
||||
ps_numpolyobjects = 0;
|
||||
ps_bsptime = I_GetPreciseTime();
|
||||
|
@ -6284,6 +6301,9 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
|||
HWR_CreateDrawNodes();
|
||||
}
|
||||
|
||||
if (HWR_IsWireframeMode())
|
||||
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 0);
|
||||
|
||||
HWD.pfnSetTransform(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
|
||||
|
@ -6361,6 +6381,8 @@ consvar_t cv_glsolvetjoin = CVAR_INIT ("gr_solvetjoin", "On", 0, CV_OnOff, NULL)
|
|||
|
||||
consvar_t cv_glbatching = CVAR_INIT ("gr_batching", "On", 0, CV_OnOff, NULL);
|
||||
|
||||
consvar_t cv_glwireframe = CVAR_INIT ("gr_wireframe", "Off", 0, CV_OnOff, NULL);
|
||||
|
||||
static void CV_glfiltermode_OnChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
|
@ -6401,6 +6423,8 @@ void HWR_AddCommands(void)
|
|||
|
||||
CV_RegisterVar(&cv_glbatching);
|
||||
|
||||
CV_RegisterVar(&cv_glwireframe);
|
||||
|
||||
#ifndef NEWCLIP
|
||||
CV_RegisterVar(&cv_glclipwalls);
|
||||
#endif
|
||||
|
|
|
@ -106,6 +106,8 @@ extern consvar_t cv_glslopecontrast;
|
|||
|
||||
extern consvar_t cv_glbatching;
|
||||
|
||||
extern consvar_t cv_glwireframe;
|
||||
|
||||
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowy;
|
||||
|
||||
extern float gl_viewwindowx, gl_basewindowcentery;
|
||||
|
|
|
@ -301,6 +301,8 @@ typedef void (APIENTRY * PFNglDisable) (GLenum cap);
|
|||
static PFNglDisable pglDisable;
|
||||
typedef void (APIENTRY * PFNglGetFloatv) (GLenum pname, GLfloat *params);
|
||||
static PFNglGetFloatv pglGetFloatv;
|
||||
typedef void (APIENTRY * PFNglPolygonMode) (GLenum, GLenum);
|
||||
static PFNglPolygonMode pglPolygonMode;
|
||||
|
||||
/* Depth Buffer */
|
||||
typedef void (APIENTRY * PFNglClearDepth) (GLclampd depth);
|
||||
|
@ -475,6 +477,7 @@ boolean SetupGLfunc(void)
|
|||
GETOPENGLFUNC(pglGetFloatv, glGetFloatv)
|
||||
GETOPENGLFUNC(pglGetIntegerv, glGetIntegerv)
|
||||
GETOPENGLFUNC(pglGetString, glGetString)
|
||||
GETOPENGLFUNC(pglPolygonMode, glPolygonMode)
|
||||
|
||||
GETOPENGLFUNC(pglClearDepth, glClearDepth)
|
||||
GETOPENGLFUNC(pglDepthFunc, glDepthFunc)
|
||||
|
@ -2467,6 +2470,10 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
|||
Flush(); //??? if we want to change filter mode by texture, remove this
|
||||
break;
|
||||
|
||||
case HWD_SET_WIREFRAME:
|
||||
pglPolygonMode(GL_FRONT_AND_BACK, Value ? GL_LINE : GL_FILL);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue