ref: implement API interface for ref_gl, get rid of RenderAPI, RenderInterface and vgui_support API references

This commit is contained in:
Alibek Omarov
2019-03-15 21:23:59 +03:00
parent 234507b7f1
commit 97aba69ed0
27 changed files with 733 additions and 249 deletions
+7 -7
View File
@@ -1801,7 +1801,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
{
#ifndef XASH_DEDICATED
// release old sky layers first
ref.dllFuncs.R_FreeSharedTexture( REF_SOLIDSKY_TEXTURE );
ref.dllFuncs.R_FreeSharedTexture( REF_ALPHASKY_TEXTURE );
ref.dllFuncs.R_FreeSharedTexture( REF_SOLIDSKY_TEXTURE );
#endif
}
@@ -1896,7 +1896,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( FS_FileExists( texpath, false ))
{
tx->gl_texturenum = RefRenderAPI->GL_LoadTexture( texpath, NULL, 0, TF_ALLOW_EMBOSS );
tx->gl_texturenum = ref.dllFuncs.GL_LoadTexture( texpath, NULL, 0, TF_ALLOW_EMBOSS );
bmod->wadlist.wadusage[j]++; // this wad are really used
break;
}
@@ -1912,7 +1912,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( custom_palette ) size += sizeof( short ) + 768;
Q_snprintf( texname, sizeof( texname ), "#%s:%s.mip", loadstat.name, mt->name );
tx->gl_texturenum = RefRenderAPI->GL_LoadTexture( texname, (byte *)mt, size, TF_ALLOW_EMBOSS );
tx->gl_texturenum = ref.dllFuncs.GL_LoadTexture( texname, (byte *)mt, size, TF_ALLOW_EMBOSS );
}
// if texture is completely missed
@@ -1935,7 +1935,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
if( custom_palette ) size += sizeof( short ) + 768;
tx->fb_texturenum = RefRenderAPI->GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA );
tx->fb_texturenum = ref.dllFuncs.GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA );
}
else
{
@@ -1960,7 +1960,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
}
// okay, loading it from wad or hi-res version
tx->fb_texturenum = RefRenderAPI->GL_LoadTexture( texname, src, srcSize, TF_MAKELUMA );
tx->fb_texturenum = ref.dllFuncs.GL_LoadTexture( texname, src, srcSize, TF_MAKELUMA );
if( src ) Mem_Free( src );
}
}
@@ -2823,8 +2823,8 @@ void Mod_UnloadBrushModel( model_t *mod )
if( !tx || tx->gl_texturenum == ref.dllFuncs.R_GetBuiltinTexture( REF_DEFAULT_TEXTURE ) )
continue; // free slot
RefRenderAPI->GL_FreeTexture( tx->gl_texturenum ); // main texture
RefRenderAPI->GL_FreeTexture( tx->fb_texturenum ); // luma texture
ref.dllFuncs.GL_FreeTexture( tx->gl_texturenum ); // main texture
ref.dllFuncs.GL_FreeTexture( tx->fb_texturenum ); // luma texture
}
#endif
Mem_FreePool( &mod->mempool );
+2
View File
@@ -166,6 +166,8 @@ typedef struct studiohdr_s studiohdr_t;
typedef struct mstudioseqdesc_s mstudioseqdesc_t;
typedef struct mstudiobone_s mstudiobone_t;
typedef struct mstudioanim_s mstudioanim_t;
void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded );
void Mod_UnloadStudioModel( model_t *mod );
void Mod_InitStudioAPI( void );
void Mod_InitStudioHull( void );
void Mod_ResetStudioAPI( void );
+23 -3
View File
@@ -115,6 +115,24 @@ static void Mod_FreeModel( model_t *mod )
if( ref.dllFuncs.Mod_UnloadModel )
ref.dllFuncs.Mod_UnloadModel( mod );
switch( mod->type )
{
case mod_studio:
Mod_UnloadStudioModel( mod );
break;
case mod_alias:
// REFTODO:
// Mod_UnloadAliasModel( mod );
break;
case mod_sprite:
Mod_UnloadSpriteModel( mod );
break;
case mod_brush:
Mod_UnloadBrushModel( mod );
break;
}
memset( mod, 0, sizeof( *mod ));
}
@@ -287,18 +305,20 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
switch( *(uint *)buf )
{
case IDSTUDIOHEADER:
ref.dllFuncs.Mod_LoadModel( mod_studio, mod, buf, &loaded, 0 );
Mod_LoadStudioModel( mod, buf, &loaded );
break;
case IDSPRITEHEADER:
ref.dllFuncs.Mod_LoadModel( mod_sprite, mod, buf, &loaded, 0 );
Mod_LoadSpriteModel( mod, buf, &loaded, 0 );
break;
case IDALIASHEADER:
// REFTODO: move alias loader to engine
ref.dllFuncs.Mod_LoadModel( mod_alias, mod, buf, &loaded, 0 );
break;
case Q1BSP_VERSION:
case HLBSP_VERSION:
case QBSP2_VERSION:
ref.dllFuncs.Mod_LoadModel( mod_brush, mod, buf, &loaded, 0 );
Mod_LoadBrushModel( mod, buf, &loaded );
// ref.dllFuncs.Mod_LoadModel( mod_brush, mod, buf, &loaded, 0 );
break;
default:
Mem_Free( buf );
+4 -2
View File
@@ -16,7 +16,9 @@ GNU General Public License for more details.
#include "common.h"
#include "mathlib.h"
#include "pm_local.h"
#include "ref_common.h"
#ifndef XASH_DEDICATED
#include "client.h" // CL_Particle
#endif
// expand debugging BBOX particle hulls by this many units.
#define BOX_GAP 0.0f
@@ -42,7 +44,7 @@ void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float li
while( curdist <= len )
{
VectorMA( start, curdist, diff, pos );
ref.dllFuncs.CL_Particle( pos, pcolor, life, 0, zvel );
CL_Particle( pos, pcolor, life, 0, zvel );
curdist += 2.0f;
}
#endif // XASH_DEDICATED