12 Dec 2010

This commit is contained in:
g-cont 2010-12-12 00:00:00 +03:00 committed by Alibek Omarov
parent 25d0b4b682
commit 422ce07337
22 changed files with 845 additions and 515 deletions

View File

@ -83,6 +83,7 @@ typedef struct glpoly_s
struct glpoly_s *chain;
int numverts;
int flags; // for SURF_UNDERWATER
// struct glpoly_s *fb_chain; // next fb poly in chain
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t;

View File

@ -23,9 +23,6 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% vid_gl/vid_gl.dsp %CONFIG%"vid_gl - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
if "%BUILD_ERROR%"=="" goto build_ok
echo *********************

View File

@ -2090,7 +2090,7 @@ void CBaseMonster :: StartMonster ( void )
// Try to move the monster to make sure it's not stuck in a brush.
if (!WALK_MOVE ( ENT(pev), 0, 0, WALKMOVE_NORMAL ) )
{
ALERT(at_error, "Monster %s stuck in wall--level design error", STRING(pev->classname));
ALERT(at_error, "Monster %s stuck in wall--level design error\n", STRING(pev->classname));
pev->effects = EF_BRIGHTFIELD;
}
}

View File

@ -1407,7 +1407,7 @@ void CChangeLevel :: Spawn( void )
ALERT( at_console, "a trigger_changelevel doesn't have a map" );
if ( FStrEq( m_szLandmarkName, "" ) )
ALERT( at_console, "trigger_changelevel to %s doesn't have a landmark", m_szMapName );
ALERT( at_console, "trigger_changelevel to %s doesn't have a landmark\n", m_szMapName );
if (!FStringNull ( pev->targetname ) )
{

View File

@ -1280,7 +1280,6 @@ void CL_FreeEntity( cl_entity_t *pEdict )
void CL_ClearWorld( void )
{
cl_entity_t *ent;
int i;
ent = EDICT_NUM( 0 );
ent->index = NUM_FOR_EDICT( ent );
@ -1289,10 +1288,6 @@ void CL_ClearWorld( void )
ent->curstate.movetype = MOVETYPE_PUSH;
ent->model = cl.worldmodel;
clgame.numEntities = 1;
// clear the lightstyles
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
cl.lightstyles[i].value = 1.0f;
}
void CL_InitEdicts( void )
@ -2930,13 +2925,19 @@ void Tri_DrawTriangles( int fTrans )
{
if( fTrans )
{
CL_DrawBeams( true );
CL_DrawParticles();
if( !RI.refdef.onlyClientDraw )
{
CL_DrawBeams( true );
CL_DrawParticles();
}
clgame.dllFuncs.pfnDrawTransparentTriangles ();
}
else
{
CL_DrawBeams( false );
if( !RI.refdef.onlyClientDraw )
{
CL_DrawBeams( false );
}
clgame.dllFuncs.pfnDrawNormalTriangles ();
}
}

View File

@ -25,6 +25,7 @@ convar_t *cl_nodelta;
convar_t *cl_crosshair;
convar_t *cl_cmdbackup;
convar_t *cl_draw_particles;
convar_t *cl_lightstyle_lerping;
convar_t *cl_idealpitchscale;
convar_t *cl_solid_players;
convar_t *cl_draw_beams;
@ -1451,6 +1452,7 @@ void CL_InitLocal( void )
cl_cmdrate = Cvar_Get( "cl_cmdrate", "30", CVAR_ARCHIVE, "Max number of command packets sent to server per second" );
cl_draw_particles = Cvar_Get( "cl_draw_particles", "1", CVAR_ARCHIVE, "Disable any particle effects" );
cl_draw_beams = Cvar_Get( "cl_draw_beams", "1", CVAR_ARCHIVE, "Disable view beams" );
cl_lightstyle_lerping = Cvar_Get( "cl_lightstyle_lerping", "0", CVAR_ARCHIVE, "enables animated light lerping (perfomance option)" );
Cvar_Get( "hud_scale", "0", CVAR_ARCHIVE|CVAR_LATCH, "scale hud at current resolution" );
Cvar_Get( "skin", "", CVAR_USERINFO, "player skin" ); // XDM 3.3 want this cvar

View File

@ -2099,7 +2099,7 @@ LIGHT STYLE MANAGEMENT
==============================================================
*/
static int lastofs;
#define STYLE_LERPING_THRESHOLD 3.0f // because we wan't interpolate fast sequences (e.g. on\off)
/*
================
@ -2109,50 +2109,41 @@ CL_ClearLightStyles
void CL_ClearLightStyles( void )
{
Mem_Set( cl.lightstyles, 0, sizeof( cl.lightstyles ));
lastofs = -1;
}
/*
================
CL_RunLightStyles
light animations
'm' is normal light, 'a' is no light, 'z' is double bright
================
*/
void CL_RunLightStyles( void )
{
int i, ofs;
lightstyle_t *ls;
if( cls.state != ca_active ) return;
ofs = (cl.time * 10);
if( ofs == lastofs ) return;
lastofs = ofs;
for( i = 0, ls = cl.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ )
{
if( ls->length == 0 ) ls->value = 0.0f; // disable light
else if( ls->length == 1 ) ls->value = ls->map[0];
else ls->value = ls->map[ofs%ls->length];
}
}
void CL_SetLightstyle( int style, const char *s )
{
int j, k;
int i, k;
lightstyle_t *ls;
float val1, val2;
ASSERT( s );
ASSERT( style >= 0 && style < MAX_LIGHTSTYLES );
com.strncpy( cl.lightstyles[style].pattern, s, sizeof( cl.lightstyles[0].pattern ));
ls = &cl.lightstyles[style];
j = com.strlen( s );
cl.lightstyles[style].length = j;
com.strncpy( ls->pattern, s, sizeof( ls->pattern ));
for( k = 0; k < j; k++ )
cl.lightstyles[style].map[k] = (float)(s[k]-'a') / (float)('m'-'a');
ls->length = com.strlen( s );
for( i = 0; i < ls->length; i++ )
ls->map[i] = (float)(s[i] - 'a');
ls->interp = true;
// check for allow interpolate
// NOTE: fast flickering styles looks ugly when interpolation is running
for( k = 0; k < ls->length; k++ )
{
val1 = ls->map[(k+0) % ls->length];
val2 = ls->map[(k+1) % ls->length];
if( fabs( val1 - val2 ) > STYLE_LERPING_THRESHOLD )
{
ls->interp = false;
break;
}
}
}
/*
@ -2268,8 +2259,9 @@ update client flashlight
*/
void CL_UpadteFlashlight( cl_entity_t *pEnt )
{
vec3_t vecSrc, vecEnd, vecPos;
vec3_t vecSrc, vecEnd;
vec3_t forward, view_ofs;
float distLight;
pmtrace_t trace;
dlight_t *dl;
@ -2312,19 +2304,16 @@ void CL_UpadteFlashlight( cl_entity_t *pEnt )
VectorMA( vecSrc, 512.0f, forward, vecEnd );
trace = PM_PlayerTrace( clgame.pmove, vecSrc, vecEnd, PM_TRACELINE_PHYSENTSONLY, 2, -1, NULL );
if( trace.fraction != 1.0f )
VectorMA( trace.endpos, -16.0f, trace.plane.normal, vecPos );
else VectorCopy( trace.endpos, vecPos );
distLight = (1.0f - trace.fraction);
// update flashlight endpos
dl = CL_AllocDlight( pEnt->index );
VectorCopy( vecPos, dl->origin );
VectorCopy( trace.endpos, dl->origin );
dl->die = cl.time + 0.001f; // die on next frame
dl->color.r = 255;
dl->color.g = 255;
dl->color.b = 255;
dl->radius = 96;
dl->color.r = 255 * distLight;
dl->color.g = 255 * distLight;
dl->color.b = 255 * distLight;
dl->radius = 64;
}
/*

View File

@ -484,6 +484,7 @@ extern convar_t *cl_testlights;
extern convar_t *cl_solid_players;
extern convar_t *cl_idealpitchscale;
extern convar_t *cl_allow_levelshots;
extern convar_t *cl_lightstyle_lerping;
extern convar_t *cl_draw_particles;
extern convar_t *cl_levelshot_name;
extern convar_t *cl_draw_beams;

View File

@ -15,7 +15,7 @@
extern byte *r_temppool;
#define MAX_TEXTURES 1024
#define MAX_LIGHTMAPS 64
#define MAX_LIGHTMAPS 128
#define SUBDIVIDE_SIZE 64
// refparams
@ -147,6 +147,7 @@ typedef struct
matrix4x4 projectionMatrix;
matrix4x4 worldviewProjectionMatrix; // worldviewMatrix * projectionMatrix
int lightstylevalue[MAX_LIGHTSTYLES];
mplane_t clipPlane;
} ref_instance_t;
@ -164,7 +165,10 @@ typedef struct
int lightmapTextures[MAX_LIGHTMAPS];
int skytexturenum; // this not a gl_texturenum!
// OpenGL matrix states
qboolean modelviewIdentity;
int visframecount; // PVS frame
int dlightframecount; // dynamic light frame
int framecount;
@ -184,6 +188,7 @@ extern ref_params_t r_lastRefdef;
extern ref_instance_t RI;
extern ref_globals_t tr;
extern float gldepthmin, gldepthmax;
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
extern mleaf_t *r_viewleaf2, *r_oldviewleaf2;
extern dlight_t cl_dlights[MAX_DLIGHTS];
@ -238,12 +243,17 @@ void R_StoreEfrags( efrag_t **ppefrag );
// gl_rlight.c
//
void R_PushDlights( void );
void R_AnimateLight( void );
void R_MarkLights( dlight_t *light, int bit, mnode_t *node );
//
// gl_rmain.c
//
void R_ClearScene( void );
void R_LoadIdentity( void );
void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size );
void R_TranslateForEntity( cl_entity_t *e );
void R_RotateForEntity( cl_entity_t *e );
//
// gl_rmath.c
@ -256,6 +266,8 @@ void V_AdjustFov( float *fov_x, float *fov_y, float width, float height, qboolea
//
void R_MarkLeaves( void );
void R_DrawWorld( void );
void R_DrawWaterSurfaces( void );
void R_DrawBrushModel( cl_entity_t *e );
void GL_SubdivideSurface( msurface_t *fa );
void GL_BuildPolygonFromSurface( msurface_t *fa );
void GL_BuildLightmaps( void );
@ -274,7 +286,7 @@ void R_ClearSkyBox( void );
void R_DrawSkyBox( void );
void EmitSkyLayers( msurface_t *fa );
void EmitSkyPolys( msurface_t *fa );
void EmitWaterPolys( msurface_t *fa );
void EmitWaterPolys( glpoly_t *polys );
void R_DrawSkyChain( msurface_t *s );
//
@ -363,6 +375,7 @@ typedef struct
GLfloat max_texture_lodbias;
int color_bits;
int alpha_bits;
int depth_bits;
int stencil_bits;
@ -440,7 +453,6 @@ extern convar_t *gl_skymip;
extern convar_t *gl_nobind;
extern convar_t *gl_finish;
extern convar_t *gl_clear;
extern convar_t *gl_texsort;
extern convar_t *r_width;
extern convar_t *r_height;
@ -448,6 +460,7 @@ extern convar_t *r_speeds;
extern convar_t *r_fullbright;
extern convar_t *r_norefresh;
extern convar_t *r_lighting_modulate;
extern convar_t *r_drawentities;
extern convar_t *r_adjust_fov;
extern convar_t *r_novis;
extern convar_t *r_nocull;

View File

@ -14,6 +14,63 @@ DYNAMIC LIGHTS
=============================================================================
*/
/*
==================
R_AnimateLight
==================
*/
void R_AnimateLight( void )
{
int i, k, flight, clight;
float l, lerpfrac, backlerp;
lightstyle_t *ls;
// light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright
flight = (int)floor( cl.time * 10 );
clight = (int)ceil( cl.time * 10 );
lerpfrac = ( cl.time * 10 ) - flight;
backlerp = 1.0f - lerpfrac;
for( i = 0, ls = cl.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ )
{
if( r_fullbright->integer || !cl.worldmodel->lightdata )
{
RI.lightstylevalue[i] = 256 * 256;
continue;
}
if( !ls->length )
{
// was 256, changed to 264 for consistency
RI.lightstylevalue[i] = 256 * r_lighting_modulate->value;
continue;
}
else if( ls->length == 1 )
{
// single length style so don't bother interpolating
RI.lightstylevalue[i] = ls->map[0] * 22 * r_lighting_modulate->value;
continue;
}
else if( !ls->interp || !cl_lightstyle_lerping->integer )
{
RI.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * r_lighting_modulate->value;
continue;
}
// interpolate animating light
// frame just gone
k = ls->map[flight % ls->length];
l = (float)( k * 22 ) * backlerp;
// upcoming frame
k = ls->map[clight % ls->length];
l += (float)( k * 22 ) * lerpfrac;
RI.lightstylevalue[i] = (int)l * r_lighting_modulate->value;
}
}
/*
=============
@ -22,7 +79,6 @@ R_MarkLights
*/
void R_MarkLights( dlight_t *light, int bit, mnode_t *node )
{
mplane_t *splitplane;
float dist;
msurface_t *surf;
int i;
@ -30,9 +86,8 @@ void R_MarkLights( dlight_t *light, int bit, mnode_t *node )
if( node->contents < 0 )
return;
splitplane = node->plane;
dist = DotProduct( light->origin, splitplane->normal ) - splitplane->dist;
dist = PlaneDiff( light->origin, node->plane );
if( dist > light->radius )
{
R_MarkLights( light, bit, node->children[0] );

View File

@ -18,9 +18,7 @@ mleaf_t *r_viewleaf, *r_oldviewleaf;
mleaf_t *r_viewleaf2, *r_oldviewleaf2;
uint r_numEntities;
cl_entity_t *r_solid_entities[MAX_VISIBLE_PACKET]; // opaque edicts
cl_entity_t *r_alpha_entities[MAX_VISIBLE_PACKET]; // edicts with rendermode kRenderTransAlpha
cl_entity_t *r_trans_entities[MAX_VISIBLE_PACKET]; // edicts with rendermode kRenderTransTexture, Additive etc
cl_entity_t *r_entities[MAX_VISIBLE_PACKET];
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs )
{
@ -92,7 +90,8 @@ R_ClearScene
*/
void R_ClearScene( void )
{
r_numEntities = 1;
Mem_Set( r_entities, 0, sizeof( r_entities ));
r_numEntities = 0;
}
/*
@ -102,7 +101,14 @@ R_AddEntity
*/
qboolean R_AddEntity( struct cl_entity_s *pRefEntity, int entityType )
{
if( r_numEntities >= MAX_VISIBLE_PACKET )
return false;
pRefEntity->curstate.entityType = entityType;
r_entities[r_numEntities] = pRefEntity;
r_numEntities++;
return true;
}
@ -235,6 +241,77 @@ static void R_SetupModelviewMatrix( const ref_params_t *fd, matrix4x4 m )
Matrix4x4_ConcatTranslate( m, -fd->vieworg[0], -fd->vieworg[1], -fd->vieworg[2] );
}
/*
=============
R_LoadIdentity
=============
*/
void R_LoadIdentity( void )
{
if( tr.modelviewIdentity ) return;
Matrix4x4_LoadIdentity( RI.objectMatrix );
Matrix4x4_Copy( RI.modelviewMatrix, RI.worldviewMatrix );
GL_LoadMatrix( RI.modelviewMatrix );
tr.modelviewIdentity = true;
}
/*
=============
R_RotateForEntity
=============
*/
void R_RotateForEntity( cl_entity_t *e )
{
float *org, *ang;
float scale = 1.0f;
if( e == clgame.entities )
{
R_LoadIdentity();
return;
}
org = e->origin;
ang = e->angles;
if( e->model->type != mod_brush && e->curstate.scale > 0.0f )
scale = e->curstate.scale;
Matrix4x4_CreateFromEntity( RI.objectMatrix, org[0], org[1], org[2], ang[0], ang[1], ang[2], scale );
Matrix4x4_ConcatTransforms( RI.modelviewMatrix, RI.worldviewMatrix, RI.objectMatrix );
GL_LoadMatrix( RI.modelviewMatrix );
tr.modelviewIdentity = false;
}
/*
=============
R_TranslateForEntity
=============
*/
void R_TranslateForEntity( cl_entity_t *e )
{
float scale = 1.0f;
if( e == clgame.entities )
{
R_LoadIdentity();
return;
}
if( e->model->type != mod_brush && e->curstate.scale > 0.0f )
scale = e->curstate.scale;
Matrix4x4_LoadIdentity( RI.objectMatrix );
Matrix4x4_SetOrigin( RI.objectMatrix, e->origin[0], e->origin[1], e->origin[2] );
Matrix4x4_ConcatScale( RI.objectMatrix, scale );
Matrix4x4_ConcatTransforms( RI.modelviewMatrix, RI.worldviewMatrix, RI.objectMatrix );
GL_LoadMatrix( RI.modelviewMatrix );
tr.modelviewIdentity = false;
}
/*
===============
R_SetupFrame
@ -246,7 +323,7 @@ static void R_SetupFrame( void )
VectorCopy( RI.refdef.vieworg, RI.vieworg );
AngleVectors( RI.refdef.viewangles, RI.vforward, RI.vright, RI.vup );
CL_RunLightStyles();
R_AnimateLight();
tr.framecount++;
@ -296,6 +373,14 @@ R_SetupGL
*/
static void R_SetupGL( void )
{
if( RI.refdef.waterlevel >= 3 )
{
float f;
f = com.sin( cl.time * 0.4f * ( M_PI * 2.7f ));
RI.refdef.fov_x += f;
RI.refdef.fov_y -= f;
}
R_SetupModelviewMatrix( &RI.refdef, RI.worldviewMatrix );
R_SetupProjectionMatrix( &RI.refdef, RI.projectionMatrix );
if( RI.params & RP_MIRRORVIEW ) RI.projectionMatrix[0][0] = -RI.projectionMatrix[0][0];
@ -346,6 +431,41 @@ static void R_EndGL( void )
pglDisable( GL_CLIP_PLANE0 );
}
/*
=============
R_DrawEntitiesOnList
=============
*/
void R_DrawEntitiesOnList( void )
{
int i;
if( !r_drawentities->integer )
return;
// first draw entities with rendermode 'normal'
for( i = 0; i < r_numEntities; i++ )
{
RI.currententity = r_entities[i];
ASSERT( RI.currententity != NULL );
if( RI.currententity->curstate.rendermode != kRenderNormal )
continue;
if( !RI.currententity->model )
continue;
switch( RI.currententity->model->type )
{
case mod_brush:
R_DrawBrushModel( RI.currententity );
break;
default:
break;
}
}
}
/*
================
R_RenderScene
@ -371,10 +491,12 @@ void R_RenderScene( const ref_params_t *fd )
R_DrawWorld();
CL_ExtraUpdate (); // don't let sound get messed up if going slow
Tri_DrawTriangles( false );
// R_DrawEntitiesOnList();
R_DrawEntitiesOnList();
CL_DrawParticles ();
R_DrawWaterSurfaces();
Tri_DrawTriangles( true );
R_EndGL();
}

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@
convar_t *gl_allow_software;
convar_t *gl_extensions;
convar_t *gl_colorbits;
convar_t *gl_alphabits;
convar_t *gl_depthbits;
convar_t *gl_stencilbits;
convar_t *gl_texturebits;
@ -36,7 +37,6 @@ convar_t *gl_skymip;
convar_t *gl_nobind;
convar_t *gl_finish;
convar_t *gl_clear;
convar_t *gl_texsort;
convar_t *r_width;
convar_t *r_height;
@ -44,6 +44,7 @@ convar_t *r_speeds;
convar_t *r_fullbright;
convar_t *r_norefresh;
convar_t *r_lighting_modulate;
convar_t *r_drawentities;
convar_t *r_adjust_fov;
convar_t *r_novis;
convar_t *r_nocull;
@ -635,13 +636,13 @@ qboolean GL_DeleteContext( void )
GL_ChoosePFD
=================
*/
static int GL_ChoosePFD( int colorBits, int depthBits, int stencilBits )
static int GL_ChoosePFD( int colorBits, int alphaBits, int depthBits, int stencilBits )
{
PIXELFORMATDESCRIPTOR PFDs[MAX_PFDS], *current, *selected;
uint flags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
int i, numPFDs, pixelFormat = 0;
MsgDev( D_NOTE, "GL_ChoosePFD( color %i, depth %i, stencil %i )\n", colorBits, depthBits, stencilBits );
MsgDev( D_NOTE, "GL_ChoosePFD( color %i, alpha %i, depth %i, stencil %i )\n", colorBits, alphaBits, depthBits, stencilBits );
// Count PFDs
if( glw_state.minidriver )
@ -682,6 +683,10 @@ static int GL_ChoosePFD( int colorBits, int depthBits, int stencilBits )
if( current->cColorBits < colorBits )
continue;
// check alpha bits
if( current->cAlphaBits < alphaBits )
continue;
// check depth bits
if( current->cDepthBits < depthBits )
continue;
@ -708,6 +713,16 @@ static int GL_ChoosePFD( int colorBits, int depthBits, int stencilBits )
}
}
if( alphaBits != selected->cAlphaBits )
{
if( alphaBits == current->cAlphaBits || current->cAlphaBits > selected->cAlphaBits )
{
selected = current;
pixelFormat = i;
continue;
}
}
if( depthBits != selected->cDepthBits )
{
if( depthBits == current->cDepthBits || current->cDepthBits > selected->cDepthBits )
@ -765,7 +780,8 @@ GL_SetPixelformat
qboolean GL_SetPixelformat( void )
{
PIXELFORMATDESCRIPTOR PFD;
int colorBits, depthBits, stencilBits;
int colorBits, alphaBits;
int depthBits, stencilBits;
int pixelFormat;
size_t gamma_size;
byte *savedGamma;
@ -789,17 +805,18 @@ qboolean GL_SetPixelformat( void )
// set color/depth/stencil
colorBits = (gl_colorbits->integer) ? gl_colorbits->integer : 32;
depthBits = (gl_depthbits->integer) ? gl_depthbits->integer : 24;
alphaBits = (gl_alphabits->integer) ? gl_alphabits->integer : 8;
stencilBits = (gl_stencilbits->integer) ? gl_stencilbits->integer : 0;
// choose a pixel format
pixelFormat = GL_ChoosePFD( colorBits, depthBits, stencilBits );
pixelFormat = GL_ChoosePFD( colorBits, alphaBits, depthBits, stencilBits );
if( !pixelFormat )
{
// try again with default color/depth/stencil
if( colorBits > 16 || depthBits > 16 || stencilBits > 0 )
pixelFormat = GL_ChoosePFD( 16, 16, 0 );
else pixelFormat = GL_ChoosePFD( 32, 24, 0 );
if( colorBits > 16 || depthBits > 16 || alphaBits > 0 || stencilBits > 0 )
pixelFormat = GL_ChoosePFD( 16, 0, 16, 0 );
else pixelFormat = GL_ChoosePFD( 32, 0, 24, 0 );
if( !pixelFormat )
{
@ -833,6 +850,7 @@ qboolean GL_SetPixelformat( void )
}
glConfig.color_bits = PFD.cColorBits;
glConfig.alpha_bits = PFD.cAlphaBits;
glConfig.depth_bits = PFD.cDepthBits;
glConfig.stencil_bits = PFD.cStencilBits;
@ -846,7 +864,7 @@ qboolean GL_SetPixelformat( void )
else glState.stencilEnabled = false;
// print out PFD specifics
MsgDev( D_NOTE, "GL PFD: color( %d-bits ) Z( %d-bit )\n", PFD.cColorBits, PFD.cDepthBits );
MsgDev( D_NOTE, "GL PFD: color( %d-bits ) alpha( %d-bits ) Z( %d-bit )\n", PFD.cColorBits, PFD.cAlphaBits, PFD.cDepthBits );
// init gamma ramp
Mem_Set( glState.stateRamp, 0, sizeof( glState.stateRamp ));
@ -1322,6 +1340,8 @@ void R_RenderInfo_f( void )
Msg( "SKYMIP: %i\n", gl_skymip->integer );
Msg( "TEXTUREMODE: %s\n", gl_texturemode->string );
Msg( "VERTICAL SYNC: %s\n", gl_swapInterval->integer ? "enabled" : "disabled" );
Msg( "Color %d bits, Alpha %d bits, Depth %d bits, Stencil %d bits\n", glConfig.color_bits,
glConfig.alpha_bits, glConfig.depth_bits, glConfig.stencil_bits );
}
//=======================================================================
@ -1337,7 +1357,7 @@ void GL_InitCommands( void )
r_speeds = Cvar_Get( "r_speeds", "0", CVAR_ARCHIVE, "shows renderer speeds" );
r_fullbright = Cvar_Get( "r_fullbright", "0", CVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
r_norefresh = Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" );
r_lighting_modulate = Cvar_Get( "r_lighting_modulate", "1", CVAR_ARCHIVE, "lightstyles modulate scale" );
r_lighting_modulate = Cvar_Get( "r_lighting_modulate", "0.6", CVAR_ARCHIVE, "lightstyles modulate scale" );
r_adjust_fov = Cvar_Get( "r_adjust_fov", "1", CVAR_ARCHIVE, "making FOV adjustment for wide-screens" );
r_novis = Cvar_Get( "r_novis", "0", 0, "ignore vis information (perfomance test)" );
r_nocull = Cvar_Get( "r_nocull", "0", 0, "ignore frustrum culling (perfomance test)" );
@ -1347,12 +1367,14 @@ void GL_InitCommands( void )
r_lightmap = Cvar_Get( "r_lightmap", "0", CVAR_CHEAT, "lightmap debugging tool" );
r_shadows = Cvar_Get( "r_shadows", "0", CVAR_ARCHIVE, "enable model shadows" );
r_fastsky = Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE, "enable algorhytm fo fast sky rendering (for old machines)" );
r_drawentities = Cvar_Get( "r_drawentities", "1", CVAR_CHEAT|CVAR_ARCHIVE, "render entities" );
gl_picmip = Cvar_Get( "gl_picmip", "0", CVAR_RENDERINFO|CVAR_LATCH_VIDEO, "reduces resolution of textures by powers of 2" );
gl_skymip = Cvar_Get( "gl_skymip", "0", CVAR_RENDERINFO|CVAR_LATCH_VIDEO, "reduces resolution of skybox textures by powers of 2" );
gl_ignorehwgamma = Cvar_Get( "gl_ignorehwgamma", "0", CVAR_ARCHIVE|CVAR_LATCH_VIDEO, "ignore hardware gamma (e.g. not support)" );
gl_allow_software = Cvar_Get( "gl_allow_software", "0", CVAR_ARCHIVE, "allow OpenGL software emulation" );
gl_colorbits = Cvar_Get( "gl_colorbits", "0", CVAR_ARCHIVE | CVAR_LATCH_VIDEO, "pixelformat color bits (0 - auto)" );
gl_alphabits = Cvar_Get( "gl_alphabits", "0", CVAR_ARCHIVE | CVAR_LATCH_VIDEO, "pixelformat alpha bits (0 - auto)" );
gl_depthbits = Cvar_Get( "gl_depthbits", "0", CVAR_ARCHIVE | CVAR_LATCH_VIDEO, "pixelformat depth bits (0 - auto)" );
gl_texturemode = Cvar_Get( "gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE, "texture filter" );
gl_texturebits = Cvar_Get( "gl_texturebits", "0", CVAR_ARCHIVE|CVAR_LATCH_VIDEO, "set texture upload format (0 - auto)" );
@ -1368,7 +1390,6 @@ void GL_InitCommands( void )
gl_showtextures = Cvar_Get( "r_showtextures", "0", CVAR_CHEAT, "show all uploaded textures (type values from 1 to 9)" );
gl_finish = Cvar_Get( "gl_finish", "0", CVAR_ARCHIVE, "use glFinish instead of glFlush" );
gl_clear = Cvar_Get( "gl_clear", "0", CVAR_ARCHIVE, "clearing screen after each frame" );
gl_texsort = Cvar_Get( "gl_texsort", "1", CVAR_ARCHIVE, "enable or disable sorting by texture" );
// make sure r_swapinterval is checked after vid_restart
gl_swapInterval->modified = true;

View File

@ -164,19 +164,28 @@ EmitWaterPolys
Does a water warp on the pre-fragmented glpoly_t chain
=============
*/
void EmitWaterPolys( msurface_t *fa )
void EmitWaterPolys( glpoly_t *polys )
{
glpoly_t *p;
float *v;
int i;
float *v, nv, waveHeight;
float s, t, os, ot;
int i;
for( p = fa->polys; p; p = p->next )
if( RI.currententity == clgame.entities )
waveHeight = RI.refdef.movevars->waveHeight * 2.0f;
else waveHeight = RI.currententity->curstate.scale * 32.0f;
for( p = polys; p; p = p->next )
{
pglBegin( GL_POLYGON );
for( i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE )
{
if( waveHeight )
nv = v[2] + waveHeight + ( waveHeight * com.sin(v[0] * 0.02 + cl.time)
* com.sin(v[1] * 0.02 + cl.time) * com.sin(v[2] * 0.02 + cl.time));
else nv = v[2];
os = v[3];
ot = v[4];
@ -187,9 +196,8 @@ void EmitWaterPolys( msurface_t *fa )
t *= ( 1.0f / SUBDIVIDE_SIZE );
pglTexCoord2f( s, t );
pglVertex3fv( v );
pglVertex3f( v[0], v[1], nv );
}
pglEnd();
}
}
@ -242,7 +250,6 @@ void R_DrawSkyChain( msurface_t *s )
{
msurface_t *fa;
// used when gl_texsort is on
GL_Bind( GL_TEXTURE0, tr.solidskyTexture );
speedscale = cl.time * 8;

View File

@ -20,7 +20,6 @@ extern stdlib_api_t com;
#define TF_FONT (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP)
#define TF_IMAGE (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP)
#define TF_DECAL (TF_CLAMP|TF_UNCOMPRESSED)
#define TF_LIGHTMAP TF_FONT
typedef enum
{
@ -38,6 +37,7 @@ typedef enum
TF_HAS_LUMA = BIT(11), // sets by GL_UploadTexture
TF_MAKELUMA = BIT(12), // create luma from quake texture
TF_NORMALMAP = BIT(13), // is a normalmap
TF_LIGHTMAP = BIT(14), // is a lightmap
} texFlags_t;
typedef struct

View File

@ -495,12 +495,12 @@ static void Mod_LoadTextures( const dlump_t *l )
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
if( world.version == HLBSP_VERSION ) size += sizeof( short ) + 768;
tx->fb_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA );
tx->fb_texturenum = GL_LoadTexture( texname, (byte *)mt, size, TF_MAKELUMA|TF_NOMIPMAP );
}
else
{
// okay, loading it from wad
tx->fb_texturenum = GL_LoadTexture( texname, NULL, 0, TF_MAKELUMA );
tx->fb_texturenum = GL_LoadTexture( texname, NULL, 0, TF_MAKELUMA|TF_NOMIPMAP );
}
}

View File

@ -56,10 +56,11 @@ typedef struct area_s
typedef struct
{
char pattern[CS_SIZE];
char pattern[MAX_STRING];
float map[MAX_STRING];
int length;
float value;
qboolean interp; // allow to interpolate this lightstyle
} lightstyle_t;
extern const char *et_name[];

View File

@ -4342,6 +4342,7 @@ void SV_LoadFromFile( script_t *entities )
token_t token;
int inhibited, spawned, died;
int current_skill = Cvar_VariableInteger( "skill" ); // lock skill level
qboolean inhibits_ents = (world.version == Q1BSP_VERSION) ? true : false;
qboolean deathmatch = Cvar_VariableInteger( "deathmatch" );
qboolean create_world = true;
edict_t *ent;
@ -4366,12 +4367,41 @@ void SV_LoadFromFile( script_t *entities )
if( !SV_ParseEdict( entities, ent ))
continue;
// remove things from different skill levels or deathmatch
if( inhibits_ents && deathmatch )
{
if( ent->v.spawnflags & (1<<11))
{
SV_FreeEdict( ent );
inhibited++;
continue;
}
}
else if( inhibits_ents && current_skill == 0 && ent->v.spawnflags & (1<<8))
{
SV_FreeEdict( ent );
inhibited++;
continue;
}
else if( inhibits_ents && current_skill == 1 && ent->v.spawnflags & (1<<9))
{
SV_FreeEdict( ent );
inhibited++;
continue;
}
else if( inhibits_ents && current_skill >= 2 && ent->v.spawnflags & (1<<10))
{
SV_FreeEdict( ent );
inhibited++;
continue;
}
if( svgame.dllFuncs.pfnSpawn( ent ) == -1 )
died++;
else spawned++;
}
MsgDev( D_INFO, "%i entities inhibited\n", inhibited );
MsgDev( D_INFO, "\n%i entities inhibited\n", inhibited );
}
/*

View File

@ -345,7 +345,7 @@ void SV_ClearWorld( void )
// clear lightstyles
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
sv.lightstyles[i].value = 1.0f;
sv.lightstyles[i].value = 256.0f;
sv_lastofs = -1;
Mem_Set( sv_areanodes, 0, sizeof( sv_areanodes ));
@ -1352,7 +1352,6 @@ trace_t SV_MoveToss( edict_t *tossent, edict_t *ignore )
*/
static vec3_t sv_pointColor;
static float sv_modulate;
/*
=================
@ -1431,7 +1430,7 @@ static qboolean SV_RecursiveLightPoint( model_t *model, mnode_t *node, const vec
for( map = 0; map < MAXLIGHTMAPS && surf->styles[map] != 255; map++ )
{
scale = sv.lightstyles[surf->styles[map]].value * sv_modulate;
scale = sv.lightstyles[surf->styles[map]].value;
sv_pointColor[0] += lm->r * scale;
sv_pointColor[1] += lm->g * scale;
@ -1459,9 +1458,9 @@ void SV_RunLightStyles( void )
for( i = 0, ls = sv.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ )
{
if( ls->length == 0 ) ls->value = 0.0f; // disable this light
else if( ls->length == 1 ) ls->value = ls->map[0];
else ls->value = ls->map[ofs%ls->length];
if( ls->length == 0 ) ls->value = 256.0f * sv_lighting_modulate->value; // disable this light
else if( ls->length == 1 ) ls->value = ls->map[0] * 22.0f * sv_lighting_modulate->value;
else ls->value = ls->map[ofs%ls->length] * 22.0f * sv_lighting_modulate->value;
}
}
@ -1485,7 +1484,7 @@ void SV_SetLightStyle( int style, const char* s )
sv.lightstyles[style].length = j;
for( k = 0; k < j; k++ )
sv.lightstyles[style].map[k] = (float)( s[k]-'a' ) / (float)( 'm'-'a' );
sv.lightstyles[style].map[k] = (float)(s[k] - 'a');
if( sv.state != ss_active ) return;
@ -1527,7 +1526,6 @@ int SV_LightForEntity( edict_t *pEdict )
else end[2] = start[2] - 8192;
VectorSet( sv_pointColor, 1.0f, 1.0f, 1.0f );
sv_modulate = sv_lighting_modulate->value * (1.0f / 255);
SV_RecursiveLightPoint( sv.worldmodel, sv.worldmodel->nodes, start, end );
return VectorAvg( sv_pointColor );

View File

@ -1,47 +1,53 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
/*
Copyright (C) 1997-2001 Id Software, Inc.
0, 0.19633, 0.392541, 0.588517, 0.784137, 0.979285, 1.17384, 1.3677,
1.56072, 1.75281, 1.94384, 2.1337, 2.32228, 2.50945, 2.69512, 2.87916,
3.06147, 3.24193, 3.42044, 3.59689, 3.77117, 3.94319, 4.11282, 4.27998,
4.44456, 4.60647, 4.76559, 4.92185, 5.07515, 5.22538, 5.37247, 5.51632,
5.65685, 5.79398, 5.92761, 6.05767, 6.18408, 6.30677, 6.42566, 6.54068,
6.65176, 6.75883, 6.86183, 6.9607, 7.05537, 7.14579, 7.23191, 7.31368,
7.39104, 7.46394, 7.53235, 7.59623, 7.65552, 7.71021, 7.76025, 7.80562,
7.84628, 7.88222, 7.91341, 7.93984, 7.96148, 7.97832, 7.99036, 7.99759,
8, 7.99759, 7.99036, 7.97832, 7.96148, 7.93984, 7.91341, 7.88222,
7.84628, 7.80562, 7.76025, 7.71021, 7.65552, 7.59623, 7.53235, 7.46394,
7.39104, 7.31368, 7.23191, 7.14579, 7.05537, 6.9607, 6.86183, 6.75883,
6.65176, 6.54068, 6.42566, 6.30677, 6.18408, 6.05767, 5.92761, 5.79398,
5.65685, 5.51632, 5.37247, 5.22538, 5.07515, 4.92185, 4.76559, 4.60647,
4.44456, 4.27998, 4.11282, 3.94319, 3.77117, 3.59689, 3.42044, 3.24193,
3.06147, 2.87916, 2.69512, 2.50945, 2.32228, 2.1337, 1.94384, 1.75281,
1.56072, 1.3677, 1.17384, 0.979285, 0.784137, 0.588517, 0.392541, 0.19633,
9.79717e-16, -0.19633, -0.392541, -0.588517, -0.784137, -0.979285, -1.17384, -1.3677,
-1.56072, -1.75281, -1.94384, -2.1337, -2.32228, -2.50945, -2.69512, -2.87916,
-3.06147, -3.24193, -3.42044, -3.59689, -3.77117, -3.94319, -4.11282, -4.27998,
-4.44456, -4.60647, -4.76559, -4.92185, -5.07515, -5.22538, -5.37247, -5.51632,
-5.65685, -5.79398, -5.92761, -6.05767, -6.18408, -6.30677, -6.42566, -6.54068,
-6.65176, -6.75883, -6.86183, -6.9607, -7.05537, -7.14579, -7.23191, -7.31368,
-7.39104, -7.46394, -7.53235, -7.59623, -7.65552, -7.71021, -7.76025, -7.80562,
-7.84628, -7.88222, -7.91341, -7.93984, -7.96148, -7.97832, -7.99036, -7.99759,
-8, -7.99759, -7.99036, -7.97832, -7.96148, -7.93984, -7.91341, -7.88222,
-7.84628, -7.80562, -7.76025, -7.71021, -7.65552, -7.59623, -7.53235, -7.46394,
-7.39104, -7.31368, -7.23191, -7.14579, -7.05537, -6.9607, -6.86183, -6.75883,
-6.65176, -6.54068, -6.42566, -6.30677, -6.18408, -6.05767, -5.92761, -5.79398,
-5.65685, -5.51632, -5.37247, -5.22538, -5.07515, -4.92185, -4.76559, -4.60647,
-4.44456, -4.27998, -4.11282, -3.94319, -3.77117, -3.59689, -3.42044, -3.24193,
-3.06147, -2.87916, -2.69512, -2.50945, -2.32228, -2.1337, -1.94384, -1.75281,
-1.56072, -1.3677, -1.17384, -0.979285, -0.784137, -0.588517, -0.392541, -0.19633,
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 2
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
0.000000, 0.098165, 0.196270, 0.294259, 0.392069, 0.489643, 0.586920, 0.683850,
0.780360, 0.876405, 0.971920, 1.066850, 1.161140, 1.254725, 1.347560, 1.439580,
1.530735, 1.620965, 1.710220, 1.798445, 1.885585, 1.971595, 2.056410, 2.139990,
2.222280, 2.303235, 2.382795, 2.460925, 2.537575, 2.612690, 2.686235, 2.758160,
2.828425, 2.896990, 2.963805, 3.028835, 3.092040, 3.153385, 3.212830, 3.270340,
3.325880, 3.379415, 3.430915, 3.480350, 3.527685, 3.572895, 3.615955, 3.656840,
3.695520, 3.731970, 3.766175, 3.798115, 3.827760, 3.855105, 3.880125, 3.902810,
3.923140, 3.941110, 3.956705, 3.969920, 3.980740, 3.989160, 3.995180, 3.998795,
4.000000, 3.998795, 3.995180, 3.989160, 3.980740, 3.969920, 3.956705, 3.941110,
3.923140, 3.902810, 3.880125, 3.855105, 3.827760, 3.798115, 3.766175, 3.731970,
3.695520, 3.656840, 3.615955, 3.572895, 3.527685, 3.480350, 3.430915, 3.379415,
3.325880, 3.270340, 3.212830, 3.153385, 3.092040, 3.028835, 2.963805, 2.896990,
2.828425, 2.758160, 2.686235, 2.612690, 2.537575, 2.460925, 2.382795, 2.303235,
2.222280, 2.139990, 2.056410, 1.971595, 1.885585, 1.798445, 1.710220, 1.620965,
1.530735, 1.439580, 1.347560, 1.254725, 1.161140, 1.066850, 0.971920, 0.876405,
0.780360, 0.683850, 0.586920, 0.489643, 0.392069, 0.294259, 0.196270, 0.098165,
0.000000, -0.098165, -0.196270, -0.294259, -0.392069, -0.489643, -0.586920, -0.683850,
-0.780360, -0.876405, -0.971920, -1.066850, -1.161140, -1.254725, -1.347560, -1.439580,
-1.530735, -1.620965, -1.710220, -1.798445, -1.885585, -1.971595, -2.056410, -2.139990,
-2.222280, -2.303235, -2.382795, -2.460925, -2.537575, -2.612690, -2.686235, -2.758160,
-2.828425, -2.896990, -2.963805, -3.028835, -3.092040, -3.153385, -3.212830, -3.270340,
-3.325880, -3.379415, -3.430915, -3.480350, -3.527685, -3.572895, -3.615955, -3.656840,
-3.695520, -3.731970, -3.766175, -3.798115, -3.827760, -3.855105, -3.880125, -3.902810,
-3.923140, -3.941110, -3.956705, -3.969920, -3.980740, -3.989160, -3.995180, -3.998795,
-4.000000, -3.998795, -3.995180, -3.989160, -3.980740, -3.969920, -3.956705, -3.941110,
-3.923140, -3.902810, -3.880125, -3.855105, -3.827760, -3.798115, -3.766175, -3.731970,
-3.695520, -3.656840, -3.615955, -3.572895, -3.527685, -3.480350, -3.430915, -3.379415,
-3.325880, -3.270340, -3.212830, -3.153385, -3.092040, -3.028835, -2.963805, -2.896990,
-2.828425, -2.758160, -2.686235, -2.612690, -2.537575, -2.460925, -2.382795, -2.303235,
-2.222280, -2.139990, -2.056410, -1.971595, -1.885585, -1.798445, -1.710220, -1.620965,
-1.530735, -1.439580, -1.347560, -1.254725, -1.161140, -1.066850, -0.971920, -0.876405,
-0.780360, -0.683850, -0.586920, -0.489643, -0.392069, -0.294259, -0.196270, -0.098165,

View File

@ -646,7 +646,9 @@ NOTE: must call Image_GetPaletteXXX before used
qboolean Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
{
int *iout = (int *)out;
byte *fin = (byte *)in;
rgba_t *col;
int i;
if( !image.d_currentpal )
{
@ -659,6 +661,18 @@ qboolean Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
return false;
}
// this is a base image with luma - clear luma pixels
if( image.flags & IMAGE_HAS_LUMA )
{
for( i = 0; i < image.width * image.height; i++ )
{
if( image.flags & IMAGE_HAS_LUMA_Q1 )
fin[i] = fin[i] < 224 ? fin[i] : 0;
else if( image.flags & IMAGE_HAS_LUMA_Q2 )
fin[i] = (fin[i] >= 208 && fin[i] <= 240 ) ? 0 : fin[i];
}
}
while( pixels >= 8 )
{
iout[0] = image.d_currentpal[in[0]];
@ -1270,9 +1284,9 @@ byte *Image_CreateLumaInternal( const byte *fin, int width, int height, int type
for( i = 0; i < width * height; i++ )
{
if( flags & IMAGE_HAS_LUMA_Q1 )
*out++ = fin[i] > 224 ? fin[i] : 0;
*out++ = fin[i] >= 224 ? fin[i] : 0;
else if( flags & IMAGE_HAS_LUMA_Q2 )
*out++ = (fin[i] > 208 && fin[i] < 240) ? fin[i] : 0;
*out++ = (fin[i] >= 208 && fin[i] <= 240) ? fin[i] : 0;
}
break;
default:

View File

@ -23,9 +23,6 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% vid_gl/vid_gl.dsp %CONFIG%"vid_gl - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
if "%BUILD_ERROR%"=="" goto build_ok
echo *********************