Browse Source

Port VBO world renderer

pull/2/head
mittorn 6 years ago
parent
commit
bccc0e63d5
  1. 3
      engine/client/gl_decals.c
  2. 5
      engine/client/gl_local.h
  3. 1
      engine/client/gl_rmisc.c
  4. 1708
      engine/client/gl_rsurf.c
  5. 48
      engine/client/vid_common.c

3
engine/client/gl_decals.c

@ -54,7 +54,7 @@ typedef struct @@ -54,7 +54,7 @@ typedef struct
static float g_DecalClipVerts[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;
void R_ClearDecals( void )
@ -570,6 +570,7 @@ static void R_AddDecalToSurface( decal_t *pdecal, msurface_t *surf, decalinfo_t @@ -570,6 +570,7 @@ static void R_AddDecalToSurface( decal_t *pdecal, msurface_t *surf, decalinfo_t
// alloc clipped poly for decal
R_DecalCreatePoly( decalinfo, pdecal, surf );
R_AddDecalVBO( pdecal, surf );
}
static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, float y )

5
engine/client/gl_local.h

@ -408,6 +408,9 @@ void GL_RebuildLightmaps( void ); @@ -408,6 +408,9 @@ void GL_RebuildLightmaps( void );
void GL_InitRandomTable( void );
void GL_BuildLightmaps( void );
void GL_ResetFogColor( void );
void R_GenerateVBO();
void R_ClearVBO();
void R_AddDecalVBO( decal_t *pdecal, msurface_t *surf );
//
// gl_sprite.c
@ -679,6 +682,8 @@ extern convar_t *r_lockfrustum; @@ -679,6 +682,8 @@ 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 convar_t *vid_displayfrequency;
extern convar_t *vid_fullscreen;

1
engine/client/gl_rmisc.c

@ -199,4 +199,5 @@ void R_NewMap( void ) @@ -199,4 +199,5 @@ void R_NewMap( void )
R_SetupSky( clgame.movevars.skyName );
GL_BuildLightmaps ();
R_GenerateVBO();
}

1708
engine/client/gl_rsurf.c

File diff suppressed because it is too large Load Diff

48
engine/client/vid_common.c

@ -65,6 +65,8 @@ convar_t *r_traceglow; @@ -65,6 +65,8 @@ convar_t *r_traceglow;
convar_t *r_dynamic;
convar_t *r_lightmap;
convar_t *gl_round_down;
convar_t *r_vbo;
convar_t *r_vbo_dlightmode;
convar_t *vid_displayfrequency;
convar_t *vid_fullscreen;
@ -546,6 +548,51 @@ static void SetFullscreenModeFromCommandLine( ) @@ -546,6 +548,51 @@ static void SetFullscreenModeFromCommandLine( )
#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
@ -580,6 +627,7 @@ qboolean R_Init( void ) @@ -580,6 +627,7 @@ qboolean R_Init( void )
r_temppool = Mem_AllocPool( "Render Zone" );
GL_SetDefaults();
R_CheckVBO();
R_InitImages();
R_SpriteInit();
R_StudioInit();

Loading…
Cancel
Save