Browse Source

engine, ref: create shared cvars list, register them at engine side, make a generic macro to declare, define and get all pointers at ref side

pull/2/head
Alibek Omarov 3 years ago
parent
commit
d7db48ce4b
  1. 11
      engine/client/ref_common.c
  2. 44
      engine/ref_api.h
  3. 15
      ref_gl/gl_local.h
  4. 42
      ref_gl/gl_opengl.c
  5. 4
      ref_gl/gl_studio.c
  6. 2
      ref_soft/r_context.c
  7. 63
      ref_soft/r_local.h
  8. 32
      ref_soft/r_main.c
  9. 4
      ref_soft/r_studio.c

11
engine/client/ref_common.c

@ -647,6 +647,17 @@ qboolean R_Init( void )
r_showtree = Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" ); r_showtree = Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
r_refdll = Cvar_Get( "r_refdll", "", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "choose renderer implementation, if supported" ); r_refdll = Cvar_Get( "r_refdll", "", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "choose renderer implementation, if supported" );
// cvars that are expected to exist
gEngfuncs.Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
gEngfuncs.Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" );
gEngfuncs.Cvar_Get( "r_dynamic", "1", FCVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
gEngfuncs.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
gEngfuncs.Cvar_Get( "tracerred", "0.8", 0, "tracer red component weight ( 0 - 1.0 )" );
gEngfuncs.Cvar_Get( "tracergreen", "0.8", 0, "tracer green component weight ( 0 - 1.0 )" );
gEngfuncs.Cvar_Get( "tracerblue", "0.4", 0, "tracer blue component weight ( 0 - 1.0 )" );
gEngfuncs.Cvar_Get( "traceralpha", "0.5", 0, "tracer alpha amount ( 0 - 1.0 )" );
// cvars that are expected to exist by client.dll // cvars that are expected to exist by client.dll
// refdll should just get pointer to them // refdll should just get pointer to them
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" ); Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );

44
engine/ref_api.h

@ -623,4 +623,48 @@ typedef int (*REFAPI)( int version, ref_interface_t *pFunctionTable, ref_api_t*
typedef void (*REF_HUMANREADABLE_NAME)( char *out, size_t len ); typedef void (*REF_HUMANREADABLE_NAME)( char *out, size_t len );
#define GET_REF_HUMANREADABLE_NAME "GetRefHumanReadableName" #define GET_REF_HUMANREADABLE_NAME "GetRefHumanReadableName"
#ifdef REF_DLL
#define DEFINE_ENGINE_SHARED_CVAR( x, y ) cvar_t *x = NULL;
#define DECLARE_ENGINE_SHARED_CVAR( x, y ) extern cvar_t *x;
#define RETRIEVE_ENGINE_SHARED_CVAR( x, y ) \
if(!( x = gEngfuncs.pfnGetCvarPointer( #y, 0 ) )) \
gEngfuncs.Host_Error( S_ERROR "engine betrayed us and didn't gave us %s cvar pointer\n", #y );
#define ENGINE_SHARED_CVAR_NAME( f, x, y ) f( x, y )
#define ENGINE_SHARED_CVAR( f, x ) ENGINE_SHARED_CVAR_NAME( f, x, x )
// cvars that's logic is shared between renderer and engine
// actually, they are just created on engine side for convinience
// and must be retrieved by renderer side
// sometimes it's done to standartize cvars to make it easier for users
#define ENGINE_SHARED_CVAR_LIST( f ) \
ENGINE_SHARED_CVAR_NAME( f, vid_gamma, gamma ) \
ENGINE_SHARED_CVAR_NAME( f, vid_brightness, brightness ) \
ENGINE_SHARED_CVAR_NAME( f, gl_showtextures, r_showtextures ) \
ENGINE_SHARED_CVAR( f, r_speeds ) \
ENGINE_SHARED_CVAR( f, r_fullbright ) \
ENGINE_SHARED_CVAR( f, r_norefresh ) \
ENGINE_SHARED_CVAR( f, r_lightmap ) \
ENGINE_SHARED_CVAR( f, r_dynamic ) \
ENGINE_SHARED_CVAR( f, r_drawentities ) \
ENGINE_SHARED_CVAR( f, r_decals ) \
ENGINE_SHARED_CVAR( f, r_showhull ) \
ENGINE_SHARED_CVAR( f, gl_vsync ) \
ENGINE_SHARED_CVAR( f, gl_clear ) \
ENGINE_SHARED_CVAR( f, cl_himodels ) \
ENGINE_SHARED_CVAR( f, cl_lightstyle_lerping ) \
ENGINE_SHARED_CVAR( f, tracerred ) \
ENGINE_SHARED_CVAR( f, tracergreen ) \
ENGINE_SHARED_CVAR( f, tracerblue ) \
ENGINE_SHARED_CVAR( f, traceralpha ) \
#define DECLARE_ENGINE_SHARED_CVAR_LIST() \
ENGINE_SHARED_CVAR_LIST( DECLARE_ENGINE_SHARED_CVAR )
#define DEFINE_ENGINE_SHARED_CVAR_LIST() \
ENGINE_SHARED_CVAR_LIST( DEFINE_ENGINE_SHARED_CVAR )
#define RETRIEVE_ENGINE_SHARED_CVAR_LIST() \
ENGINE_SHARED_CVAR_LIST( RETRIEVE_ENGINE_SHARED_CVAR )
#endif
#endif // REF_API #endif // REF_API

15
ref_gl/gl_local.h

@ -734,9 +734,6 @@ extern cvar_t *gl_test; // cvar to testify new effects
extern cvar_t *gl_msaa; extern cvar_t *gl_msaa;
extern cvar_t *gl_stencilbits; extern cvar_t *gl_stencilbits;
extern cvar_t *r_speeds;
extern cvar_t *r_fullbright;
extern cvar_t *r_norefresh;
extern cvar_t *r_lighting_extended; extern cvar_t *r_lighting_extended;
extern cvar_t *r_lighting_modulate; extern cvar_t *r_lighting_modulate;
extern cvar_t *r_lighting_ambient; extern cvar_t *r_lighting_ambient;
@ -749,24 +746,14 @@ extern cvar_t *r_nocull;
extern cvar_t *r_lockpvs; extern cvar_t *r_lockpvs;
extern cvar_t *r_lockfrustum; extern cvar_t *r_lockfrustum;
extern cvar_t *r_traceglow; extern cvar_t *r_traceglow;
extern cvar_t *r_dynamic;
extern cvar_t *r_lightmap;
extern cvar_t *r_vbo; extern cvar_t *r_vbo;
extern cvar_t *r_vbo_dlightmode; extern cvar_t *r_vbo_dlightmode;
extern cvar_t *vid_brightness;
extern cvar_t *vid_gamma;
// //
// engine shared convars // engine shared convars
// //
extern cvar_t *gl_showtextures; DECLARE_ENGINE_SHARED_CVAR_LIST()
extern cvar_t *tracerred;
extern cvar_t *tracergreen;
extern cvar_t *tracerblue;
extern cvar_t *traceralpha;
extern cvar_t *cl_lightstyle_lerping;
extern cvar_t *r_showhull;
// //
// engine callbacks // engine callbacks

42
ref_gl/gl_opengl.c

@ -22,14 +22,10 @@ cvar_t *gl_clear;
cvar_t *gl_test; cvar_t *gl_test;
cvar_t *gl_msaa; cvar_t *gl_msaa;
cvar_t *gl_stencilbits; cvar_t *gl_stencilbits;
cvar_t *r_speeds;
cvar_t *r_fullbright;
cvar_t *r_norefresh;
cvar_t *r_lighting_extended; cvar_t *r_lighting_extended;
cvar_t *r_lighting_modulate; cvar_t *r_lighting_modulate;
cvar_t *r_lighting_ambient; cvar_t *r_lighting_ambient;
cvar_t *r_detailtextures; cvar_t *r_detailtextures;
cvar_t *r_drawentities;
cvar_t *r_adjust_fov; cvar_t *r_adjust_fov;
cvar_t *r_decals; cvar_t *r_decals;
cvar_t *r_novis; cvar_t *r_novis;
@ -38,21 +34,17 @@ cvar_t *r_lockpvs;
cvar_t *r_lockfrustum; cvar_t *r_lockfrustum;
cvar_t *r_traceglow; cvar_t *r_traceglow;
cvar_t *r_dynamic; cvar_t *r_dynamic;
cvar_t *r_lightmap;
cvar_t *r_showhull;
cvar_t *gl_round_down; cvar_t *gl_round_down;
cvar_t *r_vbo; cvar_t *r_vbo;
cvar_t *r_vbo_dlightmode; cvar_t *r_vbo_dlightmode;
cvar_t *gl_showtextures;
cvar_t *cl_lightstyle_lerping;
cvar_t *vid_brightness;
cvar_t *vid_gamma;
cvar_t *tracerred; cvar_t *tracerred;
cvar_t *tracergreen; cvar_t *tracergreen;
cvar_t *tracerblue; cvar_t *tracerblue;
cvar_t *traceralpha; cvar_t *traceralpha;
DEFINE_ENGINE_SHARED_CVAR_LIST()
poolhandle_t r_temppool; poolhandle_t r_temppool;
gl_globals_t tr; gl_globals_t tr;
@ -837,58 +829,40 @@ GL_InitCommands
*/ */
void GL_InitCommands( void ) void GL_InitCommands( void )
{ {
r_speeds = gEngfuncs.Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" ); RETRIEVE_ENGINE_SHARED_CVAR_LIST();
r_fullbright = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
r_norefresh = gEngfuncs.Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" ); r_lighting_extended = gEngfuncs.Cvar_Get( "r_lighting_extended", "1", FCVAR_GLCONFIG, "allow to get lighting from world and bmodels" );
r_lighting_extended = gEngfuncs.Cvar_Get( "r_lighting_extended", "1", FCVAR_ARCHIVE, "allow to get lighting from world and bmodels" ); r_lighting_modulate = gEngfuncs.Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_GLCONFIG, "lightstyles modulate scale" );
r_lighting_modulate = gEngfuncs.Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "lightstyles modulate scale" ); r_lighting_ambient = gEngfuncs.Cvar_Get( "r_lighting_ambient", "0.3", FCVAR_GLCONFIG, "map ambient lighting scale" );
r_lighting_ambient = gEngfuncs.Cvar_Get( "r_lighting_ambient", "0.3", FCVAR_ARCHIVE, "map ambient lighting scale" );
r_novis = gEngfuncs.Cvar_Get( "r_novis", "0", 0, "ignore vis information (perfomance test)" ); r_novis = gEngfuncs.Cvar_Get( "r_novis", "0", 0, "ignore vis information (perfomance test)" );
r_nocull = gEngfuncs.Cvar_Get( "r_nocull", "0", 0, "ignore frustrum culling (perfomance test)" ); r_nocull = gEngfuncs.Cvar_Get( "r_nocull", "0", 0, "ignore frustrum culling (perfomance test)" );
r_detailtextures = gEngfuncs.Cvar_Get( "r_detailtextures", "1", FCVAR_ARCHIVE, "enable detail textures support" ); r_detailtextures = gEngfuncs.Cvar_Get( "r_detailtextures", "1", FCVAR_ARCHIVE, "enable detail textures support" );
r_lockpvs = gEngfuncs.Cvar_Get( "r_lockpvs", "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" ); r_lockpvs = gEngfuncs.Cvar_Get( "r_lockpvs", "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" );
r_lockfrustum = gEngfuncs.Cvar_Get( "r_lockfrustum", "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" ); r_lockfrustum = gEngfuncs.Cvar_Get( "r_lockfrustum", "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" );
r_dynamic = gEngfuncs.Cvar_Get( "r_dynamic", "1", FCVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
r_traceglow = gEngfuncs.Cvar_Get( "r_traceglow", "1", FCVAR_ARCHIVE, "cull flares behind models" ); r_traceglow = gEngfuncs.Cvar_Get( "r_traceglow", "1", FCVAR_ARCHIVE, "cull flares behind models" );
r_lightmap = gEngfuncs.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
r_drawentities = gEngfuncs.pfnGetCvarPointer( "r_drawentities", 0 );
r_decals = gEngfuncs.pfnGetCvarPointer( "r_decals", 0 );
r_showhull = gEngfuncs.pfnGetCvarPointer( "r_showhull", 0 );
gl_extensions = gEngfuncs.Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "allow gl_extensions" ); gl_extensions = gEngfuncs.Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "allow gl_extensions" );
gl_texture_nearest = gEngfuncs.Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" ); gl_texture_nearest = gEngfuncs.Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" );
gl_lightmap_nearest = gEngfuncs.Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_ARCHIVE, "disable lightmap filter" ); gl_lightmap_nearest = gEngfuncs.Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_ARCHIVE, "disable lightmap filter" );
gl_check_errors = gEngfuncs.Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" ); gl_check_errors = gEngfuncs.Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" );
gl_vsync = gEngfuncs.pfnGetCvarPointer( "gl_vsync", 0 );
gl_texture_anisotropy = gEngfuncs.Cvar_Get( "gl_anisotropy", "8", FCVAR_ARCHIVE, "textures anisotropic filter" ); gl_texture_anisotropy = gEngfuncs.Cvar_Get( "gl_anisotropy", "8", FCVAR_ARCHIVE, "textures anisotropic filter" );
gl_texture_lodbias = gEngfuncs.Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (perfomance|quality)" ); gl_texture_lodbias = gEngfuncs.Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (perfomance|quality)" );
gl_keeptjunctions = gEngfuncs.Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" ); gl_keeptjunctions = gEngfuncs.Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
gl_emboss_scale = gEngfuncs.Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" ); gl_emboss_scale = gEngfuncs.Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" );
gl_showtextures = gEngfuncs.pfnGetCvarPointer( "r_showtextures", 0 );
gl_finish = gEngfuncs.Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" ); gl_finish = gEngfuncs.Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
gl_nosort = gEngfuncs.Cvar_Get( "gl_nosort", "0", FCVAR_ARCHIVE, "disable sorting of translucent surfaces" ); gl_nosort = gEngfuncs.Cvar_Get( "gl_nosort", "0", FCVAR_ARCHIVE, "disable sorting of translucent surfaces" );
gl_clear = gEngfuncs.pfnGetCvarPointer( "gl_clear", 0 );
gl_test = gEngfuncs.Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" ); gl_test = gEngfuncs.Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" );
gl_wireframe = gEngfuncs.Cvar_Get( "gl_wireframe", "0", FCVAR_ARCHIVE|FCVAR_SPONLY, "show wireframe overlay" ); gl_wireframe = gEngfuncs.Cvar_Get( "gl_wireframe", "0", FCVAR_ARCHIVE|FCVAR_SPONLY, "show wireframe overlay" );
gl_msaa = gEngfuncs.Cvar_Get( "gl_msaa", "1", FCVAR_ARCHIVE, "enable or disable multisample anti-aliasing" ); gl_msaa = gEngfuncs.Cvar_Get( "gl_msaa", "1", FCVAR_ARCHIVE, "enable or disable multisample anti-aliasing" );
gl_stencilbits = gEngfuncs.Cvar_Get( "gl_stencilbits", "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" ); gl_stencilbits = gEngfuncs.Cvar_Get( "gl_stencilbits", "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" );
gl_round_down = gEngfuncs.Cvar_Get( "gl_round_down", "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" ); gl_round_down = gEngfuncs.Cvar_Get( "gl_round_down", "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
// these cvar not used by engine but some mods requires this // these cvar not used by engine but some mods requires this
gl_polyoffset = gEngfuncs.Cvar_Get( "gl_polyoffset", "2.0", FCVAR_ARCHIVE, "polygon offset for decals" ); gl_polyoffset = gEngfuncs.Cvar_Get( "gl_polyoffset", "2.0", FCVAR_ARCHIVE, "polygon offset for decals" );
// make sure gl_vsync is checked after vid_restart // make sure gl_vsync is checked after vid_restart
SetBits( gl_vsync->flags, FCVAR_CHANGED ); SetBits( gl_vsync->flags, FCVAR_CHANGED );
vid_gamma = gEngfuncs.pfnGetCvarPointer( "gamma", 0 );
vid_brightness = gEngfuncs.pfnGetCvarPointer( "brightness", 0 );
tracerred = gEngfuncs.Cvar_Get( "tracerred", "0.8", 0, "tracer red component weight ( 0 - 1.0 )" );
tracergreen = gEngfuncs.Cvar_Get( "tracergreen", "0.8", 0, "tracer green component weight ( 0 - 1.0 )" );
tracerblue = gEngfuncs.Cvar_Get( "tracerblue", "0.4", 0, "tracer blue component weight ( 0 - 1.0 )" );
traceralpha = gEngfuncs.Cvar_Get( "traceralpha", "0.5", 0, "tracer alpha amount ( 0 - 1.0 )" );
cl_lightstyle_lerping = gEngfuncs.pfnGetCvarPointer( "cl_lightstyle_lerping", 0 );
gEngfuncs.Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" ); gEngfuncs.Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
gEngfuncs.Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" ); gEngfuncs.Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
} }

