07 Feb 2018
This commit is contained in:
parent
83bee9ddb6
commit
811947e623
|
@ -10,8 +10,6 @@ backup.lst
|
|||
backup.bat
|
||||
release.bat
|
||||
change.log
|
||||
make_sdk.bat
|
||||
xash_sdk.lst
|
||||
|
||||
cl_dll\
|
||||
cl_dll\hl\
|
||||
|
|
|
@ -56,8 +56,6 @@ BRUSH MODELS
|
|||
#define SURF_UNDERWATER BIT( 7 ) // caustics
|
||||
#define SURF_TRANSPARENT BIT( 8 ) // it's a transparent texture (was SURF_DONTWARP)
|
||||
|
||||
#define SURF_REFLECT BIT( 31 ) // reflect surface (mirror)
|
||||
|
||||
// lightstyle management
|
||||
#define LM_STYLES 4 // MAXLIGHTMAPS
|
||||
#define LS_NORMAL 0x00
|
||||
|
|
|
@ -195,23 +195,24 @@ typedef struct mextrasurf_s
|
|||
vec3_t origin; // surface origin
|
||||
struct msurface_s *surf; // upcast to surface
|
||||
|
||||
// extended light info
|
||||
int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps
|
||||
|
||||
int mirrortexturenum; // gl texnum
|
||||
float mirrormatrix[4][4];
|
||||
|
||||
short lightmapmins[2]; // lightmatrix
|
||||
short lightextents[2];
|
||||
float lmvecs[2][4];
|
||||
|
||||
struct mextrasurf_s *mirrorchain; // for gl_texsort drawing
|
||||
struct mextrasurf_s *detailchain; // for detail textures drawing
|
||||
struct msurface_s *lightmapchain; // lightmapped polys
|
||||
struct cl_entity_s *parent; // upcast to owner entity
|
||||
color24 *deluxemap; // note: this is the actual deluxemap data for this surface
|
||||
byte *shadowmap; // note: occlusion map for this surface
|
||||
|
||||
// begin userdata
|
||||
struct msurface_s *lightmapchain; // lightmapped polys
|
||||
struct mextrasurf_s *detailchain; // for detail textures drawing
|
||||
struct mextrasurf_s *mirrorchain; // for gl_texsort drawing
|
||||
struct cl_entity_s *parent; // upcast to owner entity
|
||||
|
||||
int mirrortexturenum; // gl texnum
|
||||
float mirrormatrix[4][4];
|
||||
|
||||
struct grasshdr_s *grass; // grass that linked by this surface
|
||||
unsigned short grasscount; // number of bushes per polygon (used to determine total VBO size)
|
||||
unsigned short numverts; // world->vertexes[]
|
||||
|
|
|
@ -115,8 +115,6 @@
|
|||
|
||||
|
||||
|
||||
#define EF_NOREFLECT (1<<24) // Entity won't reflecting in mirrors
|
||||
#define EF_REFLECTONLY (1<<25) // Entity will be drawing only in mirrors
|
||||
#define EF_NOWATERCSG (1<<26) // Do not remove sides for func_water entity
|
||||
#define EF_FULLBRIGHT (1<<27) // Just get fullbright
|
||||
#define EF_NOSHADOW (1<<28) // ignore shadow for this entity
|
||||
|
|
|
@ -48,7 +48,7 @@ GNU General Public License for more details.
|
|||
#define PARM_TEX_MIPCOUNT 15 // count of mipmaps (0 - autogenerated, 1 - disabled of mipmapping)
|
||||
#define PARM_BSP2_SUPPORTED 16 // tell custom renderer what engine is support BSP2 in this build
|
||||
#define PARM_SKY_SPHERE 17 // sky is quake sphere ?
|
||||
#define PARM_MAP_HAS_MIRRORS 18 // current map has mirorrs
|
||||
//reserved
|
||||
#define PARM_MAP_HAS_DELUXE 19 // map has deluxedata
|
||||
#define PARM_MAX_ENTITIES 20
|
||||
#define PARM_WIDESCREEN 21
|
||||
|
|
|
@ -288,15 +288,9 @@ void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
|||
CL_UpdatePositions( ent );
|
||||
}
|
||||
|
||||
// g-cont. it should be done for all the players?
|
||||
if( ent->player && !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
// g-cont. it should be done for all the players?
|
||||
// FIXME: probably this cause problems with flahslight and mirror reflection
|
||||
// but it's used to reduce player body pitch...
|
||||
if( FBitSet( world.flags, FWORLD_HAS_MIRRORS ) && gl_allow_mirrors->value && RP_LOCALCLIENT( ent ) && !cl.local.thirdperson )
|
||||
ent->curstate.angles[PITCH] /= 3.0f;
|
||||
else ent->curstate.angles[PITCH] /= -3.0f;
|
||||
}
|
||||
ent->curstate.angles[PITCH] /= -3.0f;
|
||||
|
||||
VectorCopy( ent->curstate.origin, ent->origin );
|
||||
VectorCopy( ent->curstate.angles, ent->angles );
|
||||
|
@ -908,17 +902,17 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
|
||||
// check for adding this entity
|
||||
if( !clgame.dllFuncs.pfnAddEntity( entityType, ent, ent->model->name ))
|
||||
return true;
|
||||
|
||||
if( entityType == ET_PLAYER && RP_LOCALCLIENT( ent ))
|
||||
{
|
||||
if( !CL_IsThirdPerson( ))
|
||||
{
|
||||
if( !gl_allow_mirrors->value || !FBitSet( world.flags, FWORLD_HAS_MIRRORS ))
|
||||
return false;
|
||||
}
|
||||
// local player was reject by game code, so ignore any effects
|
||||
if( RP_LOCALCLIENT( ent ))
|
||||
cl.local.apply_effects = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// don't add the player in firstperson mode
|
||||
if( RP_LOCALCLIENT( ent ) && !CL_IsThirdPerson( ) && ( ent->index == cl.viewentity ))
|
||||
return false;
|
||||
|
||||
if( entityType == ET_BEAM )
|
||||
{
|
||||
CL_AddCustomBeam( ent );
|
||||
|
@ -933,6 +927,10 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
// is already occupied by FTENT_FLICKER
|
||||
if( entityType != ET_TEMPENTITY )
|
||||
{
|
||||
// no reason to do it twice
|
||||
if( RP_LOCALCLIENT( ent ))
|
||||
cl.local.apply_effects = false;
|
||||
|
||||
// apply client-side effects
|
||||
CL_AddEntityEffects( ent );
|
||||
|
||||
|
@ -975,7 +973,6 @@ for all current players
|
|||
*/
|
||||
void CL_LinkPlayers( frame_t *frame )
|
||||
{
|
||||
qboolean local_added = false;
|
||||
entity_state_t *state;
|
||||
cl_entity_t *ent;
|
||||
int i;
|
||||
|
@ -985,6 +982,7 @@ void CL_LinkPlayers( frame_t *frame )
|
|||
// apply muzzleflash to weaponmodel
|
||||
if( ent && FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ))
|
||||
SetBits( clgame.viewent.curstate.effects, EF_MUZZLEFLASH );
|
||||
cl.local.apply_effects = true;
|
||||
|
||||
// check all the clients but add only visible
|
||||
for( i = 0, state = frame->playerstate; i < MAX_CLIENTS; i++, state++ )
|
||||
|
@ -1036,15 +1034,11 @@ void CL_LinkPlayers( frame_t *frame )
|
|||
VectorCopy( ent->origin, ent->attachment[2] );
|
||||
VectorCopy( ent->origin, ent->attachment[3] );
|
||||
|
||||
if( CL_AddVisibleEntity( ent, ET_PLAYER ))
|
||||
{
|
||||
if( i == cl.playernum )
|
||||
local_added = true;
|
||||
}
|
||||
CL_AddVisibleEntity( ent, ET_PLAYER );
|
||||
}
|
||||
|
||||
// apply local player effects if entity is not added
|
||||
if( !local_added ) CL_AddEntityEffects( CL_GetLocalPlayer( ));
|
||||
if( cl.local.apply_effects ) CL_AddEntityEffects( CL_GetLocalPlayer( ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -905,10 +905,6 @@ void R_MuzzleFlash( const vec3_t pos, int type )
|
|||
if( index == 0 ) pTemp->entity.angles[2] = COM_RandomLong( 0, 20 ); // rifle flash
|
||||
else pTemp->entity.angles[2] = COM_RandomLong( 0, 359 );
|
||||
|
||||
// play playermodel muzzleflashes only for mirror pass
|
||||
if( RP_LOCALCLIENT( RI.currententity ) && !cl.local.thirdperson && ( RI.params & RP_MIRRORVIEW ))
|
||||
pTemp->entity.curstate.effects |= EF_REFLECTONLY;
|
||||
|
||||
CL_TempEntAddEntity( &pTemp->entity );
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ typedef struct
|
|||
// misc local info
|
||||
qboolean repredicting; // repredicting in progress
|
||||
qboolean thirdperson;
|
||||
qboolean apply_effects; // local player will not added but we should apply their effects: flashlight etc
|
||||
float idealpitch;
|
||||
int viewmodel;
|
||||
int health; // client health
|
||||
|
|
|
@ -85,9 +85,6 @@ void GL_BackendEndFrame( void )
|
|||
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i tempents\n%3i viewbeams\n%3i particles",
|
||||
r_stats.c_active_tents_count, r_stats.c_view_beams_count, r_stats.c_particle_count );
|
||||
break;
|
||||
case 6:
|
||||
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i mirrors\n", r_stats.c_mirror_passes );
|
||||
break;
|
||||
}
|
||||
|
||||
memset( &r_stats, 0, sizeof( r_stats ));
|
||||
|
|
|
@ -347,18 +347,6 @@ qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly )
|
|||
vec3_t mins, maxs;
|
||||
int i;
|
||||
|
||||
// support for custom mirror management
|
||||
if( RI.currentbeam != NULL )
|
||||
{
|
||||
// don't reflect this entity in mirrors
|
||||
if( FBitSet( RI.currentbeam->curstate.effects, EF_NOREFLECT ) && FBitSet( RI.params, RP_MIRRORVIEW ))
|
||||
return true;
|
||||
|
||||
// draw only in mirrors
|
||||
if( FBitSet( RI.currentbeam->curstate.effects, EF_REFLECTONLY ) && !FBitSet( RI.params, RP_MIRRORVIEW ))
|
||||
return true;
|
||||
}
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
if( start[i] < end[i] )
|
||||
|
|
|
@ -67,20 +67,9 @@ int R_CullModel( cl_entity_t *e, const vec3_t absmin, const vec3_t absmax )
|
|||
return 1;
|
||||
}
|
||||
|
||||
// don't reflect this entity in mirrors
|
||||
if( FBitSet( e->curstate.effects, EF_NOREFLECT ) && FBitSet( RI.params, RP_MIRRORVIEW ))
|
||||
return 1;
|
||||
|
||||
// draw only in mirrors
|
||||
if( FBitSet( e->curstate.effects, EF_REFLECTONLY ) && !FBitSet( RI.params, RP_MIRRORVIEW ))
|
||||
return 1;
|
||||
|
||||
// local client can't view himself if camera or thirdperson is not active
|
||||
if( RP_LOCALCLIENT( e ) && !cl.local.thirdperson && cl.viewentity == ( cl.playernum + 1 ))
|
||||
{
|
||||
if( !FBitSet( RI.params, RP_MIRRORVIEW ))
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
|
||||
if( R_CullBox( absmin, absmax ))
|
||||
return 1;
|
||||
|
@ -133,7 +122,7 @@ int R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags )
|
|||
}
|
||||
else dist = PlaneDiff( tr.modelorg, surf->plane );
|
||||
|
||||
if( glState.faceCull == GL_FRONT || ( RI.params & RP_MIRRORVIEW ))
|
||||
if( glState.faceCull == GL_FRONT )
|
||||
{
|
||||
if( FBitSet( surf->flags, SURF_PLANEBACK ))
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ void GL_FrustumInitProj( gl_frustum_t *out, float flZNear, float flZFar, float f
|
|||
VectorMA( RI.cullorigin, flZFar, RI.cull_vforward, farpoint );
|
||||
GL_FrustumSetPlane( out, FRUSTUM_FAR, iforward, DotProduct( iforward, farpoint ));
|
||||
|
||||
// no need to setup backplane for general view. It's only used for portals and mirrors
|
||||
// no need to setup backplane for general view.
|
||||
if( flZNear == 0.0f ) return;
|
||||
|
||||
// setup near plane
|
||||
|
|
|
@ -34,21 +34,18 @@ extern byte *r_temppool;
|
|||
#define MAX_DETAIL_TEXTURES 256
|
||||
#define MAX_LIGHTMAPS 256
|
||||
#define SUBDIVIDE_SIZE 64
|
||||
#define MAX_MIRRORS 32 // per one frame!
|
||||
#define MAX_DECAL_SURFS 4096
|
||||
#define MAX_MIRROR_ENTITIES MAX_MIRRORS
|
||||
|
||||
#define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles
|
||||
#define SHADE_LAMBERT 1.495f
|
||||
|
||||
// refparams
|
||||
#define RP_NONE 0
|
||||
#define RP_MIRRORVIEW BIT( 0 ) // lock pvs at vieworg
|
||||
#define RP_ENVVIEW BIT( 1 ) // used for cubemapshot
|
||||
#define RP_OLDVIEWLEAF BIT( 2 )
|
||||
#define RP_CLIPPLANE BIT( 3 ) // mirrors used
|
||||
#define RP_ENVVIEW BIT( 0 ) // used for cubemapshot
|
||||
#define RP_OLDVIEWLEAF BIT( 1 )
|
||||
#define RP_CLIPPLANE BIT( 2 )
|
||||
|
||||
#define RP_NONVIEWERREF (RP_MIRRORVIEW|RP_ENVVIEW)
|
||||
#define RP_NONVIEWERREF (RP_ENVVIEW)
|
||||
#define R_ModelOpaque( rm ) ( rm == kRenderNormal )
|
||||
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( cl.playernum + 1 ) && e->player )
|
||||
#define RP_NORMALPASS() ((RI.params & RP_NONVIEWERREF) == 0 )
|
||||
|
@ -94,13 +91,6 @@ typedef struct gltexture_s
|
|||
struct gltexture_s *nextHash;
|
||||
} gltexture_t;
|
||||
|
||||
// mirror entity
|
||||
typedef struct gl_entity_s
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
mextrasurf_t *chain;
|
||||
} gl_entity_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int params; // rendering parameters
|
||||
|
@ -187,18 +177,13 @@ typedef struct
|
|||
int grayCubeTexture;
|
||||
int whiteCubeTexture;
|
||||
int skyboxTextures[6]; // skybox sides
|
||||
int mirrorTextures[MAX_MIRRORS];
|
||||
int num_mirrors_used; // used mirror textures
|
||||
|
||||
int skytexturenum; // this not a gl_texturenum!
|
||||
|
||||
int skyboxbasenum; // start with 5800
|
||||
|
||||
// entity lists
|
||||
gl_entity_t mirror_entities[MAX_MIRROR_ENTITIES]; // an entities that has mirror
|
||||
cl_entity_t *solid_entities[MAX_VISIBLE_PACKET]; // opaque moving or alpha brushes
|
||||
cl_entity_t *trans_entities[MAX_VISIBLE_PACKET]; // translucent brushes
|
||||
uint num_mirror_entities;
|
||||
uint num_solid_entities;
|
||||
uint num_trans_entities;
|
||||
|
||||
|
@ -244,8 +229,6 @@ typedef struct
|
|||
uint c_sprite_models_drawn;
|
||||
uint c_particle_count;
|
||||
|
||||
uint c_mirror_passes;
|
||||
|
||||
uint c_client_ents; // entities that moved to client
|
||||
} ref_speeds_t;
|
||||
|
||||
|
@ -334,14 +317,6 @@ void R_TextureList_f( void );
|
|||
void R_InitImages( void );
|
||||
void R_ShutdownImages( void );
|
||||
|
||||
//
|
||||
// gl_mirror.c
|
||||
//
|
||||
void R_BeginDrawMirror( msurface_t *fa );
|
||||
void R_EndDrawMirror( void );
|
||||
void R_DrawMirrors( void );
|
||||
void R_FindMirrors( void );
|
||||
|
||||
//
|
||||
// gl_refrag.c
|
||||
//
|
||||
|
@ -408,7 +383,6 @@ imgfilter_t *R_FindTexFilter( const char *texname );
|
|||
//
|
||||
void R_MarkLeaves( void );
|
||||
void R_DrawWorld( void );
|
||||
void R_DrawMirrors( void );
|
||||
void R_DrawWaterSurfaces( void );
|
||||
void R_DrawBrushModel( cl_entity_t *e );
|
||||
void GL_SubdivideSurface( msurface_t *fa );
|
||||
|
@ -665,7 +639,6 @@ extern convar_t *gl_lightmap_nearest;
|
|||
extern convar_t *gl_keeptjunctions;
|
||||
extern convar_t *gl_detailscale;
|
||||
extern convar_t *gl_wireframe;
|
||||
extern convar_t *gl_allow_mirrors;
|
||||
extern convar_t *gl_polyoffset;
|
||||
extern convar_t *gl_finish;
|
||||
extern convar_t *gl_nosort;
|
||||
|
|
|
@ -1,589 +0,0 @@
|
|||
/*
|
||||
gl_mirror.c - draw reflected surfaces
|
||||
Copyright (C) 2010 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include "mod_local.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
/*
|
||||
================
|
||||
R_BeginDrawMirror
|
||||
|
||||
Setup texture matrix for mirror texture
|
||||
================
|
||||
*/
|
||||
void R_BeginDrawMirror( msurface_t *fa )
|
||||
{
|
||||
matrix4x4 m1, m2, matrix;
|
||||
GLfloat genVector[4][4];
|
||||
int i;
|
||||
|
||||
Matrix4x4_Copy( matrix, fa->info->mirrormatrix );
|
||||
|
||||
Matrix4x4_LoadIdentity( m1 );
|
||||
Matrix4x4_ConcatScale( m1, 0.5f );
|
||||
Matrix4x4_Concat( m2, m1, matrix );
|
||||
|
||||
Matrix4x4_LoadIdentity( m1 );
|
||||
Matrix4x4_ConcatTranslate( m1, 0.5f, 0.5f, 0.5f );
|
||||
Matrix4x4_Concat( matrix, m1, m2 );
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
genVector[0][i] = i == 0 ? 1 : 0;
|
||||
genVector[1][i] = i == 1 ? 1 : 0;
|
||||
genVector[2][i] = i == 2 ? 1 : 0;
|
||||
genVector[3][i] = i == 3 ? 1 : 0;
|
||||
}
|
||||
|
||||
GL_TexGen( GL_S, GL_OBJECT_LINEAR );
|
||||
GL_TexGen( GL_T, GL_OBJECT_LINEAR );
|
||||
GL_TexGen( GL_R, GL_OBJECT_LINEAR );
|
||||
GL_TexGen( GL_Q, GL_OBJECT_LINEAR );
|
||||
|
||||
pglTexGenfv( GL_S, GL_OBJECT_PLANE, genVector[0] );
|
||||
pglTexGenfv( GL_T, GL_OBJECT_PLANE, genVector[1] );
|
||||
pglTexGenfv( GL_R, GL_OBJECT_PLANE, genVector[2] );
|
||||
pglTexGenfv( GL_Q, GL_OBJECT_PLANE, genVector[3] );
|
||||
|
||||
GL_LoadTexMatrix( matrix );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_EndDrawMirror
|
||||
|
||||
Restore identity texmatrix
|
||||
================
|
||||
*/
|
||||
void R_EndDrawMirror( void )
|
||||
{
|
||||
GL_CleanUpTextureUnits( 0 );
|
||||
pglMatrixMode( GL_MODELVIEW );
|
||||
}
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
MIRROR RENDERING
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
/*
|
||||
================
|
||||
R_PlaneForMirror
|
||||
|
||||
Get transformed mirrorplane and entity matrix
|
||||
================
|
||||
*/
|
||||
void R_PlaneForMirror( msurface_t *surf, mplane_t *out, matrix4x4 m )
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
|
||||
ASSERT( out != NULL );
|
||||
|
||||
ent = RI.currententity;
|
||||
|
||||
// setup mirror plane
|
||||
*out = *surf->plane;
|
||||
|
||||
if( surf->flags & SURF_PLANEBACK )
|
||||
{
|
||||
VectorNegate( out->normal, out->normal );
|
||||
out->dist = -out->dist;
|
||||
}
|
||||
|
||||
if( !VectorIsNull( ent->origin ) || !VectorIsNull( ent->angles ))
|
||||
{
|
||||
mplane_t tmp;
|
||||
|
||||
if( !VectorIsNull( ent->angles )) Matrix4x4_CreateFromEntity( m, ent->angles, ent->origin, 1.0f );
|
||||
else Matrix4x4_CreateFromEntity( m, vec3_origin, ent->origin, 1.0f );
|
||||
|
||||
tmp = *out;
|
||||
|
||||
// transform mirror plane by entity matrix
|
||||
Matrix4x4_TransformPositivePlane( m, tmp.normal, tmp.dist, out->normal, &out->dist );
|
||||
}
|
||||
else Matrix4x4_LoadIdentity( m );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_AllocateMirrorTexture
|
||||
|
||||
Allocate the screen texture and make copy
|
||||
================
|
||||
*/
|
||||
int R_AllocateMirrorTexture( void )
|
||||
{
|
||||
rgbdata_t r_screen;
|
||||
int i, texture;
|
||||
char txName[16];
|
||||
|
||||
i = tr.num_mirrors_used;
|
||||
if( i >= MAX_MIRRORS )
|
||||
{
|
||||
MsgDev( D_ERROR, "R_AllocateMirrorTexture: mirror textures limit exceeded!\n" );
|
||||
return 0; // disable
|
||||
}
|
||||
|
||||
texture = tr.mirrorTextures[i];
|
||||
tr.num_mirrors_used++;
|
||||
|
||||
if( !texture )
|
||||
{
|
||||
// not initialized ?
|
||||
memset( &r_screen, 0, sizeof( r_screen ));
|
||||
Q_snprintf( txName, sizeof( txName ), "*screen%i", i );
|
||||
|
||||
r_screen.width = RI.viewport[2];
|
||||
r_screen.height = RI.viewport[3];
|
||||
r_screen.type = PF_RGBA_32;
|
||||
r_screen.size = r_screen.width * r_screen.height * 4;
|
||||
r_screen.flags = IMAGE_HAS_COLOR;
|
||||
r_screen.buffer = NULL; // create empty texture for now
|
||||
tr.mirrorTextures[i] = GL_LoadTextureInternal( txName, &r_screen, TF_IMAGE, false );
|
||||
texture = tr.mirrorTextures[i];
|
||||
}
|
||||
|
||||
GL_Bind( GL_TEXTURE0, texture );
|
||||
pglCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, RI.viewport[0], RI.viewport[1], RI.viewport[2], RI.viewport[3], 0 );
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_DrawMirrors
|
||||
|
||||
Draw all viewpasess from mirror position
|
||||
Mirror textures will be drawn in normal pass
|
||||
================
|
||||
*/
|
||||
void R_DrawMirrors( void )
|
||||
{
|
||||
ref_instance_t oldRI;
|
||||
mplane_t plane;
|
||||
msurface_t *surf, *surf2;
|
||||
int i, oldframecount;
|
||||
mextrasurf_t *es, *tmp, *mirrorchain;
|
||||
vec3_t forward, right, up;
|
||||
vec3_t origin, angles;
|
||||
matrix4x4 mirrormatrix;
|
||||
cl_entity_t *e;
|
||||
model_t *m;
|
||||
float d;
|
||||
|
||||
if( !tr.num_mirror_entities ) return; // mo mirrors for this frame
|
||||
|
||||
oldRI = RI; // make refinst backup
|
||||
oldframecount = tr.framecount;
|
||||
|
||||
for( i = 0; i < tr.num_mirror_entities; i++ )
|
||||
{
|
||||
mirrorchain = tr.mirror_entities[i].chain;
|
||||
|
||||
for( es = mirrorchain; es != NULL; es = es->mirrorchain )
|
||||
{
|
||||
RI.currententity = e = tr.mirror_entities[i].ent;
|
||||
RI.currentmodel = m = RI.currententity->model;
|
||||
|
||||
surf = es->surf;
|
||||
|
||||
ASSERT( RI.currententity != NULL );
|
||||
ASSERT( RI.currentmodel != NULL );
|
||||
|
||||
// NOTE: copy mirrortexture and mirrormatrix from another surfaces
|
||||
// from this entity\world that has same planes and reduce number of viewpasses
|
||||
|
||||
// make sure what we have one pass at least
|
||||
if( es != mirrorchain )
|
||||
{
|
||||
for( tmp = mirrorchain; tmp != es; tmp = tmp->mirrorchain )
|
||||
{
|
||||
surf2 = tmp->surf;
|
||||
|
||||
if( !tmp->mirrortexturenum )
|
||||
continue; // not filled?
|
||||
|
||||
if( surf->plane->dist != surf2->plane->dist )
|
||||
continue;
|
||||
|
||||
if( !VectorCompare( surf->plane->normal, surf2->plane->normal ))
|
||||
continue;
|
||||
|
||||
// found surface with same plane!
|
||||
break;
|
||||
}
|
||||
|
||||
if( tmp != es && tmp && tmp->mirrortexturenum )
|
||||
{
|
||||
// just copy reflection texture from surface with same plane
|
||||
Matrix4x4_Copy( es->mirrormatrix, tmp->mirrormatrix );
|
||||
es->mirrortexturenum = tmp->mirrortexturenum;
|
||||
continue; // pass skiped
|
||||
}
|
||||
}
|
||||
|
||||
R_PlaneForMirror( surf, &plane, mirrormatrix );
|
||||
|
||||
d = -2.0f * ( DotProduct( RI.vieworg, plane.normal ) - plane.dist );
|
||||
VectorMA( RI.vieworg, d, plane.normal, origin );
|
||||
|
||||
d = -2.0f * DotProduct( RI.vforward, plane.normal );
|
||||
VectorMA( RI.vforward, d, plane.normal, forward );
|
||||
VectorNormalize( forward );
|
||||
|
||||
d = -2.0f * DotProduct( RI.vright, plane.normal );
|
||||
VectorMA( RI.vright, d, plane.normal, right );
|
||||
VectorNormalize( right );
|
||||
|
||||
d = -2.0f * DotProduct( RI.vup, plane.normal );
|
||||
VectorMA( RI.vup, d, plane.normal, up );
|
||||
VectorNormalize( up );
|
||||
|
||||
VectorsAngles( forward, right, up, angles );
|
||||
angles[ROLL] = -angles[ROLL];
|
||||
|
||||
RI.params = RP_MIRRORVIEW|RP_CLIPPLANE|RP_OLDVIEWLEAF;
|
||||
RI.clipPlane = plane;
|
||||
|
||||
GL_FrustumSetPlane( &RI.frustum, FRUSTUM_NEAR, plane.normal, plane.dist );
|
||||
|
||||
RI.viewangles[0] = anglemod( angles[0] );
|
||||
RI.viewangles[1] = anglemod( angles[1] );
|
||||
RI.viewangles[2] = anglemod( angles[2] );
|
||||
VectorCopy( origin, RI.vieworg );
|
||||
VectorCopy( origin, RI.cullorigin );
|
||||
|
||||
// put pvsorigin before the mirror plane to avoid get full visibility on world mirrors
|
||||
if( RI.currententity == clgame.entities )
|
||||
{
|
||||
VectorMA( es->origin, 1.0f, plane.normal, origin );
|
||||
}
|
||||
else
|
||||
{
|
||||
Matrix4x4_VectorTransform( mirrormatrix, es->origin, origin );
|
||||
VectorMA( origin, 1.0f, plane.normal, origin );
|
||||
}
|
||||
|
||||
VectorCopy( origin, RI.pvsorigin );
|
||||
|
||||
if( GL_Support( GL_ARB_TEXTURE_NPOT_EXT ))
|
||||
{
|
||||
// allow screen size
|
||||
RI.viewport[2] = bound( 96, RI.viewport[2], 1024 );
|
||||
RI.viewport[3] = bound( 72, RI.viewport[3], 768 );
|
||||
}
|
||||
else
|
||||
{
|
||||
RI.viewport[2] = NearestPOW( RI.viewport[2], true );
|
||||
RI.viewport[3] = NearestPOW( RI.viewport[3], true );
|
||||
RI.viewport[2] = bound( 128, RI.viewport[2], 1024 );
|
||||
RI.viewport[3] = bound( 64, RI.viewport[3], 512 );
|
||||
}
|
||||
|
||||
R_RenderScene();
|
||||
r_stats.c_mirror_passes++;
|
||||
|
||||
es->mirrortexturenum = R_AllocateMirrorTexture();
|
||||
|
||||
// create personal projection matrix for mirror
|
||||
if( VectorIsNull( e->origin ) && VectorIsNull( e->angles ))
|
||||
{
|
||||
Matrix4x4_Copy( es->mirrormatrix, RI.worldviewProjectionMatrix );
|
||||
}
|
||||
else
|
||||
{
|
||||
Matrix4x4_ConcatTransforms( RI.modelviewMatrix, RI.worldviewMatrix, mirrormatrix );
|
||||
Matrix4x4_Concat( es->mirrormatrix, RI.projectionMatrix, RI.modelviewMatrix );
|
||||
}
|
||||
|
||||
RI = oldRI; // restore ref instance
|
||||
}
|
||||
|
||||
// clear chain for this entity
|
||||
for( es = mirrorchain; es != NULL; )
|
||||
{
|
||||
tmp = es->mirrorchain;
|
||||
es->mirrorchain = NULL;
|
||||
es = tmp;
|
||||
}
|
||||
|
||||
tr.mirror_entities[i].chain = NULL; // done
|
||||
tr.mirror_entities[i].ent = NULL;
|
||||
}
|
||||
|
||||
RI.viewleaf = NULL; // force markleafs next frame
|
||||
tr.num_mirror_entities = 0;
|
||||
tr.num_mirrors_used = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_RecursiveMirrorNode
|
||||
================
|
||||
*/
|
||||
void R_RecursiveMirrorNode( mnode_t *node, uint clipflags )
|
||||
{
|
||||
int i, clipped;
|
||||
msurface_t *surf, **mark;
|
||||
mleaf_t *pleaf;
|
||||
int c, side;
|
||||
float dot;
|
||||
|
||||
if( node->contents == CONTENTS_SOLID )
|
||||
return; // hit a solid leaf
|
||||
|
||||
if( node->visframe != tr.visframecount )
|
||||
return;
|
||||
|
||||
if( clipflags )
|
||||
{
|
||||
for( i = 0; i < 6; i++ )
|
||||
{
|
||||
const mplane_t *p = &RI.frustum.planes[i];
|
||||
|
||||
if( !FBitSet( clipflags, BIT( i )))
|
||||
continue;
|
||||
|
||||
clipped = BoxOnPlaneSide( node->minmaxs, node->minmaxs + 3, p );
|
||||
if( clipped == 2 ) return;
|
||||
if( clipped == 1 ) ClearBits( clipflags, BIT( i ));
|
||||
}
|
||||
}
|
||||
|
||||
// if a leaf node, draw stuff
|
||||
if( node->contents < 0 )
|
||||
{
|
||||
pleaf = (mleaf_t *)node;
|
||||
|
||||
mark = pleaf->firstmarksurface;
|
||||
c = pleaf->nummarksurfaces;
|
||||
|
||||
if( c )
|
||||
{
|
||||
do
|
||||
{
|
||||
(*mark)->visframe = tr.framecount;
|
||||
mark++;
|
||||
} while( --c );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// node is just a decision point, so go down the apropriate sides
|
||||
|
||||
// find which side of the node we are on
|
||||
dot = PlaneDiff( tr.modelorg, node->plane );
|
||||
side = (dot >= 0) ? 0 : 1;
|
||||
|
||||
// recurse down the children, front side first
|
||||
R_RecursiveMirrorNode( node->children[side], clipflags );
|
||||
|
||||
// draw stuff
|
||||
for( c = node->numsurfaces, surf = cl.worldmodel->surfaces + node->firstsurface; c; c--, surf++ )
|
||||
{
|
||||
if( !FBitSet( surf->flags, SURF_REFLECT ))
|
||||
continue;
|
||||
|
||||
if( R_CullSurface( surf, &RI.frustum, clipflags ))
|
||||
continue;
|
||||
|
||||
surf->info->mirrorchain = tr.mirror_entities[0].chain;
|
||||
tr.mirror_entities[0].chain = surf->info;
|
||||
}
|
||||
|
||||
// recurse down the back side
|
||||
R_RecursiveMirrorNode( node->children[!side], clipflags );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_FindBmodelMirrors
|
||||
|
||||
Check all bmodel surfaces and make personal mirror chain
|
||||
=================
|
||||
*/
|
||||
void R_FindBmodelMirrors( cl_entity_t *e, qboolean static_entity )
|
||||
{
|
||||
vec3_t mins, maxs;
|
||||
msurface_t *psurf;
|
||||
model_t *clmodel;
|
||||
qboolean rotated;
|
||||
gl_frustum_t *frustum = NULL;
|
||||
int i;
|
||||
|
||||
if( tr.num_mirror_entities >= MAX_MIRROR_ENTITIES )
|
||||
return;
|
||||
|
||||
clmodel = e->model;
|
||||
|
||||
// don't draw any water reflections if we underwater
|
||||
if( cl.local.waterlevel >= 3 && FBitSet( clmodel->flags, MODEL_LIQUID ))
|
||||
return;
|
||||
|
||||
if( static_entity )
|
||||
{
|
||||
Matrix4x4_LoadIdentity( RI.objectMatrix );
|
||||
|
||||
if( R_CullBox( clmodel->mins, clmodel->maxs ))
|
||||
return;
|
||||
|
||||
VectorCopy( RI.cullorigin, tr.modelorg );
|
||||
frustum = &RI.frustum;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !VectorIsNull( e->angles ))
|
||||
{
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
mins[i] = e->origin[i] - clmodel->radius;
|
||||
maxs[i] = e->origin[i] + clmodel->radius;
|
||||
}
|
||||
rotated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorAdd( e->origin, clmodel->mins, mins );
|
||||
VectorAdd( e->origin, clmodel->maxs, maxs );
|
||||
rotated = false;
|
||||
}
|
||||
|
||||
if( R_CullBox( mins, maxs ))
|
||||
return;
|
||||
|
||||
if( !VectorIsNull( e->origin ) || !VectorIsNull( e->angles ))
|
||||
{
|
||||
if( rotated ) Matrix4x4_CreateFromEntity( RI.objectMatrix, e->angles, e->origin, 1.0f );
|
||||
else Matrix4x4_CreateFromEntity( RI.objectMatrix, vec3_origin, e->origin, 1.0f );
|
||||
}
|
||||
else Matrix4x4_LoadIdentity( RI.objectMatrix );
|
||||
|
||||
e->visframe = tr.framecount; // visible
|
||||
|
||||
if( rotated ) Matrix4x4_VectorITransform( RI.objectMatrix, RI.cullorigin, tr.modelorg );
|
||||
else VectorSubtract( RI.cullorigin, e->origin, tr.modelorg );
|
||||
}
|
||||
|
||||
psurf = &clmodel->surfaces[clmodel->firstmodelsurface];
|
||||
for( i = 0; i < clmodel->nummodelsurfaces; i++, psurf++ )
|
||||
{
|
||||
if( !FBitSet( psurf->flags, SURF_REFLECT ))
|
||||
continue;
|
||||
|
||||
if( R_CullSurface( psurf, frustum, 0 ))
|
||||
continue;
|
||||
|
||||
psurf->info->mirrorchain = tr.mirror_entities[tr.num_mirror_entities].chain;
|
||||
tr.mirror_entities[tr.num_mirror_entities].chain = psurf->info;
|
||||
}
|
||||
|
||||
// store new mirror entity
|
||||
if( !static_entity && tr.mirror_entities[tr.num_mirror_entities].chain != NULL )
|
||||
{
|
||||
tr.mirror_entities[tr.num_mirror_entities].ent = RI.currententity;
|
||||
tr.num_mirror_entities++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_CheckEntitiesOnList
|
||||
|
||||
Check all bmodels for mirror surfaces
|
||||
=================
|
||||
*/
|
||||
void R_CheckEntitiesOnList( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
// world has mirror surfaces
|
||||
if( tr.mirror_entities[0].chain != NULL )
|
||||
{
|
||||
tr.mirror_entities[0].ent = clgame.entities;
|
||||
tr.num_mirror_entities++;
|
||||
}
|
||||
|
||||
// check solid entities
|
||||
for( i = 0; i < tr.num_solid_entities; i++ )
|
||||
{
|
||||
RI.currententity = tr.solid_entities[i];
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
|
||||
ASSERT( RI.currententity != NULL );
|
||||
ASSERT( RI.currententity->model != NULL );
|
||||
|
||||
switch( RI.currentmodel->type )
|
||||
{
|
||||
case mod_brush:
|
||||
R_FindBmodelMirrors( RI.currententity, false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check translucent entities
|
||||
for( i = 0; i < tr.num_trans_entities; i++ )
|
||||
{
|
||||
RI.currententity = tr.trans_entities[i];
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
|
||||
ASSERT( RI.currententity != NULL );
|
||||
ASSERT( RI.currententity->model != NULL );
|
||||
|
||||
switch( RI.currentmodel->type )
|
||||
{
|
||||
case mod_brush:
|
||||
R_FindBmodelMirrors( RI.currententity, false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_FindMirrors
|
||||
|
||||
Build mirror chains for this frame
|
||||
================
|
||||
*/
|
||||
void R_FindMirrors( void )
|
||||
{
|
||||
if( !FBitSet( world.flags, FWORLD_HAS_MIRRORS ) || RI.drawOrtho || !RI.drawWorld || RI.onlyClientDraw || !cl.worldmodel )
|
||||
return;
|
||||
|
||||
// NOTE: we already has initial params at this point like vieworg, viewangles
|
||||
// all other will be sets into R_SetupFrustum
|
||||
R_FindViewLeaf ();
|
||||
|
||||
// player is outside world. Don't update mirrors for speedup reasons
|
||||
if(( RI.viewleaf - cl.worldmodel->leafs - 1 ) == -1 )
|
||||
return;
|
||||
|
||||
R_SetupFrustum ();
|
||||
R_MarkLeaves ();
|
||||
|
||||
VectorCopy( RI.cullorigin, tr.modelorg );
|
||||
RI.currententity = clgame.entities;
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
|
||||
R_RecursiveMirrorNode( cl.worldmodel->nodes, RI.frustum.clipFlags );
|
||||
|
||||
R_CheckEntitiesOnList();
|
||||
}
|
|
@ -195,8 +195,8 @@ R_ClearScene
|
|||
*/
|
||||
void R_ClearScene( void )
|
||||
{
|
||||
tr.num_solid_entities = tr.num_trans_entities = 0;
|
||||
tr.num_mirror_entities = 0;
|
||||
tr.num_solid_entities = 0;
|
||||
tr.num_trans_entities = 0;
|
||||
cl.num_custombeams = 0;
|
||||
}
|
||||
|
||||
|
@ -363,13 +363,7 @@ R_SetupModelviewMatrix
|
|||
*/
|
||||
static void R_SetupModelviewMatrix( matrix4x4 m )
|
||||
{
|
||||
#if 0
|
||||
Matrix4x4_LoadIdentity( m );
|
||||
Matrix4x4_ConcatRotate( m, -90, 1, 0, 0 );
|
||||
Matrix4x4_ConcatRotate( m, 90, 0, 0, 1 );
|
||||
#else
|
||||
Matrix4x4_CreateModelview( m );
|
||||
#endif
|
||||
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 );
|
||||
|
@ -1070,15 +1064,8 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
|
|||
tr.fCustomRendering = false;
|
||||
if( !RI.onlyClientDraw )
|
||||
R_RunViewmodelEvents();
|
||||
|
||||
tr.realframecount++; // right called after viewmodel events
|
||||
|
||||
if( gl_allow_mirrors->value )
|
||||
{
|
||||
// render mirrors
|
||||
R_FindMirrors ();
|
||||
R_DrawMirrors ();
|
||||
}
|
||||
|
||||
R_RenderScene();
|
||||
}
|
||||
|
||||
|
@ -1179,8 +1166,6 @@ static int GL_RenderGetParm( int parm, int arg )
|
|||
return glState.width;
|
||||
case PARM_SCREEN_HEIGHT:
|
||||
return glState.height;
|
||||
case PARM_MAP_HAS_MIRRORS:
|
||||
return FBitSet( world.flags, FWORLD_HAS_MIRRORS );
|
||||
case PARM_CLIENT_INGAME:
|
||||
return CL_IsInGame();
|
||||
case PARM_MAX_ENTITIES:
|
||||
|
|
|
@ -64,7 +64,6 @@ static const dmaterial_t detail_table[] =
|
|||
{ "car", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "circuit", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "steel", "dt_ssteel1", 'M', 0, 0 },
|
||||
{ "reflect", "dt_ssteel1", 'G', 0, 0 },
|
||||
{ "dirt", "dt_ground%i", 'D', 1, 5 }, // dirt
|
||||
{ "drt", "dt_ground%i", 'D', 1, 5 },
|
||||
{ "out", "dt_ground%i", 'D', 1, 5 },
|
||||
|
|
|
@ -1088,8 +1088,7 @@ void R_RenderBrushPoly( msurface_t *fa )
|
|||
texture_t *t;
|
||||
int maps;
|
||||
qboolean is_dynamic = false;
|
||||
qboolean is_mirror = false;
|
||||
|
||||
|
||||
r_stats.c_world_polys++;
|
||||
|
||||
if( fa->flags & SURF_DRAWSKY )
|
||||
|
@ -1097,34 +1096,12 @@ void R_RenderBrushPoly( msurface_t *fa )
|
|||
|
||||
t = R_TextureAnimation( fa );
|
||||
|
||||
if( RP_NORMALPASS() && fa->flags & SURF_REFLECT )
|
||||
{
|
||||
if( fa->info->mirrortexturenum )
|
||||
{
|
||||
GL_Bind( GL_TEXTURE0, fa->info->mirrortexturenum );
|
||||
is_mirror = true;
|
||||
|
||||
// BEGIN WATER STUFF
|
||||
if( fa->flags & SURF_DRAWTURB )
|
||||
{
|
||||
R_BeginDrawMirror( fa );
|
||||
GL_Bind( GL_TEXTURE1, t->gl_texturenum );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
}
|
||||
}
|
||||
else GL_Bind( GL_TEXTURE0, t->gl_texturenum ); // dummy
|
||||
|
||||
// DEBUG: reset the mirror texture after drawing
|
||||
fa->info->mirrortexturenum = 0;
|
||||
}
|
||||
else GL_Bind( GL_TEXTURE0, t->gl_texturenum );
|
||||
GL_Bind( GL_TEXTURE0, t->gl_texturenum );
|
||||
|
||||
if( fa->flags & SURF_DRAWTURB )
|
||||
{
|
||||
// warp texture, no lightmaps
|
||||
EmitWaterPolys( fa->polys, ( fa->flags & SURF_NOCULL ), false );
|
||||
if( is_mirror ) R_EndDrawMirror();
|
||||
// END WATER STUFF
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1165,9 +1142,7 @@ void R_RenderBrushPoly( msurface_t *fa )
|
|||
}
|
||||
}
|
||||
|
||||
if( is_mirror ) R_BeginDrawMirror( fa );
|
||||
DrawGLPoly( fa->polys, 0.0f, 0.0f );
|
||||
if( is_mirror ) R_EndDrawMirror();
|
||||
|
||||
if( RI.currententity->curstate.rendermode == kRenderNormal )
|
||||
{
|
||||
|
@ -1185,10 +1160,6 @@ void R_RenderBrushPoly( msurface_t *fa )
|
|||
DrawSurfaceDecals( fa, true, (dist < 0.0f) ? true : false );
|
||||
}
|
||||
|
||||
// NOTE: draw mirror through in mirror show dummy lightmapped texture
|
||||
if( fa->flags & SURF_REFLECT && RP_NORMALPASS( ))
|
||||
return; // no lightmaps for mirror
|
||||
|
||||
if( fa->flags & SURF_DRAWTILED )
|
||||
return; // no lightmaps anyway
|
||||
|
||||
|
@ -1509,14 +1480,6 @@ void R_DrawBrushModel( cl_entity_t *e )
|
|||
|
||||
clmodel = e->model;
|
||||
|
||||
// don't reflect this entity in mirrors
|
||||
if( e->curstate.effects & EF_NOREFLECT && RI.params & RP_MIRRORVIEW )
|
||||
return;
|
||||
|
||||
// draw only in mirrors
|
||||
if( e->curstate.effects & EF_REFLECTONLY && !( RI.params & RP_MIRRORVIEW ))
|
||||
return;
|
||||
|
||||
if( !VectorIsNull( e->angles ))
|
||||
{
|
||||
for( i = 0; i < 3; i++ )
|
||||
|
@ -2136,16 +2099,7 @@ void GL_BuildLightmaps( void )
|
|||
GL_FreeTexture( tr.lightmapTextures[i] );
|
||||
}
|
||||
|
||||
// release old mirror textures
|
||||
for( i = 0; i < MAX_MIRRORS; i++ )
|
||||
{
|
||||
if( !tr.mirrorTextures[i] ) break;
|
||||
GL_FreeTexture( tr.mirrorTextures[i] );
|
||||
}
|
||||
|
||||
memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
memset( tr.mirror_entities, 0, sizeof( tr.mirror_entities ));
|
||||
memset( tr.mirrorTextures, 0, sizeof( tr.mirrorTextures ));
|
||||
memset( &RI, 0, sizeof( RI ));
|
||||
|
||||
// update the lightmap blocksize
|
||||
|
@ -2158,8 +2112,6 @@ void GL_BuildLightmaps( void )
|
|||
tr.framecount = tr.visframecount = 1; // no dlight cache
|
||||
gl_lms.current_lightmap_texture = 0;
|
||||
tr.modelviewIdentity = false;
|
||||
tr.num_mirror_entities = 0;
|
||||
tr.num_mirrors_used = 0;
|
||||
tr.realframecount = 1;
|
||||
nColinElim = 0;
|
||||
|
||||
|
|
|
@ -769,14 +769,6 @@ qboolean R_SpriteOccluded( cl_entity_t *e, vec3_t origin, float *pscale )
|
|||
float blend;
|
||||
vec3_t v;
|
||||
|
||||
// don't reflect this entity in mirrors
|
||||
if( e->curstate.effects & EF_NOREFLECT && RI.params & RP_MIRRORVIEW )
|
||||
return true;
|
||||
|
||||
// draw only in mirrors
|
||||
if( e->curstate.effects & EF_REFLECTONLY && !( RI.params & RP_MIRRORVIEW ))
|
||||
return true;
|
||||
|
||||
TriWorldToScreen( origin, v );
|
||||
|
||||
if( v[0] < RI.viewport[0] || v[0] > RI.viewport[0] + RI.viewport[2] )
|
||||
|
|
|
@ -36,7 +36,6 @@ convar_t *gl_keeptjunctions;
|
|||
convar_t *gl_showtextures;
|
||||
convar_t *gl_detailscale;
|
||||
convar_t *gl_check_errors;
|
||||
convar_t *gl_allow_mirrors;
|
||||
convar_t *gl_polyoffset;
|
||||
convar_t *gl_wireframe;
|
||||
convar_t *gl_max_size;
|
||||
|
@ -1592,7 +1591,6 @@ void GL_InitCommands( void )
|
|||
gl_texture_anisotropy = Cvar_Get( "gl_anisotropy", "2.0", FCVAR_ARCHIVE, "textures anisotropic filter" );
|
||||
gl_texture_lodbias = Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (prefomance|quality)" );
|
||||
gl_keeptjunctions = Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
|
||||
gl_allow_mirrors = Cvar_Get( "gl_allow_mirrors", "1", FCVAR_ARCHIVE, "allow to draw mirror surfaces" );
|
||||
gl_showtextures = Cvar_Get( "r_showtextures", "0", FCVAR_CHEAT, "show all uploaded textures" );
|
||||
gl_finish = Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
|
||||
gl_nosort = Cvar_Get( "gl_nosort", "0", FCVAR_ARCHIVE, "disable sorting of translucent surfaces" );
|
||||
|
|
|
@ -2147,14 +2147,6 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod )
|
|||
if( !Q_strncmp( tex->name, "{scroll", 7 ))
|
||||
SetBits( out->flags, SURF_CONVEYOR|SURF_TRANSPARENT );
|
||||
|
||||
// g-cont this texture comes from decals.wad he-he
|
||||
// support !reflect for reflected water
|
||||
if( !Q_strcmp( tex->name, "reflect1" ) || !Q_strncmp( tex->name, "!reflect", 8 ))
|
||||
{
|
||||
SetBits( world.flags, FWORLD_HAS_MIRRORS );
|
||||
SetBits( out->flags, SURF_REFLECT );
|
||||
}
|
||||
|
||||
if( tex->name[0] == '{' )
|
||||
SetBits( out->flags, SURF_TRANSPARENT );
|
||||
|
||||
|
@ -2377,9 +2369,8 @@ static void Mod_LoadLeafs( dbspmodel_t *bmod )
|
|||
{
|
||||
for( j = 0; j < out->nummarksurfaces; j++ )
|
||||
{
|
||||
// underwater surfaces can't have reflection (perfomance)
|
||||
// mark underwater surfaces
|
||||
SetBits( out->firstmarksurface[j]->flags, SURF_UNDERWATER );
|
||||
ClearBits( out->firstmarksurface[j]->flags, SURF_REFLECT );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ GNU General Public License for more details.
|
|||
#define FWORLD_CUSTOM_SKYBOX BIT( 1 )
|
||||
#define FWORLD_WATERALPHA BIT( 2 )
|
||||
#define FWORLD_HAS_DELUXEMAP BIT( 3 )
|
||||
#define FWORLD_HAS_MIRRORS BIT( 4 )
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -271,10 +271,6 @@ SOURCE=.\client\gl_image.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_mirror.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_refrag.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
62
make_sdk.bat
62
make_sdk.bat
|
@ -1,62 +0,0 @@
|
|||
@echo off
|
||||
color 5A
|
||||
echo XashXT Group 2010 (C)
|
||||
echo Create Xash3D SDK
|
||||
echo.
|
||||
|
||||
if not exist D:\Xash3D\src_main\xash_sdk/ mkdir D:\Xash3D\src_main\xash_sdk\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\engine/ mkdir D:\Xash3D\src_main\xash_sdk\engine\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\common/ mkdir D:\Xash3D\src_main\xash_sdk\common\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\mainui/ mkdir D:\Xash3D\src_main\xash_sdk\mainui\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\mainui\legacy/ mkdir D:\Xash3D\src_main\xash_sdk\mainui\legacy
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\utils/ mkdir D:\Xash3D\src_main\xash_sdk\utils\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\makefont/ mkdir D:\Xash3D\src_main\xash_sdk\utils\makefont
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui\include/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui\include
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui\lib/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui\lib
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui\lib\win32_vc6/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui\lib\win32_vc6
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\game_launch/ mkdir D:\Xash3D\src_main\xash_sdk\game_launch\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\cl_dll/ mkdir D:\Xash3D\src_main\xash_sdk\cl_dll\
|
||||
if not exist D:\Xash3D\src_main\xash_sdkcl_dll\hl/ mkdir D:\Xash3D\src_main\xash_sdk\cl_dll\hl\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\dlls/ mkdir D:\Xash3D\src_main\xash_sdk\dlls\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\dlls\wpn_shared/ mkdir D:\Xash3D\src_main\xash_sdk\dlls\wpn_shared\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\game_shared/ mkdir D:\Xash3D\src_main\xash_sdk\game_shared\
|
||||
if not exist D:\Xash3D\src_main\xash_sdk\pm_shared/ mkdir D:\Xash3D\src_main\xash_sdk\pm_shared\
|
||||
@copy /Y engine\*.h xash_sdk\engine\*.h
|
||||
@copy /Y game_launch\*.* xash_sdk\game_launch\*.*
|
||||
@copy /Y mainui\*.* xash_sdk\mainui\*.*
|
||||
@copy /Y mainui\legacy\*.* xash_sdk\mainui\legacy\*.*
|
||||
@copy /Y common\*.* xash_sdk\common\*.*
|
||||
@copy /Y cl_dll\*.* xash_sdk\cl_dll\*.*
|
||||
@copy /Y cl_dll\hl\*.* xash_sdk\cl_dll\hl\*.*
|
||||
@copy /Y dlls\*.* xash_sdk\dlls\*.*
|
||||
@copy /Y dlls\wpn_shared\*.* xash_sdk\dlls\wpn_shared\*.*
|
||||
@copy /Y utils\makefont\*.* xash_sdk\utils\makefont\*.*
|
||||
@copy /Y utils\vgui\include\*.* xash_sdk\utils\vgui\include\*.*
|
||||
@copy /Y utils\vgui\lib\win32_vc6\*.* xash_sdk\utils\vgui\lib\win32_vc6\*.*
|
||||
@copy /Y game_shared\*.* xash_sdk\game_shared\*.*
|
||||
@copy /Y pm_shared\*.* xash_sdk\pm_shared\*.*
|
||||
@copy /Y xash_sdk.dsw xash_sdk\xash_sdk.dsw
|
||||
echo Prepare OK!
|
||||
echo Please wait: creating SDK in progress
|
||||
C:\Progra~1\WinRar\rar a xash_sdk -dh -k -r -s -df -m5 @xash_sdk.lst >>makesdk.log
|
||||
if errorlevel 1 goto error
|
||||
if errorlevel 0 goto ok
|
||||
:ok
|
||||
cls
|
||||
echo SDK was sucessfully created
|
||||
echo and stored in RAR-chive "xash_sdk"
|
||||
echo Press any key for exit. :-)
|
||||
if exist makesdk.log del /f /q makesdk.log
|
||||
exit
|
||||
:error
|
||||
echo ******************************
|
||||
echo ***********Error!*************
|
||||
echo ******************************
|
||||
echo *See makesdk.log for details**
|
||||
echo ******************************
|
||||
echo ******************************
|
||||
echo.
|
||||
echo press any key for exit :-(
|
||||
pause>nul
|
||||
exit
|
22
xash_sdk.lst
22
xash_sdk.lst
|
@ -1,22 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2011 Š
|
||||
// list with SDK directories
|
||||
//=======================================================================
|
||||
|
||||
// global stuff
|
||||
xash_sdk\xash_sdk.dsw
|
||||
xash_sdk\cl_dll\
|
||||
xash_sdk\cl_dll\hl\
|
||||
xash_sdk\common\
|
||||
xash_sdk\dlls\
|
||||
xash_sdk\game_shared\
|
||||
xash_sdk\game_launch\
|
||||
xash_sdk\engine\
|
||||
xash_sdk\pm_shared\
|
||||
xash_sdk\mainui\
|
||||
xash_dsk\mainui\legacy
|
||||
xash_sdk\utils\
|
||||
xash_sdk\makefont\
|
||||
xash_sdk\utils\vgui\
|
||||
xash_sdk\utils\vgui\include\
|
||||
xash_sdk\utils\vgui\lib\win32_vc6\
|
Reference in New Issue