2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 09:56:22 +01:00

ref: remove convar_t from renderer, disable engine-related definitions in mod_local

This commit is contained in:
mittorn 2019-03-16 18:15:05 +07:00
parent 9c6352ec57
commit aabf5f5621
7 changed files with 126 additions and 123 deletions

View File

@ -2,9 +2,6 @@
#ifndef VID_COMMON
#define VID_COMMON
#define FCONTEXT_CORE_PROFILE BIT( 0 )
#define FCONTEXT_DEBUG_ARB BIT( 1 )
typedef struct vidmode_s
{
const char *desc;

View File

@ -106,6 +106,7 @@ typedef struct world_static_s
vec3_t size;
} world_static_t;
#ifndef REF_DLL
extern world_static_t world;
extern byte *com_studiocache;
extern model_t *loadmodel;
@ -189,6 +190,6 @@ void Mod_ClearStudioCache( void );
//
void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, uint texFlags );
void Mod_UnloadSpriteModel( model_t *mod );
#endif
#endif//MOD_LOCAL_H

View File

@ -26,7 +26,6 @@ GNU General Public License for more details.
#include "com_model.h"
#include "studio.h"
#include "r_efx.h"
#include "cvar.h"
#include "com_image.h"
#define REF_API_VERSION 1
@ -37,6 +36,11 @@ GNU General Public License for more details.
#define TF_IMAGE (TF_NOMIPMAP|TF_CLAMP)
#define TF_DECAL (TF_CLAMP)
#define FCONTEXT_CORE_PROFILE BIT( 0 )
#define FCONTEXT_DEBUG_ARB BIT( 1 )
#define FCVAR_RENDERINFO (1<<16) // save to a seperate config called video.cfg
#define FCVAR_READ_ONLY (1<<17) // cannot be set by user at all, and can't be requested by CvarGetPointer from game dlls
// screenshot types
#define VID_SCREENSHOT 0
@ -246,13 +250,13 @@ typedef struct ref_api_s
qboolean (*Host_IsLocalGame)( void );
// cvar handlers
convar_t *(*Cvar_Get)( const char *szName, const char *szValue, int flags, const char *description );
convar_t *(*pfnGetCvarPointer)( const char *name, int ignore_flags );
cvar_t *(*Cvar_Get)( const char *szName, const char *szValue, int flags, const char *description );
cvar_t *(*pfnGetCvarPointer)( const char *name, int ignore_flags );
float (*pfnGetCvarFloat)( const char *szName );
const char *(*pfnGetCvarString)( const char *szName );
void (*Cvar_SetValue)( const char *name, float value );
void (*Cvar_Set)( const char *name, const char *value );
void (*Cvar_RegisterVariable)( convar_t *var );
void (*Cvar_RegisterVariable)( cvar_t *var );
void (*Cvar_FullSet)( const char *var_name, const char *value, int flags );
// command handlers

View File

