mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-03-13 06:21:08 +00:00
Port VBO world renderer
This commit is contained in:
parent
23d0f33ad1
commit
bccc0e63d5
@ -54,7 +54,7 @@ typedef struct
|
|||||||
static float g_DecalClipVerts[MAX_DECALCLIPVERT][VERTEXSIZE];
|
static float g_DecalClipVerts[MAX_DECALCLIPVERT][VERTEXSIZE];
|
||||||
static float g_DecalClipVerts2[MAX_DECALCLIPVERT][VERTEXSIZE];
|
static float g_DecalClipVerts2[MAX_DECALCLIPVERT][VERTEXSIZE];
|
||||||
|
|
||||||
static decal_t gDecalPool[MAX_RENDER_DECALS];
|
decal_t gDecalPool[MAX_RENDER_DECALS];
|
||||||
static int gDecalCount;
|
static int gDecalCount;
|
||||||
|
|
||||||
void R_ClearDecals( void )
|
void R_ClearDecals( void )
|
||||||
@ -570,6 +570,7 @@ static void R_AddDecalToSurface( decal_t *pdecal, msurface_t *surf, decalinfo_t
|
|||||||
|
|
||||||
// alloc clipped poly for decal
|
// alloc clipped poly for decal
|
||||||
R_DecalCreatePoly( decalinfo, pdecal, surf );
|
R_DecalCreatePoly( decalinfo, pdecal, surf );
|
||||||
|
R_AddDecalVBO( pdecal, surf );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, float y )
|
static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, float y )
|
||||||
@ -1282,4 +1283,4 @@ void R_ClearAllDecals( void )
|
|||||||
{
|
{
|
||||||
clgame.drawFuncs.R_ClearStudioDecals();
|
clgame.drawFuncs.R_ClearStudioDecals();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,6 +408,9 @@ void GL_RebuildLightmaps( void );
|
|||||||
void GL_InitRandomTable( void );
|
void GL_InitRandomTable( void );
|
||||||
void GL_BuildLightmaps( void );
|
void GL_BuildLightmaps( void );
|
||||||
void GL_ResetFogColor( void );
|
void GL_ResetFogColor( void );
|
||||||
|
void R_GenerateVBO();
|
||||||
|
void R_ClearVBO();
|
||||||
|
void R_AddDecalVBO( decal_t *pdecal, msurface_t *surf );
|
||||||
|
|
||||||
//
|
//
|
||||||
// gl_sprite.c
|
// gl_sprite.c
|
||||||
@ -679,6 +682,8 @@ extern convar_t *r_lockfrustum;
|
|||||||
extern convar_t *r_traceglow;
|
extern convar_t *r_traceglow;
|
||||||
extern convar_t *r_dynamic;
|
extern convar_t *r_dynamic;
|
||||||
extern convar_t *r_lightmap;
|
extern convar_t *r_lightmap;
|
||||||
|
extern convar_t *r_vbo;
|
||||||
|
extern convar_t *r_vbo_dlightmode;
|
||||||
|
|
||||||
extern convar_t *vid_displayfrequency;
|
extern convar_t *vid_displayfrequency;
|
||||||
extern convar_t *vid_fullscreen;
|
extern convar_t *vid_fullscreen;
|
||||||
|
@ -199,4 +199,5 @@ void R_NewMap( void )
|
|||||||
R_SetupSky( clgame.movevars.skyName );
|
R_SetupSky( clgame.movevars.skyName );
|
||||||
|
|
||||||
GL_BuildLightmaps ();
|
GL_BuildLightmaps ();
|
||||||
}
|
R_GenerateVBO();
|
||||||
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -65,6 +65,8 @@ convar_t *r_traceglow;
|
|||||||
convar_t *r_dynamic;
|
convar_t *r_dynamic;
|
||||||
convar_t *r_lightmap;
|
convar_t *r_lightmap;
|
||||||
convar_t *gl_round_down;
|
convar_t *gl_round_down;
|
||||||
|
convar_t *r_vbo;
|
||||||
|
convar_t *r_vbo_dlightmode;
|
||||||
|
|
||||||
convar_t *vid_displayfrequency;
|
convar_t *vid_displayfrequency;
|
||||||
convar_t *vid_fullscreen;
|
convar_t *vid_fullscreen;
|
||||||
@ -546,6 +548,51 @@ static void SetFullscreenModeFromCommandLine( )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
R_CheckVBO
|
||||||
|
|
||||||
|
register VBO cvars and get default value
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
static void R_CheckVBO( void )
|
||||||
|
{
|
||||||
|
const char *def = "1";
|
||||||
|
const char *dlightmode = "1";
|
||||||
|
int flags = FCVAR_ARCHIVE;
|
||||||
|
qboolean disable = false;
|
||||||
|
|
||||||
|
// some bad GLES1 implementations breaks dlights completely
|
||||||
|
if( glConfig.max_texture_units < 3 )
|
||||||
|
disable = true;
|
||||||
|
|
||||||
|
#ifdef XASH_MOBILE_PLATFORM
|
||||||
|
// VideoCore4 drivers have a problem with mixing VBO and client arrays
|
||||||
|
// Disable it, as there is no suitable workaround here
|
||||||
|
if( Q_stristr( glConfig.renderer_string, "VideoCore IV" ) || Q_stristr( glConfig.renderer_string, "vc4" ) )
|
||||||
|
disable = true;
|
||||||
|
|
||||||
|
// dlightmode 1 is not too much tested on android
|
||||||
|
// so better to left it off
|
||||||
|
dlightmode = "0";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( disable )
|
||||||
|
{
|
||||||
|
// do not keep in config unless dev > 3 and enabled
|
||||||
|
flags = 0;
|
||||||
|
def = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
r_vbo = Cvar_Get( "r_vbo", def, flags, "draw world using VBO" );
|
||||||
|
r_vbo_dlightmode = Cvar_Get( "r_vbo_dlightmode", dlightmode, FCVAR_ARCHIVE, "vbo dlight rendering mode(0-1)" );
|
||||||
|
|
||||||
|
// check if enabled manually
|
||||||
|
if( CVAR_TO_BOOL(r_vbo) )
|
||||||
|
r_vbo->flags |= FCVAR_ARCHIVE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_Init
|
R_Init
|
||||||
@ -580,6 +627,7 @@ qboolean R_Init( void )
|
|||||||
r_temppool = Mem_AllocPool( "Render Zone" );
|
r_temppool = Mem_AllocPool( "Render Zone" );
|
||||||
|
|
||||||
GL_SetDefaults();
|
GL_SetDefaults();
|
||||||
|
R_CheckVBO();
|
||||||
R_InitImages();
|
R_InitImages();
|
||||||
R_SpriteInit();
|
R_SpriteInit();
|
||||||
R_StudioInit();
|
R_StudioInit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user