mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
ref_dx2: rebase onto ref_api v17
This commit is contained in:
@@ -18,13 +18,11 @@ GNU General Public License for more details.
|
||||
#include "r_local.h"
|
||||
#include "xash3d_mathlib.h"
|
||||
#include "crtlib.h"
|
||||
#include "r_studioint.h"
|
||||
|
||||
//#pragma comment(lib, "ddraw.lib")
|
||||
//TODO COM_GetProcAddress
|
||||
|
||||
ref_api_t gEngfuncs;
|
||||
ref_globals_t *gpGlobals;
|
||||
ref_client_t *gp_cl;
|
||||
|
||||
static void R_SimpleStub( void )
|
||||
{
|
||||
@@ -83,11 +81,6 @@ void GL_SetRenderMode( int mode )
|
||||
}
|
||||
|
||||
|
||||
static void CL_AddCustomBeam( cl_entity_t *pEnvBeam )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void R_ProcessEntData( qboolean allocate, cl_entity_t *entities, unsigned int max_entities )
|
||||
{
|
||||
if (!allocate)
|
||||
@@ -150,9 +143,16 @@ static void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, ve
|
||||
;
|
||||
}
|
||||
|
||||
void CL_InitStudioAPI( void )
|
||||
static qboolean R_StudioFillAPI( struct engine_studio_api_s *api, struct r_studio_interface_s *pDefaultDraw )
|
||||
{
|
||||
;
|
||||
return false;
|
||||
}
|
||||
|
||||
static r_studio_interface_t *pStudioDraw;
|
||||
|
||||
static void R_StudioSetDrawInterface( struct r_studio_interface_s *pDraw )
|
||||
{
|
||||
pStudioDraw = pDraw;
|
||||
}
|
||||
|
||||
static void R_SetSkyCloudsTextures( int solidskyTexture, int alphaskyTexture )
|
||||
@@ -191,12 +191,7 @@ static void CL_DrawBeams( int fTrans, BEAM *beams )
|
||||
;
|
||||
}
|
||||
|
||||
static qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static int RefGetParm( int parm, int arg )
|
||||
static intptr_t RefGetParm( int parm, int arg )
|
||||
{
|
||||
dx_texture_t *glt;
|
||||
|
||||
@@ -252,9 +247,11 @@ static int RefGetParm( int parm, int arg )
|
||||
return GL_TexMemory();
|
||||
case PARM_ACTIVE_TMU:
|
||||
return glState.activeTMU;
|
||||
#endif
|
||||
case PARM_LIGHTSTYLEVALUE:
|
||||
arg = bound(0, arg, MAX_LIGHTSTYLES - 1);
|
||||
return tr.lightstylevalue[arg];
|
||||
return g_lightstylevalue[arg];
|
||||
#if 0
|
||||
case PARM_MAX_IMAGE_UNITS:
|
||||
return GL_MaxTextureUnits();
|
||||
case PARM_REBUILD_GAMMA:
|
||||
@@ -274,6 +271,9 @@ static int RefGetParm( int parm, int arg )
|
||||
|
||||
return GL_TextureFilteringEnabled(R_GetTexture(arg));
|
||||
#endif
|
||||
case PARM_GET_STUDIO_HDR:
|
||||
//return (intptr_t)R_StudioGetHeader();
|
||||
return 0;
|
||||
default:
|
||||
return (*gEngfuncs.EngineGetParm)(parm, arg);
|
||||
}
|
||||
@@ -281,37 +281,6 @@ static int RefGetParm( int parm, int arg )
|
||||
}
|
||||
|
||||
|
||||
static float GetFrameTime( void )
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
static void R_SetCurrentEntity( struct cl_entity_s *ent )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void R_SetCurrentModel( struct model_s *mod )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void DrawSingleDecal( struct decal_s *pDecal, struct msurface_s *fa )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static float *R_DecalSetupVerts( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void R_EntityRemoveDecals( struct model_s *mod )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void GL_Bind( int tmu, unsigned int texnum )
|
||||
{
|
||||
const dx_texture_t *texture;
|
||||
@@ -332,32 +301,6 @@ void GL_Bind( int tmu, unsigned int texnum )
|
||||
dxc.currentTexture = texture->d3dHandle;
|
||||
}
|
||||
|
||||
static void GL_LoadTextureMatrix( const float *glmatrix )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void GL_TexGen( unsigned int coord, unsigned int mode )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void GL_DrawParticles( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static colorVec LightVec( const float *start, const float *end, float *lightspot, float *lightvec )
|
||||
{
|
||||
colorVec c = { 0 };
|
||||
return c;
|
||||
}
|
||||
|
||||
static struct mstudiotex_s *StudioGetTexture( struct cl_entity_s *e )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static qboolean R_SpeedsMessage( char *out, size_t size )
|
||||
{
|
||||
return false;
|
||||
@@ -365,17 +308,21 @@ static qboolean R_SpeedsMessage( char *out, size_t size )
|
||||
|
||||
static void R_NewMap( void )
|
||||
{
|
||||
model_t *WORLDMODEL = (gp_cl->models[1]);
|
||||
tr.worldmodel = gp_cl->models[1];
|
||||
|
||||
// clear out efrags in case the level hasn't been reloaded
|
||||
for( int i = 0; i < tr.worldmodel->numleafs; i++ )
|
||||
tr.worldmodel->leafs[i+1].efrags = NULL;
|
||||
|
||||
tr.skytexturenum = -1;
|
||||
|
||||
// clearing texture chains
|
||||
for( int i = 0; i < WORLDMODEL->numtextures; i++ )
|
||||
for( int i = 0; i < tr.worldmodel->numtextures; i++ )
|
||||
{
|
||||
if( !WORLDMODEL->textures[i] )
|
||||
if( !tr.worldmodel->textures[i] )
|
||||
continue;
|
||||
|
||||
texture_t *tx = WORLDMODEL->textures[i];
|
||||
texture_t *tx = tr.worldmodel->textures[i];
|
||||
|
||||
if( !Q_strncmp( tx->name, "sky", 3 ) && tx->width == ( tx->height * 2 ))
|
||||
tr.skytexturenum = i;
|
||||
@@ -385,15 +332,10 @@ static void R_NewMap( void )
|
||||
|
||||
GL_BuildLightmaps();
|
||||
|
||||
if (gEngfuncs.drawFuncs->R_NewMap != NULL)
|
||||
if( gEngfuncs.drawFuncs->R_NewMap != NULL )
|
||||
gEngfuncs.drawFuncs->R_NewMap();
|
||||
}
|
||||
|
||||
static void *R_GetProcAddress( const char *name )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void Color4f( float r, float g, float b, float a )
|
||||
{
|
||||
Vector4Set(dxc.currentColor, r, g, b, a);
|
||||
@@ -404,11 +346,6 @@ static void Color4ub( unsigned char r, unsigned char g, unsigned char b, unsigne
|
||||
Vector4Set(dxc.currentColor, r/255.f, g/255.f, b/255.f, a/255.f);
|
||||
}
|
||||
|
||||
static void TexCoord2f( float u, float v )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void Vertex3fv( const float *worldPnt )
|
||||
{
|
||||
;
|
||||
@@ -419,21 +356,6 @@ static void Vertex3f( float x, float y, float z )
|
||||
;
|
||||
}
|
||||
|
||||
static void Fog( float flFogColor[3], float flStart, float flEnd, int bOn )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void GetMatrix( const int pname, float *matrix )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void FogParams( float flDensity, int iFogSkybox )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void CullFace( TRICULLSTYLE mode )
|
||||
{
|
||||
;
|
||||
@@ -444,12 +366,17 @@ static void VGUI_SetupDrawing( qboolean rect )
|
||||
;
|
||||
}
|
||||
|
||||
static void VGUI_UploadTextureBlock( int drawX, int drawY, const byte *rgba, int blockWidth, int blockHeight )
|
||||
static void R_FillRenderAPI( render_api_t *api )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static const ref_interface_t gReffuncs =
|
||||
static void R_FillTriAPI( triangleapi_t *api )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
const ref_interface_t gReffuncs =
|
||||
{
|
||||
.R_Init = R_Init,
|
||||
.R_Shutdown = R_Shutdown,
|
||||
@@ -474,9 +401,7 @@ static const ref_interface_t gReffuncs =
|
||||
.GL_SetRenderMode = GL_SetRenderMode,
|
||||
|
||||
.R_AddEntity = R_AddEntity,
|
||||
.CL_AddCustomBeam = CL_AddCustomBeam,
|
||||
.R_ProcessEntData = R_ProcessEntData,
|
||||
.R_Flush = R_SimpleStubUInt,
|
||||
|
||||
.R_ShowTextures = R_ShowTextures,
|
||||
|
||||
@@ -486,7 +411,6 @@ static const ref_interface_t gReffuncs =
|
||||
.R_SetupSky = R_SetupSky,
|
||||
|
||||
.R_Set2DMode = R_Set2DMode,
|
||||
.R_DrawStretchRaw = R_DrawStretchRaw,
|
||||
.R_DrawStretchPic = R_DrawStretchPic,
|
||||
.FillRGBA = FillRGBA,
|
||||
.WorldToScreen = WorldToScreen,
|
||||
@@ -503,62 +427,35 @@ static const ref_interface_t gReffuncs =
|
||||
|
||||
.R_StudioEstimateFrame = R_StudioEstimateFrame,
|
||||
.R_StudioLerpMovement = R_StudioLerpMovement,
|
||||
.CL_InitStudioAPI = CL_InitStudioAPI,
|
||||
.R_StudioFillAPI = R_StudioFillAPI,
|
||||
.R_StudioSetDrawInterface = R_StudioSetDrawInterface,
|
||||
|
||||
.R_SetSkyCloudsTextures = R_SetSkyCloudsTextures,
|
||||
.GL_SubdivideSurface = GL_SubdivideSurface,
|
||||
.CL_RunLightStyles = CL_RunLightStyles,
|
||||
|
||||
.R_GetSpriteParms = R_GetSpriteParms,
|
||||
.R_GetSpriteTexture = R_GetSpriteTexture,
|
||||
|
||||
.Mod_ProcessRenderData = Mod_ProcessRenderData,
|
||||
.Mod_StudioLoadTextures = Mod_StudioLoadTextures,
|
||||
|
||||
.CL_DrawParticles = CL_DrawParticles,
|
||||
.CL_DrawTracers = CL_DrawTracers,
|
||||
.CL_DrawBeams = CL_DrawBeams,
|
||||
.R_BeamCull = R_BeamCull,
|
||||
|
||||
.RefGetParm = RefGetParm,
|
||||
.GetDetailScaleForTexture = GetDetailScaleForTexture,
|
||||
.GetExtraParmsForTexture = GetExtraParmsForTexture,
|
||||
.GetFrameTime = GetFrameTime,
|
||||
.RefGetParm = RefGetParm,
|
||||
|
||||
.R_SetCurrentEntity = R_SetCurrentEntity,
|
||||
.R_SetCurrentModel = R_SetCurrentModel,
|
||||
.R_GetDetailScaleForTexture = R_GetDetailScaleForTexture,
|
||||
.R_SetDetailScaleForTexture = R_SetDetailScaleForTexture,
|
||||
|
||||
.GL_FindTexture = GL_FindTexture,
|
||||
.GL_TextureName = GL_TextureName,
|
||||
.GL_TextureData = GL_TextureData,
|
||||
.GL_LoadTexture = GL_LoadTexture,
|
||||
.GL_CreateTexture = GL_CreateTexture,
|
||||
.GL_LoadTextureArray = GL_LoadTextureArray,
|
||||
.GL_CreateTextureArray = GL_CreateTextureArray,
|
||||
.GL_FreeTexture = GL_FreeTexture,
|
||||
.GL_CreateTexture = GL_CreateTexture,
|
||||
.GL_FindTexture = GL_FindTexture,
|
||||
.GL_TextureName = GL_TextureName,
|
||||
.GL_TextureData = GL_TextureData,
|
||||
.GL_LoadTexture = GL_LoadTexture,
|
||||
.GL_FreeTexture = GL_FreeTexture,
|
||||
.R_OverrideTextureSourceSize = R_OverrideTextureSourceSize,
|
||||
.GL_UpdateTexture = GL_UpdateTexture,
|
||||
|
||||
.DrawSingleDecal = DrawSingleDecal,
|
||||
.R_DecalSetupVerts = R_DecalSetupVerts,
|
||||
.R_EntityRemoveDecals = R_EntityRemoveDecals,
|
||||
|
||||
.AVI_UploadRawFrame = AVI_UploadRawFrame,
|
||||
|
||||
.GL_Bind = GL_Bind,
|
||||
.GL_SelectTexture = R_SimpleStubInt,
|
||||
.GL_LoadTextureMatrix = GL_LoadTextureMatrix,
|
||||
.GL_TexMatrixIdentity = R_SimpleStub,
|
||||
.GL_CleanUpTextureUnits = R_SimpleStubInt,
|
||||
.GL_TexGen = GL_TexGen,
|
||||
.GL_TextureTarget = R_SimpleStubUInt,
|
||||
.GL_TexCoordArrayMode = R_SimpleStubUInt,
|
||||
.GL_UpdateTexSize = GL_UpdateTexSize,
|
||||
.GL_Reserved0 = NULL,
|
||||
.GL_Reserved1 = NULL,
|
||||
|
||||
.GL_DrawParticles = GL_DrawParticles,
|
||||
.LightVec = LightVec,
|
||||
.StudioGetTexture = StudioGetTexture,
|
||||
.GL_Bind = GL_Bind,
|
||||
|
||||
.GL_RenderFrame = R_RenderFrame,
|
||||
.GL_OrthoBounds = GL_OrthoBounds,
|
||||
@@ -566,37 +463,19 @@ static const ref_interface_t gReffuncs =
|
||||
.Mod_GetCurrentVis = Mod_GetCurrentVis,
|
||||
.R_NewMap = R_NewMap,
|
||||
.R_ClearScene = R_ClearScene,
|
||||
.R_GetProcAddress = R_GetProcAddress,
|
||||
|
||||
.TriRenderMode = R_SimpleStubInt,
|
||||
.Begin = R_SimpleStubInt,
|
||||
.End = R_SimpleStub,
|
||||
.Color4f = Color4f,
|
||||
.Color4ub = Color4ub,
|
||||
.TexCoord2f = TexCoord2f,
|
||||
.Vertex3fv = Vertex3fv,
|
||||
.Vertex3f = Vertex3f,
|
||||
.Fog = Fog,
|
||||
.ScreenToWorld = ScreenToWorld,
|
||||
.GetMatrix = GetMatrix,
|
||||
.FogParams = FogParams,
|
||||
.CullFace = CullFace,
|
||||
|
||||
.R_FillRenderAPI = R_FillRenderAPI,
|
||||
.R_FillTriAPI = R_FillTriAPI,
|
||||
|
||||
.VGUI_SetupDrawing = VGUI_SetupDrawing,
|
||||
.VGUI_UploadTextureBlock = VGUI_UploadTextureBlock,
|
||||
};
|
||||
|
||||
int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals );
|
||||
int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals )
|
||||
{
|
||||
if( version != REF_API_VERSION )
|
||||
return 0;
|
||||
|
||||
// fill in our callbacks
|
||||
*funcs = gReffuncs;
|
||||
gEngfuncs = *engfuncs;
|
||||
gpGlobals = globals;
|
||||
gp_cl = (ref_client_t *)gEngfuncs.EngineGetParm(PARM_GET_CLIENT_PTR, 0);
|
||||
|
||||
return REF_API_VERSION;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,6 @@ CVAR_DEFINE_AUTO( r_nocull, "0", 0, "ignore frustrum culling (perfomance test)"
|
||||
CVAR_DEFINE_AUTO( r_lockpvs, "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" );
|
||||
CVAR_DEFINE_AUTO( r_lockfrustum, "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" );
|
||||
|
||||
|
||||
DEFINE_ENGINE_SHARED_CVAR_LIST()
|
||||
|
||||
poolhandle_t r_temppool;
|
||||
|
||||
dx_globals_t tr;
|
||||
dx_context_t dxc;
|
||||
|
||||
@@ -220,7 +215,7 @@ static qboolean D3D_InitDevice( void )
|
||||
{
|
||||
d3dEBContext_t ebc = { 0 };
|
||||
if (!D3D_StartExecuteBuffer(&ebc))
|
||||
return;
|
||||
return false;
|
||||
void *cur = ebc.data;
|
||||
|
||||
D3D_PutInstruction(&cur, D3DOP_STATETRANSFORM, sizeof(D3DSTATE), 2);
|
||||
@@ -233,7 +228,7 @@ static qboolean D3D_InitDevice( void )
|
||||
ebc.insLength = ((char *)cur - (char *)ebc.data);
|
||||
|
||||
if (!D3D_EndExecuteBuffer(&ebc))
|
||||
return;
|
||||
return false;
|
||||
|
||||
DXCheck(IDirect3DDevice_BeginScene(dxc.pd3dd));
|
||||
DXCheck(IDirect3DDevice_Execute(dxc.pd3dd, ebc.pd3deb, dxc.viewport, D3DEXECUTE_CLIPPED));
|
||||
@@ -249,8 +244,6 @@ qboolean R_Init( void )
|
||||
{
|
||||
memset(&dxc, 0, sizeof(dxc));
|
||||
|
||||
RETRIEVE_ENGINE_SHARED_CVAR_LIST();
|
||||
|
||||
gEngfuncs.Cvar_RegisterVariable( &r_novis );
|
||||
gEngfuncs.Cvar_RegisterVariable( &r_nocull );
|
||||
gEngfuncs.Cvar_RegisterVariable( &r_lockpvs );
|
||||
@@ -320,6 +313,7 @@ qboolean R_Init( void )
|
||||
|
||||
// see R_ProcessEntData for tr.entities initialization
|
||||
tr.world = (struct world_static_s *)ENGINE_GET_PARM( PARM_GET_WORLD_PTR );
|
||||
tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
|
||||
|
||||
dxc.renderMode = kRenderNormal;
|
||||
Vector4Set(dxc.currentColor, 1, 1, 1, 1);
|
||||
|
||||
@@ -21,11 +21,6 @@ void R_Set2DMode( qboolean enable )
|
||||
|
||||
}
|
||||
|
||||
void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum )
|
||||
{
|
||||
if (texnum <= 0 || texnum >= MAX_TEXTURES)
|
||||
@@ -162,25 +157,3 @@ void FillRGBA( int rendermode, float x, float y, float w, float h, byte r, byte
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int currentFrame, const model_t *pSprite )
|
||||
{
|
||||
if( frameWidth )
|
||||
*frameWidth = 0;
|
||||
|
||||
if( frameHeight )
|
||||
*frameHeight = 0;
|
||||
|
||||
if( numFrames )
|
||||
*numFrames = 0;
|
||||
}
|
||||
|
||||
int R_GetSpriteTexture( const model_t *m_pSpriteModel, int frame )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AVI_UploadRawFrame( int texture, int cols, int rows, int width, int height, const byte *data )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
@@ -23,102 +23,7 @@ static dx_texture_t dx_textures[MAX_TEXTURES];
|
||||
static dx_texture_t *dx_texturesHashTable[TEXTURES_HASH_SIZE];
|
||||
static uint dx_numTextures;
|
||||
|
||||
static rgbdata_t *GL_FakeImage(int width, int height, int depth, int flags)
|
||||
{
|
||||
static byte data2D[1024]; // 16x16x4
|
||||
static rgbdata_t r_image;
|
||||
|
||||
// also use this for bad textures, but without alpha
|
||||
r_image.width = Q_max(1, width);
|
||||
r_image.height = Q_max(1, height);
|
||||
r_image.depth = Q_max(1, depth);
|
||||
r_image.flags = flags;
|
||||
r_image.type = PF_BGRA_32;
|
||||
r_image.size = r_image.width * r_image.height * r_image.depth * 4;
|
||||
r_image.buffer = (r_image.size > sizeof(data2D)) ? NULL : data2D;
|
||||
r_image.palette = NULL;
|
||||
r_image.numMips = 1;
|
||||
r_image.encode = 0;
|
||||
|
||||
if (FBitSet(r_image.flags, IMAGE_CUBEMAP))
|
||||
r_image.size *= 6;
|
||||
memset(data2D, 0xFF, sizeof(data2D));
|
||||
|
||||
return &r_image;
|
||||
}
|
||||
|
||||
static byte dottexture[8][8] =
|
||||
{
|
||||
{0,1,1,0,0,0,0,0},
|
||||
{1,1,1,1,0,0,0,0},
|
||||
{1,1,1,1,0,0,0,0},
|
||||
{0,1,1,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0},
|
||||
};
|
||||
|
||||
static void GL_CreateInternalTextures(void)
|
||||
{
|
||||
int dx2, dy, d;
|
||||
int x, y;
|
||||
rgbdata_t *pic;
|
||||
|
||||
// emo-texture from quake1
|
||||
pic = GL_FakeImage(16, 16, 1, IMAGE_HAS_COLOR);
|
||||
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
for (x = 0; x < 16; x++)
|
||||
{
|
||||
if ((y < 8) ^ (x < 8))
|
||||
((uint *)pic->buffer)[y * 16 + x] = 0xFFFF00FF;
|
||||
else ((uint *)pic->buffer)[y * 16 + x] = 0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
tr.defaultTexture = GL_LoadTextureFromBuffer(REF_DEFAULT_TEXTURE, pic, TF_COLORMAP, false);
|
||||
|
||||
// particle texture from quake1
|
||||
pic = GL_FakeImage(8, 8, 1, IMAGE_HAS_COLOR | IMAGE_HAS_ALPHA);
|
||||
|
||||
for (x = 0; x < 8; x++)
|
||||
{
|
||||
for (y = 0; y < 8; y++)
|
||||
{
|
||||
if (dottexture[x][y])
|
||||
pic->buffer[(y * 8 + x) * 4 + 3] = 255;
|
||||
else pic->buffer[(y * 8 + x) * 4 + 3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
tr.particleTexture = GL_LoadTextureFromBuffer(REF_PARTICLE_TEXTURE, pic, TF_CLAMP, false);
|
||||
|
||||
// white texture
|
||||
pic = GL_FakeImage(4, 4, 1, IMAGE_HAS_COLOR);
|
||||
for (x = 0; x < 16; x++)
|
||||
((uint *)pic->buffer)[x] = 0xFFFFFFFF;
|
||||
tr.whiteTexture = GL_LoadTextureFromBuffer(REF_WHITE_TEXTURE, pic, TF_COLORMAP, false);
|
||||
|
||||
// gray texture
|
||||
pic = GL_FakeImage(4, 4, 1, IMAGE_HAS_COLOR);
|
||||
for (x = 0; x < 16; x++)
|
||||
((uint *)pic->buffer)[x] = 0xFF7F7F7F;
|
||||
tr.grayTexture = GL_LoadTextureFromBuffer(REF_GRAY_TEXTURE, pic, TF_COLORMAP, false);
|
||||
|
||||
// black texture
|
||||
pic = GL_FakeImage(4, 4, 1, IMAGE_HAS_COLOR);
|
||||
for (x = 0; x < 16; x++)
|
||||
((uint *)pic->buffer)[x] = 0xFF000000;
|
||||
tr.blackTexture = GL_LoadTextureFromBuffer(REF_BLACK_TEXTURE, pic, TF_COLORMAP, false);
|
||||
|
||||
// cinematic dummy
|
||||
pic = GL_FakeImage(640, 100, 1, IMAGE_HAS_COLOR);
|
||||
tr.cinTexture = GL_LoadTextureFromBuffer("*cintexture", pic, TF_NOMIPMAP | TF_CLAMP, false);
|
||||
}
|
||||
|
||||
void R_InitImages(void)
|
||||
void R_InitImages( void )
|
||||
{
|
||||
memset(dx_textures, 0, sizeof(dx_textures));
|
||||
memset(dx_texturesHashTable, 0, sizeof(dx_texturesHashTable));
|
||||
@@ -130,11 +35,9 @@ void R_InitImages(void)
|
||||
dx_textures->nextHash = dx_texturesHashTable[dx_textures->hashValue];
|
||||
dx_texturesHashTable[dx_textures->hashValue] = dx_textures;
|
||||
dx_numTextures = 1;
|
||||
|
||||
GL_CreateInternalTextures();
|
||||
}
|
||||
|
||||
dx_texture_t *R_GetTexture(unsigned int texnum)
|
||||
dx_texture_t *R_GetTexture( unsigned int texnum )
|
||||
{
|
||||
Assert(texnum < MAX_TEXTURES);
|
||||
return &dx_textures[texnum];
|
||||
@@ -145,31 +48,31 @@ void R_ShowTextures( void )
|
||||
|
||||
}
|
||||
|
||||
const byte *R_GetTextureOriginalBuffer(unsigned int idx)
|
||||
const byte *R_GetTextureOriginalBuffer( unsigned int idx )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static qboolean GL_CheckTexName(const char *name)
|
||||
static qboolean GL_CheckTexName( const char *name )
|
||||
{
|
||||
int len;
|
||||
|
||||
if( COM_StringEmptyOrNULL( name ))
|
||||
return false;
|
||||
|
||||
len = Q_strlen(name);
|
||||
len = Q_strlen( name );
|
||||
|
||||
// because multi-layered textures can exceed name string
|
||||
if (len >= sizeof(dx_textures->name))
|
||||
if( len >= sizeof( dx_textures->name ))
|
||||
{
|
||||
gEngfuncs.Con_Printf(S_ERROR "LoadTexture: too long name %s (%d)\n", name, len);
|
||||
gEngfuncs.Con_Printf( S_ERROR "LoadTexture: too long name %s (%d)\n", name, len );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static dx_texture_t *GL_TextureForName(const char *name)
|
||||
static dx_texture_t *GL_TextureForName( const char *name )
|
||||
{
|
||||
dx_texture_t *tex;
|
||||
uint hash;
|
||||
@@ -186,7 +89,7 @@ static dx_texture_t *GL_TextureForName(const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static dx_texture_t *GL_AllocTexture(const char *name, texFlags_t flags)
|
||||
static dx_texture_t *GL_AllocTexture( const char *name, texFlags_t flags )
|
||||
{
|
||||
dx_texture_t *tex = NULL;
|
||||
|
||||
@@ -225,7 +128,7 @@ static dx_texture_t *GL_AllocTexture(const char *name, texFlags_t flags)
|
||||
return tex;
|
||||
}
|
||||
|
||||
static void GL_ProcessImage(dx_texture_t *tex, rgbdata_t *pic)
|
||||
static void GL_ProcessImage( dx_texture_t *tex, rgbdata_t *pic )
|
||||
{
|
||||
uint img_flags = 0;
|
||||
|
||||
@@ -272,7 +175,7 @@ static void GL_ProcessImage(dx_texture_t *tex, rgbdata_t *pic)
|
||||
}
|
||||
}
|
||||
|
||||
static int GL_CalcMipmapCount(dx_texture_t *tex, qboolean haveBuffer)
|
||||
static int GL_CalcMipmapCount( dx_texture_t *tex, qboolean haveBuffer )
|
||||
{
|
||||
int width, height;
|
||||
int mipcount;
|
||||
@@ -301,91 +204,7 @@ static int GL_CalcMipmapCount(dx_texture_t *tex, qboolean haveBuffer)
|
||||
return mipcount + 1;
|
||||
}
|
||||
|
||||
static byte *GL_ResampleTexture(const byte *source, int inWidth, int inHeight, int outWidth, int outHeight, qboolean isNormalMap)
|
||||
{
|
||||
uint frac, fracStep;
|
||||
uint *in = (uint *)source;
|
||||
uint p1[0x1000], p2[0x1000];
|
||||
byte *pix1, *pix2, *pix3, *pix4;
|
||||
uint *out, *inRow1, *inRow2;
|
||||
static byte *scaledImage = NULL; // pointer to a scaled image
|
||||
vec3_t normal;
|
||||
int i, x, y;
|
||||
|
||||
if (!source) return NULL;
|
||||
|
||||
scaledImage = Mem_Realloc(r_temppool, scaledImage, outWidth * outHeight * 4);
|
||||
fracStep = inWidth * 0x10000 / outWidth;
|
||||
out = (uint *)scaledImage;
|
||||
|
||||
frac = fracStep >> 2;
|
||||
for (i = 0; i < outWidth; i++)
|
||||
{
|
||||
p1[i] = 4 * (frac >> 16);
|
||||
frac += fracStep;
|
||||
}
|
||||
|
||||
frac = (fracStep >> 2) * 3;
|
||||
for (i = 0; i < outWidth; i++)
|
||||
{
|
||||
p2[i] = 4 * (frac >> 16);
|
||||
frac += fracStep;
|
||||
}
|
||||
|
||||
if (isNormalMap)
|
||||
{
|
||||
for (y = 0; y < outHeight; y++, out += outWidth)
|
||||
{
|
||||
inRow1 = in + inWidth * (int)(((float)y + 0.25f) * inHeight / outHeight);
|
||||
inRow2 = in + inWidth * (int)(((float)y + 0.75f) * inHeight / outHeight);
|
||||
|
||||
for (x = 0; x < outWidth; x++)
|
||||
{
|
||||
pix1 = (byte *)inRow1 + p1[x];
|
||||
pix2 = (byte *)inRow1 + p2[x];
|
||||
pix3 = (byte *)inRow2 + p1[x];
|
||||
pix4 = (byte *)inRow2 + p2[x];
|
||||
|
||||
normal[0] = MAKE_SIGNED(pix1[0]) + MAKE_SIGNED(pix2[0]) + MAKE_SIGNED(pix3[0]) + MAKE_SIGNED(pix4[0]);
|
||||
normal[1] = MAKE_SIGNED(pix1[1]) + MAKE_SIGNED(pix2[1]) + MAKE_SIGNED(pix3[1]) + MAKE_SIGNED(pix4[1]);
|
||||
normal[2] = MAKE_SIGNED(pix1[2]) + MAKE_SIGNED(pix2[2]) + MAKE_SIGNED(pix3[2]) + MAKE_SIGNED(pix4[2]);
|
||||
|
||||
if (!VectorNormalizeLength(normal))
|
||||
VectorSet(normal, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
((byte *)(out + x))[0] = 128 + (byte)(127.0f * normal[0]);
|
||||
((byte *)(out + x))[1] = 128 + (byte)(127.0f * normal[1]);
|
||||
((byte *)(out + x))[2] = 128 + (byte)(127.0f * normal[2]);
|
||||
((byte *)(out + x))[3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < outHeight; y++, out += outWidth)
|
||||
{
|
||||
inRow1 = in + inWidth * (int)(((float)y + 0.25f) * inHeight / outHeight);
|
||||
inRow2 = in + inWidth * (int)(((float)y + 0.75f) * inHeight / outHeight);
|
||||
|
||||
for (x = 0; x < outWidth; x++)
|
||||
{
|
||||
pix1 = (byte *)inRow1 + p1[x];
|
||||
pix2 = (byte *)inRow1 + p2[x];
|
||||
pix3 = (byte *)inRow2 + p1[x];
|
||||
pix4 = (byte *)inRow2 + p2[x];
|
||||
|
||||
((byte *)(out + x))[0] = (pix1[0] + pix2[0] + pix3[0] + pix4[0]) >> 2;
|
||||
((byte *)(out + x))[1] = (pix1[1] + pix2[1] + pix3[1] + pix4[1]) >> 2;
|
||||
((byte *)(out + x))[2] = (pix1[2] + pix2[2] + pix3[2] + pix4[2]) >> 2;
|
||||
((byte *)(out + x))[3] = (pix1[3] + pix2[3] + pix3[3] + pix4[3]) >> 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scaledImage;
|
||||
}
|
||||
|
||||
static void GL_TextureImageRAW(dx_texture_t *tex, int width, int height, int type, const char *data)
|
||||
static void GL_TextureImageRAW( dx_texture_t *tex, int width, int height, int type, const char *data )
|
||||
{
|
||||
if (!data)
|
||||
return;
|
||||
@@ -426,12 +245,12 @@ static void GL_TextureImageRAW(dx_texture_t *tex, int width, int height, int typ
|
||||
DXCheck(IDirectDrawSurface_Unlock(tex->dds, ddsd.lpSurface));
|
||||
}
|
||||
|
||||
static qboolean GL_UploadTexture(dx_texture_t *tex, rgbdata_t *pic)
|
||||
static qboolean GL_UploadTexture( dx_texture_t *tex, rgbdata_t *pic )
|
||||
{
|
||||
byte *buf, *data;
|
||||
size_t texsize, size;
|
||||
size_t size;
|
||||
uint width, height;
|
||||
uint i, j, numSides;
|
||||
uint j;
|
||||
qboolean normalMap;
|
||||
const byte *bufend;
|
||||
|
||||
@@ -581,7 +400,7 @@ static qboolean GL_UploadTexture(dx_texture_t *tex, rgbdata_t *pic)
|
||||
return true;
|
||||
}
|
||||
|
||||
int GL_LoadTextureFromBuffer(const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update)
|
||||
int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update )
|
||||
{
|
||||
dx_texture_t *tex;
|
||||
|
||||
@@ -618,33 +437,84 @@ int GL_LoadTextureFromBuffer(const char *name, rgbdata_t *pic, texFlags_t flags,
|
||||
return (tex - dx_textures);
|
||||
}
|
||||
|
||||
void GL_ProcessTexture(int texnum, float gamma, int topColor, int bottomColor)
|
||||
int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags )
|
||||
{
|
||||
qboolean update = FBitSet( flags, TF_UPDATE ) ? true : false;
|
||||
int datasize = 1;
|
||||
rgbdata_t r_empty;
|
||||
|
||||
if( FBitSet( flags, TF_ARB_16BIT ))
|
||||
datasize = 2;
|
||||
else if( FBitSet( flags, TF_ARB_FLOAT ))
|
||||
datasize = 4;
|
||||
|
||||
ClearBits( flags, TF_UPDATE );
|
||||
memset( &r_empty, 0, sizeof( r_empty ));
|
||||
r_empty.width = width;
|
||||
r_empty.height = height;
|
||||
r_empty.type = PF_RGBA_32;
|
||||
r_empty.size = r_empty.width * r_empty.height * datasize * 4;
|
||||
r_empty.buffer = (byte *)buffer;
|
||||
|
||||
// clear invalid combinations
|
||||
ClearBits( flags, TF_TEXTURE_3D );
|
||||
|
||||
// if image not luminance and not alphacontrast it will have color
|
||||
if( !FBitSet( flags, TF_LUMINANCE ) && !FBitSet( flags, TF_ALPHACONTRAST ))
|
||||
SetBits( r_empty.flags, IMAGE_HAS_COLOR );
|
||||
|
||||
if( FBitSet( flags, TF_HAS_ALPHA ))
|
||||
SetBits( r_empty.flags, IMAGE_HAS_ALPHA );
|
||||
|
||||
if( FBitSet( flags, TF_CUBEMAP ))
|
||||
{
|
||||
// no cubemaps in dx2
|
||||
return 0;
|
||||
}
|
||||
|
||||
int texnum = GL_LoadTextureFromBuffer( name, &r_empty, flags, update );
|
||||
|
||||
if( !Q_strcmp( name, REF_DEFAULT_TEXTURE ))
|
||||
tr.defaultTexture = texnum;
|
||||
else if( !Q_strcmp( name, REF_PARTICLE_TEXTURE ))
|
||||
tr.particleTexture = texnum;
|
||||
else if( !Q_strcmp( name, REF_WHITE_TEXTURE ))
|
||||
tr.whiteTexture = texnum;
|
||||
else if( !Q_strcmp( name, REF_GRAY_TEXTURE ))
|
||||
tr.grayTexture = texnum;
|
||||
else if( !Q_strcmp( name, REF_BLACK_TEXTURE ))
|
||||
tr.blackTexture = texnum;
|
||||
|
||||
return texnum;
|
||||
}
|
||||
|
||||
void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void GetDetailScaleForTexture(int texture, float *xScale, float *yScale)
|
||||
void R_GetDetailScaleForTexture( int texture, float *xScale, float *yScale )
|
||||
{
|
||||
*xScale = *yScale = 1.0f;
|
||||
}
|
||||
|
||||
void GetExtraParmsForTexture(int texture, byte *red, byte *green, byte *blue, byte *alpha)
|
||||
void R_SetDetailScaleForTexture( int texture, float xScale, float yScale )
|
||||
{
|
||||
*red = *green = *blue = *alpha = 0;
|
||||
;
|
||||
}
|
||||
|
||||
int GL_FindTexture(const char *name)
|
||||
int GL_FindTexture( const char *name )
|
||||
{
|
||||
gEngfuncs.Con_Printf("GL_FindTexture(%s)\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *GL_TextureName(unsigned int texnum)
|
||||
const char *GL_TextureName( unsigned int texnum )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const byte *GL_TextureData(unsigned int texnum)
|
||||
const byte *GL_TextureData( unsigned int texnum )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -694,22 +564,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags )
|
||||
return tex - dx_textures;
|
||||
}
|
||||
|
||||
int GL_CreateTexture(const char *name, int width, int height, const void *buffer, texFlags_t flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_LoadTextureArray(const char **names, int flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_CreateTextureArray(const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GL_FreeTexture(unsigned int texnum)
|
||||
void GL_FreeTexture( unsigned int texnum )
|
||||
{
|
||||
if (texnum <= 0 || texnum >= MAX_TEXTURES)
|
||||
return;
|
||||
@@ -756,12 +611,12 @@ void GL_FreeTexture(unsigned int texnum)
|
||||
memset(tex, 0, sizeof(*tex));
|
||||
}
|
||||
|
||||
void R_OverrideTextureSourceSize(unsigned int textnum, unsigned int srcWidth, unsigned int srcHeight)
|
||||
void R_OverrideTextureSourceSize( unsigned int textnum, unsigned int srcWidth, unsigned int srcHeight )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GL_UpdateTexSize( int texnum, int width, int height, int depth )
|
||||
void GL_UpdateTexture( int texnum, int cols, int rows, int width, int height, const byte *buffer, pixformat_t fmt )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
@@ -19,29 +19,19 @@ GNU General Public License for more details.
|
||||
#include "ref_common.h"
|
||||
#include "ref_api.h"
|
||||
#include "r_frustum.h"
|
||||
#include "ref_params.h"
|
||||
#include "mod_local.h"
|
||||
#include "com_strings.h"
|
||||
#include "pmove.h"
|
||||
|
||||
#define DIRECTDRAW_VERSION 0x0200
|
||||
#define DIRECT3D_VERSION 0x0500//D3DCOLORMODEL bug
|
||||
#include <ddraw.h>
|
||||
#include <d3d.h>
|
||||
|
||||
#define Assert(x) if(!( x )) gEngfuncs.Host_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
||||
|
||||
|
||||
extern poolhandle_t r_temppool;
|
||||
|
||||
|
||||
#define MAX_TEXTURES 8192
|
||||
#define TEXTURES_HASH_SIZE (MAX_TEXTURES >> 2)
|
||||
|
||||
// refparams
|
||||
#define RP_NONE 0
|
||||
#define RP_ENVVIEW BIT( 0 ) // used for cubemapshot
|
||||
#define RP_OLDVIEWLEAF BIT( 1 )
|
||||
#define RP_CLIPPLANE BIT( 2 )
|
||||
|
||||
#define MAX_DRAW_STACK 2 // normal view and menu view
|
||||
|
||||
#define CULL_VISIBLE 0 // not culled
|
||||
@@ -99,27 +89,16 @@ typedef struct d3dEBContext_s
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int params; // rendering parameters
|
||||
|
||||
qboolean drawWorld; // ignore world for drawing PlayerModel
|
||||
qboolean isSkyVisible; // sky is visible
|
||||
qboolean onlyClientDraw; // disabled by client request
|
||||
qboolean drawOrtho; // draw world as orthogonal projection
|
||||
|
||||
float fov_x, fov_y; // current view fov
|
||||
ref_viewpass_t rvp;
|
||||
|
||||
cl_entity_t *currententity;
|
||||
model_t *currentmodel;
|
||||
cl_entity_t *currentbeam; // same as above but for beams
|
||||
|
||||
int viewport[4];
|
||||
gl_frustum_t frustum;
|
||||
|
||||
mleaf_t *viewleaf;
|
||||
mleaf_t *oldviewleaf;
|
||||
vec3_t pvsorigin;
|
||||
vec3_t vieworg; // locked vieworigin
|
||||
vec3_t viewangles;
|
||||
vec3_t vforward;
|
||||
vec3_t vright;
|
||||
vec3_t vup;
|
||||
@@ -173,7 +152,6 @@ typedef struct
|
||||
int whiteTexture;
|
||||
int grayTexture;
|
||||
int blackTexture;
|
||||
int cinTexture; // cinematic texture
|
||||
|
||||
int skytexturenum; // index into model_t::textures
|
||||
|
||||
@@ -186,6 +164,7 @@ typedef struct
|
||||
qboolean modelviewIdentity;
|
||||
|
||||
int visframecount; // PVS frame
|
||||
int dlightframecount; // dynamic light frame
|
||||
int realframecount; // not including viewpasses
|
||||
int framecount;
|
||||
|
||||
@@ -199,9 +178,12 @@ typedef struct
|
||||
vec3_t modelorg; // relative to viewpoint
|
||||
|
||||
// get from engine
|
||||
model_t *worldmodel;
|
||||
world_static_t *world;
|
||||
cl_entity_t *entities;
|
||||
int max_entities;
|
||||
cl_entity_t *viewent;
|
||||
|
||||
uint max_entities;
|
||||
|
||||
ref_screen_rotation_t rotation;
|
||||
} dx_globals_t;
|
||||
@@ -234,10 +216,6 @@ extern ref_instance_t RI;
|
||||
extern dx_globals_t tr;
|
||||
extern dx_context_t dxc;
|
||||
|
||||
extern ref_api_t gEngfuncs;
|
||||
extern ref_globals_t *gpGlobals;
|
||||
extern ref_client_t *gp_cl;
|
||||
|
||||
|
||||
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
||||
{
|
||||
@@ -255,11 +233,6 @@ static inline model_t *CL_ModelHandle( int index )
|
||||
return gp_cl->models[index];
|
||||
}
|
||||
|
||||
static inline intptr_t ENGINE_GET_PARM( int parm )
|
||||
{
|
||||
return ( *gEngfuncs.EngineGetParm )( ( parm ), 0 );
|
||||
}
|
||||
|
||||
const char *dxResultToStr( HRESULT r );
|
||||
|
||||
#define DXCheckRet(DST, CALL) \
|
||||
@@ -303,18 +276,13 @@ void R_RenderFrame( const struct ref_viewpass_s *rvp );
|
||||
qboolean R_AddEntity( struct cl_entity_s *clent, int type );
|
||||
void R_ClearScene( void );
|
||||
int WorldToScreen( const vec3_t world, vec3_t screen );
|
||||
void ScreenToWorld( const float *screen, float *world );
|
||||
void R_LoadIdentity( void );
|
||||
void R_SetupD3D( qboolean set_state );
|
||||
|
||||
// r_draw.c
|
||||
void R_Set2DMode( qboolean enable );
|
||||
void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty );
|
||||
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum );
|
||||
void FillRGBA( int rendermode, float x, float y, float w, float h, byte r, byte g, byte b, byte a );
|
||||
void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int currentFrame, const model_t *pSprite );
|
||||
int R_GetSpriteTexture( const model_t *m_pSpriteModel, int frame );
|
||||
void AVI_UploadRawFrame( int texture, int cols, int rows, int width, int height, const byte *data );
|
||||
|
||||
// r_image.c
|
||||
void R_InitImages( void );
|
||||
@@ -323,28 +291,16 @@ void R_ShowTextures( void );
|
||||
const byte *R_GetTextureOriginalBuffer( unsigned int idx );
|
||||
int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
|
||||
void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor );
|
||||
void GetDetailScaleForTexture( int texture, float *xScale, float *yScale );
|
||||
void GetExtraParmsForTexture( int texture, byte *red, byte *green, byte *blue, byte *alpha );
|
||||
void R_GetDetailScaleForTexture( int texture, float *xScale, float *yScale );
|
||||
void R_SetDetailScaleForTexture( int texture, float xScale, float yScale );
|
||||
int GL_FindTexture( const char *name );
|
||||
const char *GL_TextureName( unsigned int texnum );
|
||||
const byte *GL_TextureData( unsigned int texnum );
|
||||
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
||||
int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags );
|
||||
int GL_LoadTextureArray( const char **names, int flags );
|
||||
int GL_CreateTextureArray( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
|
||||
void GL_FreeTexture( unsigned int texnum );
|
||||
void R_OverrideTextureSourceSize( unsigned int textnum, unsigned int srcWidth, unsigned int srcHeight );
|
||||
void GL_UpdateTexSize( int texnum, int width, int height, int depth );
|
||||
|
||||
// r_math.c
|
||||
void Matrix4x4_ToArrayFloatGL( const matrix4x4 in, float out[16] );
|
||||
void Matrix4x4_Concat( matrix4x4 out, const matrix4x4 in1, const matrix4x4 in2 );
|
||||
void Matrix4x4_ConcatTranslate( matrix4x4 out, float x, float y, float z );
|
||||
void Matrix4x4_ConcatRotate( matrix4x4 out, float angle, float x, float y, float z );
|
||||
void Matrix4x4_CreateProjection( matrix4x4 out, float xMax, float xMin, float yMax, float yMin, float zNear, float zFar );
|
||||
void Matrix4x4_CreateOrtho( matrix4x4 m, float xLeft, float xRight, float yBottom, float yTop, float zNear, float zFar );
|
||||
void Matrix4x4_CreateModelview( matrix4x4 out );
|
||||
|
||||
void GL_UpdateTexture( int texnum, int cols, int rows, int width, int height, const byte *buffer, pixformat_t fmt );
|
||||
|
||||
// r_surf.c
|
||||
void GL_SubdivideSurface( model_t *mod, msurface_t *fa );
|
||||
@@ -359,15 +315,3 @@ extern convar_t r_nocull;
|
||||
extern convar_t r_lockpvs;
|
||||
extern convar_t r_lockfrustum;
|
||||
|
||||
//
|
||||
// engine shared convars
|
||||
//
|
||||
DECLARE_ENGINE_SHARED_CVAR_LIST( )
|
||||
|
||||
#define Mem_Malloc( pool, size ) _Mem_Alloc( pool, size, false, __FILE__, __LINE__ )
|
||||
#define Mem_Calloc( pool, size ) _Mem_Alloc( pool, size, true, __FILE__, __LINE__ )
|
||||
#define Mem_Realloc( pool, ptr, size ) gEngfuncs._Mem_Realloc( pool, ptr, size, true, __FILE__, __LINE__ )
|
||||
#define Mem_Free( mem ) _Mem_Free( mem, __FILE__, __LINE__ )
|
||||
#define Mem_AllocPool( name ) gEngfuncs._Mem_AllocPool( name, __FILE__, __LINE__ )
|
||||
#define Mem_FreePool( pool ) gEngfuncs._Mem_FreePool( pool, __FILE__, __LINE__ )
|
||||
#define Mem_EmptyPool( pool ) gEngfuncs._Mem_EmptyPool( pool, __FILE__, __LINE__ )
|
||||
|
||||
136
ref/dx2/r_main.c
136
ref/dx2/r_main.c
@@ -22,45 +22,41 @@ ref_instance_t RI;
|
||||
|
||||
static float R_GetFarClip( void )
|
||||
{
|
||||
#if 0
|
||||
if( WORLDMODEL && RI.drawWorld )
|
||||
return tr.movevars->zmax * 1.73f;
|
||||
#endif
|
||||
if( tr.worldmodel && FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) )
|
||||
return gp_movevars->zmax * 1.73f;
|
||||
|
||||
return 2048.0f;
|
||||
}
|
||||
|
||||
void R_SetupFrustum( void )
|
||||
{
|
||||
const ref_overview_t *ov = gEngfuncs.GetOverviewParms();
|
||||
#if 0
|
||||
if( RP_NORMALPASS() && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ) && ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
|
||||
{
|
||||
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97f + sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||
}
|
||||
#endif
|
||||
// build the transformation matrix for the given view angles
|
||||
AngleVectors( RI.viewangles, RI.vforward, RI.vright, RI.vup );
|
||||
AngleVectors( RI.rvp.viewangles, RI.vforward, RI.vright, RI.vup );
|
||||
|
||||
if( !r_lockfrustum.value )
|
||||
{
|
||||
VectorCopy( RI.vieworg, RI.cullorigin );
|
||||
VectorCopy( RI.rvp.vieworigin, RI.cullorigin );
|
||||
VectorCopy( RI.vforward, RI.cull_vforward );
|
||||
VectorCopy( RI.vright, RI.cull_vright );
|
||||
VectorCopy( RI.vup, RI.cull_vup );
|
||||
}
|
||||
|
||||
if( RI.drawOrtho )
|
||||
if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
|
||||
{
|
||||
const ref_overview_t *ov = gEngfuncs.GetOverviewParms();
|
||||
GL_FrustumInitOrtho( &RI.frustum, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
|
||||
else GL_FrustumInitProj( &RI.frustum, 0.0f, R_GetFarClip(), RI.fov_x, RI.fov_y ); // NOTE: we ignore nearplane here (mirrors only)
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_FrustumInitProj( &RI.frustum, 0.0f, R_GetFarClip(), RI.rvp.fov_x, RI.rvp.fov_y ); // NOTE: we ignore nearplane here (mirrors only)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void R_SetupProjectionMatrix( matrix4x4 m )
|
||||
{
|
||||
float xMin, xMax, yMin, yMax, zNear, zFar;
|
||||
|
||||
if( RI.drawOrtho )
|
||||
if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
|
||||
{
|
||||
const ref_overview_t *ov = gEngfuncs.GetOverviewParms();
|
||||
Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
|
||||
@@ -72,10 +68,10 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
|
||||
zNear = 4.0f;
|
||||
zFar = Q_max( 256.0f, RI.farClip );
|
||||
|
||||
yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f );
|
||||
yMax = zNear * tan( RI.rvp.fov_y * M_PI_F / 360.0f );
|
||||
yMin = -yMax;
|
||||
|
||||
xMax = zNear * tan( RI.fov_x * M_PI_F / 360.0f );
|
||||
xMax = zNear * tan( RI.rvp.fov_x * M_PI_F / 360.0f );
|
||||
xMin = -xMax;
|
||||
|
||||
if( tr.rotation & 1 )
|
||||
@@ -98,17 +94,17 @@ static void R_SetupModelviewMatrix( matrix4x4 m )
|
||||
Matrix4x4_CreateModelview( m );
|
||||
if( tr.rotation & 1 )
|
||||
{
|
||||
Matrix4x4_ConcatRotate( m, anglemod( -RI.viewangles[2] + 90 ), 1, 0, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.viewangles[0], 0, 1, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.viewangles[1], 0, 0, 1 );
|
||||
Matrix4x4_ConcatRotate( m, anglemod( -RI.rvp.viewangles[2] + 90 ), 1, 0, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[0], 0, 1, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[1], 0, 0, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
Matrix4x4_ConcatRotate( m, -RI.viewangles[2], 1, 0, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.viewangles[0], 0, 1, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.viewangles[1], 0, 0, 1 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[2], 1, 0, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[0], 0, 1, 0 );
|
||||
Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[1], 0, 0, 1 );
|
||||
}
|
||||
Matrix4x4_ConcatTranslate( m, -RI.vieworg[0], -RI.vieworg[1], -RI.vieworg[2] );
|
||||
Matrix4x4_ConcatTranslate( m, -RI.rvp.vieworigin[0], -RI.rvp.vieworigin[1], -RI.rvp.vieworigin[2] );
|
||||
}
|
||||
|
||||
void R_LoadIdentity( void )
|
||||
@@ -150,21 +146,19 @@ static void R_DrawEntitiesOnList( void )
|
||||
|
||||
void R_RenderScene( void )
|
||||
{
|
||||
model_t *worldmodel = gp_cl->models[1];
|
||||
if (!worldmodel && RI.drawWorld)
|
||||
if( !tr.worldmodel && FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) )
|
||||
gEngfuncs.Host_Error("%s: NULL worldmodel\n", __func__);
|
||||
|
||||
// frametime is valid only for normal pass
|
||||
if (FBitSet(RI.params, RP_ENVVIEW) == 0)
|
||||
if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
|
||||
tr.frametime = gp_cl->time - gp_cl->oldtime;
|
||||
else tr.frametime = 0.0;
|
||||
|
||||
// begin a new frame
|
||||
tr.framecount++;
|
||||
|
||||
#if 0
|
||||
R_PushDlights();
|
||||
#endif
|
||||
tr.dlightframecount = R_PushDlights( tr.worldmodel, tr.framecount );
|
||||
|
||||
R_SetupFrustum();
|
||||
#if 0
|
||||
R_SetupFrame();
|
||||
@@ -176,7 +170,7 @@ void R_RenderScene( void )
|
||||
R_MarkLeaves();
|
||||
#if 0
|
||||
R_DrawFog();
|
||||
if (RI.drawWorld)
|
||||
if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
|
||||
R_AnimateRipples();
|
||||
|
||||
R_CheckGLFog();
|
||||
@@ -232,47 +226,28 @@ void R_AllowFog( qboolean allowed )
|
||||
|
||||
static void R_SetupRefParams( const ref_viewpass_t *rvp )
|
||||
{
|
||||
// RI.params = RP_NONE;
|
||||
RI.drawWorld = FBitSet(rvp->flags, RF_DRAW_WORLD);
|
||||
RI.onlyClientDraw = FBitSet(rvp->flags, RF_ONLY_CLIENTDRAW);
|
||||
RI.rvp = *rvp;
|
||||
|
||||
RI.farClip = 0;
|
||||
|
||||
if (!FBitSet(rvp->flags, RF_DRAW_CUBEMAP))
|
||||
RI.drawOrtho = FBitSet(rvp->flags, RF_DRAW_OVERVIEW);
|
||||
else RI.drawOrtho = false;
|
||||
|
||||
// setup viewport
|
||||
RI.viewport[0] = rvp->viewport[0];
|
||||
RI.viewport[1] = rvp->viewport[1];
|
||||
RI.viewport[2] = rvp->viewport[2];
|
||||
RI.viewport[3] = rvp->viewport[3];
|
||||
|
||||
// calc FOV
|
||||
RI.fov_x = rvp->fov_x;
|
||||
RI.fov_y = rvp->fov_y;
|
||||
|
||||
VectorCopy(rvp->vieworigin, RI.vieworg);
|
||||
VectorCopy(rvp->viewangles, RI.viewangles);
|
||||
VectorCopy(rvp->vieworigin, RI.pvsorigin);
|
||||
}
|
||||
|
||||
|
||||
void R_RenderFrame( const struct ref_viewpass_s *rvp )
|
||||
void R_RenderFrame( const ref_viewpass_t *rvp )
|
||||
{
|
||||
if (r_norefresh->value)
|
||||
if( r_norefresh->value )
|
||||
return;
|
||||
|
||||
// setup the initial render params
|
||||
R_SetupRefParams(rvp);
|
||||
R_SetupRefParams( rvp );
|
||||
|
||||
// completely override rendering
|
||||
if (gEngfuncs.drawFuncs->GL_RenderFrame != NULL)
|
||||
if( gEngfuncs.drawFuncs->GL_RenderFrame != NULL )
|
||||
{
|
||||
tr.fCustomRendering = true;
|
||||
|
||||
if (gEngfuncs.drawFuncs->GL_RenderFrame(rvp))
|
||||
if( gEngfuncs.drawFuncs->GL_RenderFrame( rvp ))
|
||||
{
|
||||
//R_GatherPlayerLight();
|
||||
R_GatherPlayerLight( tr.viewent );
|
||||
tr.realframecount++;
|
||||
tr.fResetVis = true;
|
||||
return;
|
||||
@@ -280,8 +255,10 @@ void R_RenderFrame( const struct ref_viewpass_s *rvp )
|
||||
}
|
||||
|
||||
tr.fCustomRendering = false;
|
||||
//if (!RI.onlyClientDraw)
|
||||
// R_RunViewmodelEvents();
|
||||
#if 0
|
||||
if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
|
||||
R_RunViewmodelEvents();
|
||||
#endif
|
||||
|
||||
tr.realframecount++; // right called after viewmodel events
|
||||
R_RenderScene();
|
||||
@@ -311,34 +288,29 @@ int WorldToScreen( const vec3_t world, vec3_t screen )
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ScreenToWorld( const float *screen, float *world )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void R_SetupD3D( qboolean set_state )
|
||||
{
|
||||
R_SetupModelviewMatrix(RI.worldviewMatrix);
|
||||
R_SetupProjectionMatrix(RI.projectionMatrix);
|
||||
R_SetupModelviewMatrix( RI.worldviewMatrix );
|
||||
R_SetupProjectionMatrix( RI.projectionMatrix );
|
||||
|
||||
Matrix4x4_Concat(RI.worldviewProjectionMatrix, RI.projectionMatrix, RI.worldviewMatrix);
|
||||
Matrix4x4_Concat( RI.worldviewProjectionMatrix, RI.projectionMatrix, RI.worldviewMatrix );
|
||||
|
||||
if (!set_state) return;
|
||||
if( !set_state ) return;
|
||||
|
||||
D3DVIEWPORT viewport = { 0 };
|
||||
viewport.dwSize = sizeof(viewport);
|
||||
|
||||
if (FBitSet(RI.params, RP_ENVVIEW) == 0)
|
||||
if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
|
||||
{
|
||||
int x, x2, y, y2;
|
||||
|
||||
// set up viewport (main, playersetup)
|
||||
x = floor(RI.viewport[0] * gpGlobals->width / gpGlobals->width);
|
||||
x2 = ceil((RI.viewport[0] + RI.viewport[2]) * gpGlobals->width / gpGlobals->width);
|
||||
y = floor(gpGlobals->height - RI.viewport[1] * gpGlobals->height / gpGlobals->height);
|
||||
y2 = ceil(gpGlobals->height - (RI.viewport[1] + RI.viewport[3]) * gpGlobals->height / gpGlobals->height);
|
||||
x = floor( RI.rvp.viewport[0] * gpGlobals->width / gpGlobals->width );
|
||||
x2 = ceil( (RI.rvp.viewport[0] + RI.rvp.viewport[2]) * gpGlobals->width / gpGlobals->width );
|
||||
y = floor( gpGlobals->height - RI.rvp.viewport[1] * gpGlobals->height / gpGlobals->height );
|
||||
y2 = ceil( gpGlobals->height - (RI.rvp.viewport[1] + RI.rvp.viewport[3]) * gpGlobals->height / gpGlobals->height );
|
||||
|
||||
if (tr.rotation & 1)
|
||||
if( tr.rotation & 1 )
|
||||
{
|
||||
viewport.dwX = y2;
|
||||
viewport.dwY = x;
|
||||
@@ -356,10 +328,10 @@ void R_SetupD3D( qboolean set_state )
|
||||
else
|
||||
{
|
||||
// envpass, mirrorpass
|
||||
viewport.dwX = RI.viewport[0];
|
||||
viewport.dwY = RI.viewport[1];
|
||||
viewport.dwWidth = RI.viewport[2];
|
||||
viewport.dwHeight = RI.viewport[3];
|
||||
viewport.dwX = RI.rvp.viewport[0];
|
||||
viewport.dwY = RI.rvp.viewport[1];
|
||||
viewport.dwWidth = RI.rvp.viewport[2];
|
||||
viewport.dwHeight = RI.rvp.viewport[3];
|
||||
}
|
||||
|
||||
viewport.dvScaleX = 0.5f * viewport.dwWidth;
|
||||
|
||||
@@ -277,7 +277,6 @@ static void R_DrawTextureChains( void )
|
||||
int i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
model_t *WORLDMODEL = (gp_cl->models[1]);
|
||||
|
||||
// make sure what color is reset
|
||||
Vector4Set( dxc.currentColor, 1, 1, 1, 1 );
|
||||
@@ -289,9 +288,9 @@ static void R_DrawTextureChains( void )
|
||||
RI.currententity = CL_GetEntityByIndex( 0 );
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
|
||||
for( i = 0; i < WORLDMODEL->numtextures; i++ )
|
||||
for( i = 0; i < tr.worldmodel->numtextures; i++ )
|
||||
{
|
||||
t = WORLDMODEL->textures[i];
|
||||
t = tr.worldmodel->textures[i];
|
||||
if( !t ) continue;
|
||||
|
||||
s = t->texturechain;
|
||||
@@ -332,7 +331,6 @@ static void R_RecursiveWorldNode( mnode_t *node, uint clipflags )
|
||||
float dot;
|
||||
mnode_t *children[2];
|
||||
int numsurfaces, firstsurface;
|
||||
model_t *WORLDMODEL = (gp_cl->models[1]);
|
||||
|
||||
loc0:
|
||||
if( node->contents == CONTENTS_SOLID )
|
||||
@@ -388,14 +386,14 @@ loc0:
|
||||
side = (dot >= 0.0f) ? 0 : 1;
|
||||
|
||||
// recurse down the children, front side first
|
||||
node_children( children, node, WORLDMODEL );
|
||||
node_children( children, node, tr.worldmodel );
|
||||
R_RecursiveWorldNode( children[side], clipflags );
|
||||
|
||||
firstsurface = node_firstsurface( node, WORLDMODEL );
|
||||
numsurfaces = node_numsurfaces( node, WORLDMODEL );
|
||||
firstsurface = node_firstsurface( node, tr.worldmodel );
|
||||
numsurfaces = node_numsurfaces( node, tr.worldmodel );
|
||||
|
||||
// draw stuff
|
||||
for( c = numsurfaces, surf = WORLDMODEL->surfaces + firstsurface; c; c--, surf++ )
|
||||
for( c = numsurfaces, surf = tr.worldmodel->surfaces + firstsurface; c; c--, surf++ )
|
||||
{
|
||||
if( R_CullSurface( surf, &RI.frustum, clipflags ))
|
||||
continue;
|
||||
@@ -424,7 +422,6 @@ loc0:
|
||||
void R_DrawWorld( void )
|
||||
{
|
||||
double start, end;
|
||||
model_t *WORLDMODEL = (gp_cl->models[1]);
|
||||
|
||||
// paranoia issues: when gl_renderer is "0" we need have something valid for currententity
|
||||
// to prevent crashing until HeadShield drawing.
|
||||
@@ -433,7 +430,7 @@ void R_DrawWorld( void )
|
||||
return;
|
||||
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
if( !RI.drawWorld || RI.onlyClientDraw )
|
||||
if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
|
||||
return;
|
||||
|
||||
VectorCopy( RI.cullorigin, tr.modelorg );
|
||||
@@ -447,11 +444,11 @@ void R_DrawWorld( void )
|
||||
//R_ClearSkyBox ();
|
||||
|
||||
start = gEngfuncs.pfnTime();
|
||||
if( RI.drawOrtho )
|
||||
if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
|
||||
{
|
||||
//R_DrawWorldTopView( WORLDMODEL->nodes, RI.frustum.clipFlags );
|
||||
//R_DrawWorldTopView( tr.worldmodel->nodes, RI.frustum.clipFlags );
|
||||
}
|
||||
else R_RecursiveWorldNode( WORLDMODEL->nodes, RI.frustum.clipFlags );
|
||||
else R_RecursiveWorldNode( tr.worldmodel->nodes, RI.frustum.clipFlags );
|
||||
end = gEngfuncs.pfnTime();
|
||||
|
||||
//r_stats.t_world_node = end - start;
|
||||
@@ -484,9 +481,8 @@ void R_MarkLeaves( void )
|
||||
mnode_t *node;
|
||||
vec3_t test;
|
||||
int i;
|
||||
model_t *WORLDMODEL = (gp_cl->models[1]);
|
||||
|
||||
if( !RI.drawWorld ) return;
|
||||
if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) ) return;
|
||||
|
||||
if( FBitSet( r_novis.flags, FCVAR_CHANGED ) || tr.fResetVis )
|
||||
{
|
||||
@@ -496,21 +492,17 @@ void R_MarkLeaves( void )
|
||||
RI.viewleaf = NULL;
|
||||
}
|
||||
|
||||
VectorCopy( RI.pvsorigin, test );
|
||||
VectorCopy( RI.rvp.vieworigin, test );
|
||||
|
||||
if( RI.viewleaf != NULL )
|
||||
{
|
||||
// merge two leafs that can be a crossed-line contents
|
||||
if( RI.viewleaf->contents == CONTENTS_EMPTY )
|
||||
{
|
||||
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] - 16.0f );
|
||||
leaf = gEngfuncs.Mod_PointInLeaf( test, WORLDMODEL->nodes );
|
||||
}
|
||||
VectorSet( test, RI.rvp.vieworigin[0], RI.rvp.vieworigin[1], RI.rvp.vieworigin[2] - 16.0f );
|
||||
else
|
||||
{
|
||||
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] + 16.0f );
|
||||
leaf = gEngfuncs.Mod_PointInLeaf( test, WORLDMODEL->nodes );
|
||||
}
|
||||
VectorSet( test, RI.rvp.vieworigin[0], RI.rvp.vieworigin[1], RI.rvp.vieworigin[2] + 16.0f );
|
||||
|
||||
leaf = gEngfuncs.Mod_PointInLeaf( test, tr.worldmodel->nodes, tr.worldmodel );
|
||||
|
||||
if(( leaf->contents != CONTENTS_SOLID ) && ( RI.viewleaf != leaf ))
|
||||
force = true;
|
||||
@@ -526,18 +518,18 @@ void R_MarkLeaves( void )
|
||||
RI.oldviewleaf = RI.viewleaf;
|
||||
tr.visframecount++;
|
||||
|
||||
if( r_novis.value || RI.drawOrtho || !RI.viewleaf || !WORLDMODEL->visdata )
|
||||
if( r_novis.value || FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ) || !RI.viewleaf || !tr.worldmodel->visdata )
|
||||
novis = true;
|
||||
|
||||
gEngfuncs.R_FatPVS( RI.pvsorigin, r_pvs_radius->value, RI.visbytes, FBitSet( RI.params, RP_OLDVIEWLEAF ), novis );
|
||||
gEngfuncs.R_FatPVS( RI.rvp.vieworigin, r_pvs_radius->value, RI.visbytes, false, novis );
|
||||
if( force && !novis )
|
||||
gEngfuncs.R_FatPVS( test, r_pvs_radius->value, RI.visbytes, true, novis );
|
||||
|
||||
for( i = 0; i < WORLDMODEL->numleafs; i++ )
|
||||
for( i = 0; i < tr.worldmodel->numleafs; i++ )
|
||||
{
|
||||
if( CHECKVISBIT( RI.visbytes, i ))
|
||||
{
|
||||
node = (mnode_t *)&WORLDMODEL->leafs[i+1];
|
||||
node = (mnode_t *)&tr.worldmodel->leafs[i+1];
|
||||
do
|
||||
{
|
||||
if( node->visframe == tr.visframecount )
|
||||
|
||||
@@ -13,6 +13,6 @@ def build(bld):
|
||||
source = ['r_context.c', 'r_image.c', 'r_d3d.c', 'r_main.c', 'r_draw.c', 'r_surf.c', 'r_frustum.c'],
|
||||
target = 'ref_dx2',
|
||||
defines = 'REF_DLL',
|
||||
use = 'engine_includes sdk_includes werror public USER32 DDRAW',
|
||||
use = 'ref_common engine_includes sdk_includes werror public USER32 DDRAW',
|
||||
install_path = bld.env.LIBDIR
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user