@ -32,7 +32,8 @@ GNU General Public License for more details.
#include "enginefeatures.h"
#include "com_strings.h"
#include "pm_movevars.h"
#include "cvar.h"
//#include "cvar.h"
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#define ASSERT(x) if(!( x )) gEngfuncs.Host_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
@ -40,8 +41,8 @@ GNU General Public License for more details.
#include <stdio.h>
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) convar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) convar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) cvar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) cvar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
#define CVAR_TO_BOOL( x ) ((x) && ((x)->value != 0.0f) ? true : false )
#define WORLD (gEngfuncs.GetWorld())
@ -509,7 +510,7 @@ void VGUI_DrawQuad( const vpoint_t *ul, const vpoint_t *lr );
void VGUI_GetTextureSizes( int *width, int *height );
int VGUI_GenerateTexture( void );
#include "vid_common.h"
//#include "vid_common.h"
//
// renderer exports
@ -691,7 +692,7 @@ typedef struct
qboolean in2DMode;
} glstate_t;
/*
typedef struct
{
void* context; // handle to GL rendering context
@ -704,71 +705,70 @@ typedef struct
qboolean initialized; // OpenGL subsystem started
qboolean extended; // extended context allows to GL_Debug
} glwstate_t;
*/
extern glconfig_t glConfig;
extern glstate_t glState;
// move to engine
//extern glwstate_t glw_state;
extern glwstate_t glw_state;
extern ref_api_t gEngfuncs;
extern ref_globals_t *gpGlobals;
//
// renderer cvars
//
extern convar_t *gl_texture_anisotropy;
extern convar_t *gl_extensions;
extern convar_t *gl_check_errors;
extern convar_t *gl_texture_lodbias;
extern convar_t *gl_texture_nearest;
extern convar_t *gl_lightmap_nearest;
extern convar_t *gl_keeptjunctions;
extern convar_t *gl_emboss_scale;
extern convar_t *gl_round_down;
extern convar_t *gl_detailscale;
extern convar_t *gl_wireframe;
extern convar_t *gl_polyoffset;
extern convar_t *gl_finish;
extern convar_t *gl_nosort;
extern convar_t *gl_clear;
extern convar_t *gl_test; // cvar to testify new effects
extern convar_t *gl_msaa;
extern convar_t *gl_stencilbits;
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_emboss_scale;
extern cvar_t *gl_round_down;
extern cvar_t *gl_detailscale;
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 convar_t *r_speeds;
extern convar_t *r_fullbright;
extern convar_t *r_norefresh;
extern convar_t *r_showtree; // build graph of visible hull
extern convar_t *r_lighting_extended;
extern convar_t *r_lighting_modulate;
extern convar_t *r_lighting_ambient;
extern convar_t *r_studio_lambert;
extern convar_t *r_detailtextures;
extern convar_t *r_drawentities;
extern convar_t *r_decals;
extern convar_t *r_novis;
extern convar_t *r_nocull;
extern convar_t *r_lockpvs;
extern convar_t *r_lockfrustum;
extern convar_t *r_traceglow;
extern convar_t *r_dynamic;
extern convar_t *r_lightmap;
extern convar_t *r_vbo;
extern convar_t *r_vbo_dlightmode;
extern cvar_t *r_speeds;
extern cvar_t *r_fullbright;
extern cvar_t *r_norefresh;
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 convar_t *vid_brightness;
extern convar_t *vid_gamma;
extern cvar_t *vid_brightness;
extern cvar_t *vid_gamma;
//
// engine shared convars
//
extern convar_t *gl_showtextures;
extern convar_t *tracerred;
extern convar_t *tracergreen;
extern convar_t *tracerblue;
extern convar_t *traceralpha;
extern convar_t *cl_lightstyle_lerping;
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;
//
// engine callbacks

View File