4
ref_gl/gl_studio.c

@ -127,7 +127,6 @@ typedef struct
static cvar_t *r_studio_sort_textures; static cvar_t *r_studio_sort_textures;
static cvar_t *r_drawviewmodel; static cvar_t *r_drawviewmodel;
cvar_t *cl_righthand = NULL; cvar_t *cl_righthand = NULL;
static cvar_t *cl_himodels;
static cvar_t *r_studio_drawelements; static cvar_t *r_studio_drawelements;
static r_studio_interface_t *pStudioDraw; static r_studio_interface_t *pStudioDraw;
@ -152,9 +151,6 @@ R_StudioInit
*/ */
void R_StudioInit( void ) void R_StudioInit( void )
{ {
// guaranteed to exist by engine
cl_himodels = gEngfuncs.pfnGetCvarPointer( "cl_himodels", 0 );
r_studio_sort_textures = gEngfuncs.Cvar_Get( "r_studio_sort_textures", "0", FCVAR_ARCHIVE, "change draw order for additive meshes" ); r_studio_sort_textures = gEngfuncs.Cvar_Get( "r_studio_sort_textures", "0", FCVAR_ARCHIVE, "change draw order for additive meshes" );
r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" ); r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" );
r_studio_drawelements = gEngfuncs.Cvar_Get( "r_studio_drawelements", "1", FCVAR_ARCHIVE, "use glDrawElements for studiomodels" ); r_studio_drawelements = gEngfuncs.Cvar_Get( "r_studio_drawelements", "1", FCVAR_ARCHIVE, "use glDrawElements for studiomodels" );

2
ref_soft/r_context.c

@ -21,8 +21,6 @@ gl_globals_t tr;
ref_speeds_t r_stats; ref_speeds_t r_stats;
poolhandle_t r_temppool; poolhandle_t r_temppool;
cvar_t *gl_emboss_scale; cvar_t *gl_emboss_scale;
cvar_t *r_norefresh;
cvar_t *vid_brightness;
viddef_t vid; viddef_t vid;
static void GAME_EXPORT R_ClearScreen( void ) static void GAME_EXPORT R_ClearScreen( void )
{ {

63
ref_soft/r_local.h

@ -687,72 +687,13 @@ void TriBrightness( float brightness );
extern ref_api_t gEngfuncs; extern ref_api_t gEngfuncs;
extern ref_globals_t *gpGlobals; extern ref_globals_t *gpGlobals;
extern cvar_t *gl_emboss_scale; extern cvar_t *gl_emboss_scale;
extern cvar_t *r_drawentities;
extern cvar_t *vid_brightness;
extern cvar_t *vid_gamma;
extern cvar_t *r_norefresh;
extern cvar_t *r_dynamic; extern cvar_t *r_dynamic;
extern cvar_t *r_lightmap;
DECLARE_ENGINE_SHARED_CVAR_LIST()
// todo: gl_cull.c // todo: gl_cull.c
#define R_CullModel(...) 0 #define R_CullModel(...) 0
#if 0
//
// renderer cvars
//
extern cvar_t *gl_texture_anisotropy;
extern cvar_t *gl_extensions;
extern cvar_t *gl_check_errors;
extern cvar_t *gl_texture_lodbias;
extern cvar_t *gl_texture_nearest;
extern cvar_t *gl_lightmap_nearest;
extern cvar_t *gl_keeptjunctions;
extern cvar_t *gl_round_down;
extern cvar_t *gl_wireframe;
extern cvar_t *gl_polyoffset;
extern cvar_t *gl_finish;
extern cvar_t *gl_nosort;
extern cvar_t *gl_clear;
extern cvar_t *gl_test; // cvar to testify new effects
extern cvar_t *gl_msaa;
extern cvar_t *gl_stencilbits;
extern cvar_t *r_speeds;
extern cvar_t *r_fullbright;
extern cvar_t *r_showtree; // build graph of visible hull
extern cvar_t *r_lighting_extended;
extern cvar_t *r_lighting_modulate;
extern cvar_t *r_lighting_ambient;
extern cvar_t *r_studio_lambert;
extern cvar_t *r_detailtextures;
extern cvar_t *r_drawentities;
extern cvar_t *r_decals;
extern cvar_t *r_novis;
extern cvar_t *r_nocull;
extern cvar_t *r_lockpvs;
extern cvar_t *r_lockfrustum;
extern cvar_t *r_traceglow;
extern cvar_t *r_dynamic;
extern cvar_t *r_lightmap;
extern cvar_t *r_vbo;
extern cvar_t *r_vbo_dlightmode;
extern cvar_t *vid_brightness;
extern cvar_t *vid_gamma;
//
// engine shared convars
//
extern cvar_t *gl_showtextures;
extern cvar_t *tracerred;
extern cvar_t *tracergreen;
extern cvar_t *tracerblue;
extern cvar_t *traceralpha;
extern cvar_t *cl_lightstyle_lerping;
extern cvar_t *r_showhull;
#endif
// softrender defs // softrender defs
#define CACHE_SIZE 32 #define CACHE_SIZE 32

32
ref_soft/r_main.c

@ -56,7 +56,6 @@ int r_screenwidth;
int r_viewcluster, r_oldviewcluster; int r_viewcluster, r_oldviewcluster;
cvar_t *r_lefthand;
cvar_t *sw_aliasstats; cvar_t *sw_aliasstats;
cvar_t *sw_allow_modex; cvar_t *sw_allow_modex;
cvar_t *sw_clearcolor; cvar_t *sw_clearcolor;
@ -74,31 +73,18 @@ cvar_t *sw_notransbrushes;
cvar_t *sw_noalphabrushes; cvar_t *sw_noalphabrushes;
cvar_t *r_drawworld; cvar_t *r_drawworld;
cvar_t *r_drawentities;
cvar_t *r_dspeeds; cvar_t *r_dspeeds;
cvar_t *r_fullbright;
cvar_t *r_lerpmodels; cvar_t *r_lerpmodels;
cvar_t *r_novis; cvar_t *r_novis;
cvar_t *r_lightmap;
cvar_t *r_dynamic;
cvar_t *r_traceglow; cvar_t *r_traceglow;
cvar_t *tracerred;
cvar_t *tracergreen;
cvar_t *tracerblue;
cvar_t *traceralpha;
cvar_t *r_speeds;
cvar_t *r_lightlevel; //FIXME HACK cvar_t *r_lightlevel; //FIXME HACK
cvar_t *vid_fullscreen;
cvar_t *vid_gamma;
//PGM //PGM
cvar_t *sw_lockpvs; cvar_t *sw_lockpvs;
//PGM //PGM
cvar_t *r_decals; DEFINE_ENGINE_SHARED_CVAR_LIST()
int r_viewcluster, r_oldviewcluster; int r_viewcluster, r_oldviewcluster;
@ -1927,16 +1913,11 @@ qboolean GAME_EXPORT R_Init( void )
{ {
qboolean glblit = false; qboolean glblit = false;
RETRIEVE_ENGINE_SHARED_CVAR_LIST();
gl_emboss_scale = gEngfuncs.Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" ); gl_emboss_scale = gEngfuncs.Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" );
vid_gamma = gEngfuncs.pfnGetCvarPointer( "gamma", 0 );
r_norefresh = gEngfuncs.Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" );
r_drawentities = gEngfuncs.pfnGetCvarPointer( "r_drawentities", 0 );
vid_brightness = gEngfuncs.pfnGetCvarPointer( "brightness", 0 );
r_fullbright = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" ); r_fullbright = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
r_dynamic = gEngfuncs.Cvar_Get( "r_dynamic", "1", FCVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
r_lightmap = gEngfuncs.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
// sw_aliasstats = ri.Cvar_Get ("sw_polymodelstats", "0", 0); // sw_aliasstats = ri.Cvar_Get ("sw_polymodelstats", "0", 0);
// sw_allow_modex = ri.Cvar_Get( "sw_allow_modex", "1", CVAR_ARCHIVE ); // sw_allow_modex = ri.Cvar_Get( "sw_allow_modex", "1", CVAR_ARCHIVE );
sw_clearcolor = gEngfuncs.Cvar_Get ("sw_clearcolor", "48999", 0, "screen clear color"); sw_clearcolor = gEngfuncs.Cvar_Get ("sw_clearcolor", "48999", 0, "screen clear color");
@ -1957,20 +1938,13 @@ qboolean GAME_EXPORT R_Init( void )
#ifndef DISABLE_TEXFILTER #ifndef DISABLE_TEXFILTER
sw_texfilt = gEngfuncs.Cvar_Get ("sw_texfilt", "0", FCVAR_GLCONFIG, "texture dither"); sw_texfilt = gEngfuncs.Cvar_Get ("sw_texfilt", "0", FCVAR_GLCONFIG, "texture dither");
#endif #endif
//r_lefthand = ri.Cvar_Get( "hand", "0", FCVAR_USERINFO | FCVAR_ARCHIVE );
// r_speeds = ri.Cvar_Get ("r_speeds", "0", 0); // r_speeds = ri.Cvar_Get ("r_speeds", "0", 0);
r_decals = gEngfuncs.pfnGetCvarPointer( "r_decals", 0 );
//r_drawworld = ri.Cvar_Get ("r_drawworld", "1", 0); //r_drawworld = ri.Cvar_Get ("r_drawworld", "1", 0);
//r_dspeeds = ri.Cvar_Get ("r_dspeeds", "0", 0); //r_dspeeds = ri.Cvar_Get ("r_dspeeds", "0", 0);
// r_lightlevel = ri.Cvar_Get ("r_lightlevel", "0", 0); // r_lightlevel = ri.Cvar_Get ("r_lightlevel", "0", 0);
//r_lerpmodels = ri.Cvar_Get( "r_lerpmodels", "1", 0 ); //r_lerpmodels = ri.Cvar_Get( "r_lerpmodels", "1", 0 );
r_novis = gEngfuncs.Cvar_Get( "r_novis", "0", 0, "" ); r_novis = gEngfuncs.Cvar_Get( "r_novis", "0", 0, "" );
tracerred = gEngfuncs.Cvar_Get( "tracerred", "0.8", 0, "tracer red component weight ( 0 - 1.0 )" );
tracergreen = gEngfuncs.Cvar_Get( "tracergreen", "0.8", 0, "tracer green component weight ( 0 - 1.0 )" );
tracerblue = gEngfuncs.Cvar_Get( "tracerblue", "0.4", 0, "tracer blue component weight ( 0 - 1.0 )" );
traceralpha = gEngfuncs.Cvar_Get( "traceralpha", "0.5", 0, "tracer alpha amount ( 0 - 1.0 )" );
r_temppool = Mem_AllocPool( "ref_soft zone" ); r_temppool = Mem_AllocPool( "ref_soft zone" );
glblit = !!gEngfuncs.Sys_CheckParm( "-glblit" ); glblit = !!gEngfuncs.Sys_CheckParm( "-glblit" );

4
ref_soft/r_studio.c

@ -124,7 +124,6 @@ typedef struct
static cvar_t *r_studio_sort_textures; static cvar_t *r_studio_sort_textures;
static cvar_t *r_drawviewmodel; static cvar_t *r_drawviewmodel;
cvar_t *cl_righthand = NULL; cvar_t *cl_righthand = NULL;
static cvar_t *cl_himodels;
static cvar_t *r_studio_drawelements; static cvar_t *r_studio_drawelements;
static r_studio_interface_t *pStudioDraw; static r_studio_interface_t *pStudioDraw;
@ -153,9 +152,6 @@ void R_StudioInit( void )
r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" ); r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" );
r_studio_drawelements = gEngfuncs.Cvar_Get( "r_studio_drawelements", "1", FCVAR_ARCHIVE, "use glDrawElements for studiomodels" ); r_studio_drawelements = gEngfuncs.Cvar_Get( "r_studio_drawelements", "1", FCVAR_ARCHIVE, "use glDrawElements for studiomodels" );
// guaranteed to exist by engine
cl_himodels = gEngfuncs.pfnGetCvarPointer( "cl_himodels", 0 );
Matrix3x4_LoadIdentity( g_studio.rotationmatrix ); Matrix3x4_LoadIdentity( g_studio.rotationmatrix );
r_glowshellfreq = gEngfuncs.Cvar_Get( "r_glowshellfreq", "2.2", 0, "glowing shell frequency update" ); r_glowshellfreq = gEngfuncs.Cvar_Get( "r_glowshellfreq", "2.2", 0, "glowing shell frequency update" );

Loading…
Cancel
Save