@ -1,55 +1,55 @@
#include "gl_local.h"
convar_t *gl_extensions;
convar_t *gl_texture_anisotropy;
convar_t *gl_texture_lodbias;
convar_t *gl_texture_nearest;
convar_t *gl_lightmap_nearest;
convar_t *gl_keeptjunctions;
convar_t *gl_emboss_scale;
convar_t *gl_detailscale;
convar_t *gl_check_errors;
convar_t *gl_polyoffset;
convar_t *gl_wireframe;
convar_t *gl_finish;
convar_t *gl_nosort;
convar_t *gl_vsync;
convar_t *gl_clear;
convar_t *gl_test;
convar_t *gl_msaa;
convar_t *gl_stencilbits;
convar_t *r_speeds;
convar_t *r_fullbright;
convar_t *r_norefresh;
convar_t *r_showtree;
convar_t *r_lighting_extended;
convar_t *r_lighting_modulate;
convar_t *r_lighting_ambient;
convar_t *r_detailtextures;
convar_t *r_drawentities;
convar_t *r_adjust_fov;
convar_t *r_decals;
convar_t *r_novis;
convar_t *r_nocull;
convar_t *r_lockpvs;
convar_t *r_lockfrustum;
convar_t *r_traceglow;
convar_t *r_dynamic;
convar_t *r_lightmap;
convar_t *r_showhull;
convar_t *gl_round_down;
convar_t *r_vbo;
convar_t *r_vbo_dlightmode;
convar_t *gl_showtextures;
convar_t *cl_lightstyle_lerping;
cvar_t *gl_extensions;
cvar_t *gl_texture_anisotropy;
cvar_t *gl_texture_lodbias;
cvar_t *gl_texture_nearest;
cvar_t *gl_lightmap_nearest;
cvar_t *gl_keeptjunctions;
cvar_t *gl_emboss_scale;
cvar_t *gl_detailscale;
cvar_t *gl_check_errors;
cvar_t *gl_polyoffset;
cvar_t *gl_wireframe;
cvar_t *gl_finish;
cvar_t *gl_nosort;
cvar_t *gl_vsync;
cvar_t *gl_clear;
cvar_t *gl_test;
cvar_t *gl_msaa;
cvar_t *gl_stencilbits;
cvar_t *r_speeds;
cvar_t *r_fullbright;
cvar_t *r_norefresh;
cvar_t *r_showtree;
cvar_t *r_lighting_extended;
cvar_t *r_lighting_modulate;
cvar_t *r_lighting_ambient;
cvar_t *r_detailtextures;
cvar_t *r_drawentities;
cvar_t *r_adjust_fov;
cvar_t *r_decals;
cvar_t *r_novis;
cvar_t *r_nocull;
cvar_t *r_lockpvs;
cvar_t *r_lockfrustum;
cvar_t *r_traceglow;
cvar_t *r_dynamic;
cvar_t *r_lightmap;
cvar_t *r_showhull;
cvar_t *gl_round_down;
cvar_t *r_vbo;
cvar_t *r_vbo_dlightmode;
cvar_t *gl_showtextures;
cvar_t *cl_lightstyle_lerping;
convar_t *vid_brightness;
convar_t *vid_gamma;
convar_t *tracerred;
convar_t *tracergreen;
convar_t *tracerblue;
convar_t *traceralpha;
cvar_t *vid_brightness;
cvar_t *vid_gamma;
cvar_t *tracerred;
cvar_t *tracergreen;
cvar_t *tracerblue;
cvar_t *traceralpha;
byte *r_temppool;
@ -322,7 +322,7 @@ GL_CheckExtension
void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cvarname, int r_ext )
{
const dllfunc_t *func;
convar_t *parm = NULL;
cvar_t *parm = NULL;
const char *extensions_string;
gEngfuncs.Con_Reportf( "GL_CheckExtension: %s ", name );

View File

@ -24,8 +24,8 @@ GNU General Public License for more details.
#define MAPSPRITE_SIZE 128
#define GLARE_FALLOFF 19000.0f
convar_t *r_sprite_lerping;
convar_t *r_sprite_lighting;
cvar_t *r_sprite_lerping;
cvar_t *r_sprite_lighting;
char sprite_name[MAX_QPATH];
char group_suffix[8];
static uint r_texFlags = 0;

View File

@ -34,8 +34,9 @@ typedef struct
model_t *model;
} player_model_t;
CVAR_DEFINE_AUTO( r_glowshellfreq, "2.2", 0, "glowing shell frequency update" );
CVAR_DEFINE_AUTO( r_shadows, "0", 0, "cast shadows from models" );
cvar_t *r_glowshellfreq;
cvar_t r_shadows = { "r_shadows", "0", 0 };
static vec3_t hullcolor[8] =
{
@ -115,10 +116,10 @@ typedef struct
} studio_draw_state_t;
// studio-related cvars
convar_t *r_studio_sort_textures;
convar_t *r_drawviewmodel;
convar_t *cl_righthand = NULL;
convar_t *cl_himodels;
cvar_t *r_studio_sort_textures;
cvar_t *r_drawviewmodel;
cvar_t *cl_righthand = NULL;
cvar_t *cl_himodels;
static r_studio_interface_t *pStudioDraw;
static studio_draw_state_t g_studio; // global studio state
@ -147,7 +148,7 @@ void R_StudioInit( void )
r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" );
Matrix3x4_LoadIdentity( g_studio.rotationmatrix );
gEngfuncs.Cvar_RegisterVariable( &r_glowshellfreq );
r_glowshellfreq = gEngfuncs.Cvar_Get( "r_glowshellfreq", "2.2", 0, "glowing shell frequency update" );
// g-cont. cvar disabled by Valve
// gEngfuncs.Cvar_RegisterVariable( &r_shadows );
@ -1133,9 +1134,9 @@ void R_StudioBuildNormalTable( void )
}
}
g_studio.chrome_origin[0] = cos( r_glowshellfreq.value * g_studio.time ) * 4000.0f;
g_studio.chrome_origin[1] = sin( r_glowshellfreq.value * g_studio.time ) * 4000.0f;
g_studio.chrome_origin[2] = cos( r_glowshellfreq.value * g_studio.time * 0.33f ) * 4000.0f;
g_studio.chrome_origin[0] = cos( r_glowshellfreq->value * g_studio.time ) * 4000.0f;
g_studio.chrome_origin[1] = sin( r_glowshellfreq->value * g_studio.time ) * 4000.0f;
g_studio.chrome_origin[2] = cos( r_glowshellfreq->value * g_studio.time * 0.33f ) * 4000.0f;
if( e->curstate.rendercolor.r || e->curstate.rendercolor.g || e->curstate.rendercolor.b )
TriColor4ub( e->curstate.rendercolor.r, e->curstate.rendercolor.g, e->curstate.rendercolor.b, 255 );