*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@963 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-04-18 17:12:18 +00:00
parent adbb8afa29
commit b8eca23cfb
23 changed files with 115 additions and 750 deletions

View file

@ -1,4 +0,0 @@
all:
@-echo "Please use GNU's make utility instead (gmake)."
@-echo "You will also need a working version of gcc installed."

View file

@ -353,12 +353,13 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
if (to->frame != from->frame)
cl.lerpents[to->number].framechange = cl.time; //marked for hl models
#endif
if (to->modelindex != from->modelindex || to->number != from->number || VectorLength(move)>128) //model changed... or entity changed...
if (to->modelindex != from->modelindex || to->number != from->number || VectorLength(move)>500) //model changed... or entity changed...
{
#ifdef HALFLIFEMODELS
cl.lerpents[to->number].framechange = cl.time; //marked for hl models
#endif
cl.lerpents[to->number].lerptime = -10;
cl.lerpents[to->number].lerprate = 0;
if (!new)
return;
@ -377,18 +378,20 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
//1: stepping monsters. These have frames and tick at 10fps.
//2: physics. Objects moving acording to gravity.
//3: both. This is really awkward. And I'm really lazy.
//the real solution would be to seperate the two.
cl.lerpents[to->number].lerprate = cl.time-cl.lerpents[to->number].lerptime; //time per update
// Con_Printf("%f=%f-%f\n", cl.lerpents[to->number].lerprate, cl.time, cl.lerpents[to->number].lerptime);
cl.lerpents[to->number].frame = from->frame;
cl.lerpents[to->number].lerptime = cl.time;
if (cl.lerpents[to->number].lerprate>0.5)
cl.lerpents[to->number].lerprate=0.1;
if (cl.lerpents[to->number].lerprate>0.2)
cl.lerpents[to->number].lerprate=0.2;
//store this off for new ents to use.
if (new)
cl.lerpents[to->number].lerptime = newlerprate;
cl.lerpents[to->number].lerprate = newlerprate;
if (to->frame == from->frame && !new) //(h2 runs at 20fps)
newlerprate = cl.time-cl.lerpents[to->number].lerptime;
newlerprate = cl.lerpents[to->number].lerprate;
}
}
@ -1363,20 +1366,23 @@ void CL_LinkPacketEntities (void)
#endif
//figure out the lerp factor
if (!cl.lerpents[s1->number].lerprate)
ent->lerptime = 0;
if (cl.lerpents[s1->number].lerprate<=0)
ent->lerpfrac = 0;
else
ent->lerptime = 1-(cl.time-cl.lerpents[s1->number].lerptime)/cl.lerpents[s1->number].lerprate;
if (ent->lerptime<0)
ent->lerptime=0;
if (ent->lerptime>1)
ent->lerptime=1;
f = ent->lerptime;
ent->lerpfrac = 1-(cl.time-cl.lerpents[s1->number].lerptime)/cl.lerpents[s1->number].lerprate;
if (ent->lerpfrac<0)
ent->lerpfrac=0;
if (ent->lerpfrac>1)
ent->lerpfrac=1;
f = 1-ent->lerpfrac;
// if (cl_nolerp.value)
// f = 1;
// calculate origin
for (i=0 ; i<3 ; i++)
ent->origin[i] = s1->origin[i] +
f * (cl.lerpents[s1->number].origin[i] - s1->origin[i]);
ent->origin[i] = cl.lerpents[s1->number].origin[i] +
f * (s1->origin[i] - cl.lerpents[s1->number].origin[i]);
//bots or powerup glows. Bots always glow, powerups can be disabled
if (s1->modelindex != cl_playerindex && r_powerupglow.value);
@ -2194,12 +2200,14 @@ void CL_LinkPlayers (void)
ent->oldframe = state->oldframe;
if (state->lerpstarttime)
{
ent->lerptime = 1-(realtime - state->lerpstarttime)*10;
if (ent->lerptime < 0)
ent->lerptime = 0;
ent->lerpfrac = 1-(realtime - state->lerpstarttime)*10;
if (ent->lerpfrac < 0)
ent->lerpfrac = 0;
if (ent->lerpfrac > 1)
ent->lerpfrac = 1;
}
else
ent->lerptime = 0;
ent->lerpfrac = 0;
ent->colormap = info->translations;
if (state->modelindex == cl_playerindex)
@ -2362,9 +2370,9 @@ void CL_LinkViewModel(void)
oldframe[r_refdef.currentplayernum] = ent.oldframe = ent.frame;
lerptime[r_refdef.currentplayernum] = realtime;
}
ent.lerptime = 1-(realtime-lerptime[r_refdef.currentplayernum])*10;
if (ent.lerptime<0)ent.lerptime=0;
if (ent.lerptime>1)ent.lerptime=1;
ent.lerpfrac = 1-(realtime-lerptime[r_refdef.currentplayernum])*10;
if (ent.lerpfrac<0)ent.lerpfrac=0;
if (ent.lerpfrac>1)ent.lerpfrac=1;
#define Q2RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
#define Q2RF_WEAPONMODEL 4 // only draw through eyes
#define Q2RF_DEPTHHACK 16 // for view weapon Z crunching

View file

@ -832,7 +832,6 @@ void AddComponant(vec3_t angles, vec3_t dest, float fm, float rm, float um)
VectorMA(dest, um, u, dest);
}
#define bound(n,v,x) v<n?n:(v>x?x:v)
float CL_FilterTime (double time, float wantfps) //now returns the extra time not taken in this slot. Note that negative 1 means uncapped.
{
extern cvar_t rate;

View file

@ -2865,7 +2865,7 @@ void Host_Init (quakeparms_t *parms)
Con_Init ();
M_Init ();
#ifdef __linux__
#ifndef _WIN32
IN_Init ();
CDAudio_Init ();
// VID_Init (host_basepal);

View file

@ -2084,7 +2084,7 @@ void CL_UpdateExplosions (void)
ent->model = ex->model;
ent->frame = (int)f+firstframe;
ent->oldframe = of+firstframe;
ent->lerptime = 1-(f - (int)f);
ent->lerpfrac = 1-(f - (int)f);
ent->alpha = 1.0 - f/(numframes);
ent->flags = ex->flags;
}

View file

@ -341,7 +341,7 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
ent.angles[1] = (atan2(q3->axis[0][1], q3->axis[0][0]) * 180 / M_PI);
ent.angles[2] = 0;//(atan2(q3->axis[2][1], q3->axis[2][0]) * 180 / M_PI);;
memcpy(ent.axis, q3->axis, sizeof(q3->axis));
ent.lerpfrac = ent.lerptime = q3->backlerp;
ent.lerpfrac = q3->backlerp;
ent.alpha = 1;
ent.scale = 1;
#ifdef Q3SHADERS

View file

@ -1400,7 +1400,6 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
// pmm
//======
ent.oldframe = cent->prev.frame;
ent.lerptime = 1.0 - cl.lerpfrac;
ent.lerpfrac = cl.lerpfrac;
if (renderfx & (Q2RF_FRAMELERP|Q2RF_BEAM))
@ -1915,7 +1914,7 @@ void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
}
gun.flags = Q2RF_MINLIGHT | Q2RF_DEPTHHACK | Q2RF_WEAPONMODEL;
gun.lerptime = 1.0 - cl.lerpfrac;
gun.lerpfrac = cl.lerpfrac;
VectorCopy (gun.origin, gun.oldorigin); // don't lerp at all
V_AddEntity (&gun);
#endif

View file

@ -150,7 +150,9 @@ void M_Menu_Load_f (void)
void M_Menu_SinglePlayer_f (void)
{
int mgt;
#ifndef CLIENTONLY
menubutton_t *b;
#endif
menu_t *menu;
mpic_t *p;

View file

@ -94,7 +94,6 @@ typedef struct entity_s
int abslight;
#endif
float lerpfrac;
float lerptime;
int oldframe;
} entity_t;

View file

@ -215,10 +215,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ENGINEWEBSITE "http://fte.quakesrc.org/"
#ifdef _WIN32
#if defined(_WIN32)
#define PLATFORM "Win32"
#else
#elif defined(__linux__)
#define PLATFORM "Linux"
#elif defined(__FreeBSD__)
#define PLATFORM "FreeBSD"
#elif defined(__OpenBSD__)
#define PLATFORM "OpenBSD"
#elif defined(__NetBSD__)
#define PLATFORM "NetBSD"
#else
#define PLATFORM "Unknown"
#endif

View file

@ -3503,7 +3503,7 @@ int COM_EnumeratePackFiles (pack_t *zip, char *match, int (*func)(char *, int, v
for (num = 0; num<(int)zip->numfiles; num++)
{
if (wildcmp(zip->files[num].name, match))
if (wildcmp(match, zip->files[num].name))
{
if (!func(zip->files[num].name, zip->files[num].filelen, parm))
return false;
@ -4064,7 +4064,7 @@ int COM_EnumerateZipFiles (zipfile_t *zip, char *match, int (*func)(char *, int,
for (num = 0; num<(int)zip->numfiles; num++)
{
if (wildcmp(zip->files[num].name, match))
if (wildcmp(match, zip->files[num].name))
{
if (!func(zip->files[num].name, zip->files[num].filelen, parm))
return false;

View file

@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// comndef.h -- general definitions
typedef unsigned char qbyte;
#define _DEF_BYTE_
// KJB Undefined true and false defined in SciTech's DEBUG.H header
#undef true

View file

@ -1315,6 +1315,37 @@ SOURCE=..\client\keys.c
# Begin Source File
SOURCE=..\client\m_download.c
!IF "$(CFG)" == "ftequake - Win32 Release"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
!ENDIF
# End Source File
# Begin Source File

View file

@ -1150,9 +1150,12 @@ void R_DrawGAliasModel (entity_t *e)
if (R_CullBox (mins, maxs))
return;
if (!(r_refdef.flags & 1)) //RDF_NOWORLDMODEL
if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
{
cl.worldmodel->funcs.LightPointValues(e->origin, shadelight, ambientlight, lightdir);
if (e->flags & Q2RF_WEAPONMODEL)
cl.worldmodel->funcs.LightPointValues(r_refdef.vieworg, shadelight, ambientlight, lightdir);
else
cl.worldmodel->funcs.LightPointValues(e->origin, shadelight, ambientlight, lightdir);
}
else
{
@ -1423,7 +1426,7 @@ void R_DrawGAliasModel (entity_t *e)
memset(&mesh, 0, sizeof(mesh));
for(; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)))
{
if (R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerptime, e->alpha) && r_vertexdlights.value)
if (R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha) && r_vertexdlights.value)
R_GAliasAddDlights(&mesh, e->origin, e->angles);
c_alias_polys += mesh.numindexes/3;
@ -1676,11 +1679,7 @@ void R_DrawGAliasModelLighting (entity_t *e, vec3_t lightpos, vec3_t colours, fl
GL_LightMesh(&mesh, lightdir, colours, radius);
#ifdef Q3SHADERS
GL_DrawAliasMesh(&mesh, 0);
#else
GL_DrawMesh(&mesh, NULL, 0, 0);
#endif
if (inf->nextsurf)
inf = (galiasinfo_t*)((char *)inf + inf->nextsurf);
@ -1732,7 +1731,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
{
if (inf->ofs_trineighbours)
{
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerptime, e->alpha);
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha);
R_CalcFacing(&mesh, lightorg);
R_ProjectShadowVolume(&mesh, lightorg);
R_DrawShadowVolume(&mesh);

View file

@ -101,647 +101,9 @@ void R_IBrokeTheArrays(void)
{
}
#define MAX_MESH_VERTS 8192
//we don't support multitexturing yet.
static float tempstarray[MAX_MESH_VERTS*3];
static vec4_t tempxyzarray[MAX_MESH_VERTS];
shader_t nullshader, wallbumpshader, modelbumpshader;
#define frand() (rand()&32767)* (1.0/32767)
#define FTABLE_SIZE 1024
#define FTABLE_CLAMP(x) (((int)((x)*FTABLE_SIZE) & (FTABLE_SIZE-1)))
#define FTABLE_EVALUATE(table,x) (table ? table[FTABLE_CLAMP(x)] : frand())//*((x)-floor(x)))
static float r_sintable[FTABLE_SIZE];
static float r_triangletable[FTABLE_SIZE];
static float r_squaretable[FTABLE_SIZE];
static float r_sawtoothtable[FTABLE_SIZE];
static float r_inversesawtoothtable[FTABLE_SIZE];
void R_BackendInit(void)
{
int i;
double t;
for ( i = 0; i < FTABLE_SIZE; i++ )
{
t = (double)i / (double)FTABLE_SIZE;
r_sintable[i] = sin ( t * M_PI*2 );
if (t < 0.25)
r_triangletable[i] = t * 4.0;
else if (t < 0.75)
r_triangletable[i] = 2 - 4.0 * t;
else
r_triangletable[i] = (t - 0.75) * 4.0 - 1.0;
if (t < 0.5)
r_squaretable[i] = 1.0f;
else
r_squaretable[i] = -1.0f;
r_sawtoothtable[i] = t;
r_inversesawtoothtable[i] = 1.0 - t;
}
{
nullshader.numdeforms = 0;//1;
nullshader.deforms[0].type = DEFORMV_WAVE;
nullshader.deforms[0].args[0] = 10;
nullshader.deforms[0].func.type = SHADER_FUNC_SIN;
nullshader.deforms[0].func.args[1] = 1;
nullshader.deforms[0].func.args[3] = 10;
nullshader.passes[0].texturetype = GL_TEXTURE_2D;
nullshader.passes[0].envmode = GL_MODULATE;
nullshader.passes[0].blendsrc = GL_SRC_ALPHA;
nullshader.passes[0].blenddst = GL_ONE_MINUS_SRC_ALPHA;
nullshader.passes[1].flags |= SHADER_PASS_BLEND;
nullshader.passes[1].tcgen = TC_GEN_LIGHTMAP;
nullshader.passes[1].blendsrc = GL_SRC_ALPHA;
nullshader.passes[1].blenddst = GL_ONE_MINUS_SRC_ALPHA;
nullshader.passes[1].texturetype = GL_TEXTURE_2D;
}
{
modelbumpshader.numpasses = 3;
if (1)
modelbumpshader.passes[0].numMergedPasses = 4;
else
modelbumpshader.passes[0].numMergedPasses = 2;
modelbumpshader.passes[2].numMergedPasses = 1;
modelbumpshader.passes[0].tcgen = TC_GEN_BASE;
modelbumpshader.passes[0].envmode = GL_COMBINE_ARB;
modelbumpshader.passes[0].combinesrc0 = GL_TEXTURE;
modelbumpshader.passes[0].combinemode = GL_REPLACE;
modelbumpshader.passes[0].blendsrc = GL_SRC_ALPHA;
modelbumpshader.passes[0].blenddst = GL_ONE_MINUS_SRC_ALPHA;
modelbumpshader.passes[0].anim_frames[0] = 0;//bumpmap
modelbumpshader.passes[0].texturetype = GL_TEXTURE_2D;
modelbumpshader.passes[1].tcgen = TC_GEN_DOTPRODUCT;
modelbumpshader.passes[1].envmode = GL_COMBINE_ARB;
modelbumpshader.passes[1].combinesrc0 = GL_TEXTURE;
modelbumpshader.passes[1].combinesrc1 = GL_PREVIOUS_ARB;
modelbumpshader.passes[1].combinemode = GL_DOT3_RGB_ARB;
modelbumpshader.passes[1].anim_frames[0] = 0;//delux
modelbumpshader.passes[1].texturetype = GL_TEXTURE_2D;
modelbumpshader.passes[2].flags |= SHADER_PASS_BLEND;
modelbumpshader.passes[2].tcgen = TC_GEN_BASE;
modelbumpshader.passes[2].envmode = GL_MODULATE;
modelbumpshader.passes[2].blendsrc = GL_DST_COLOR;
modelbumpshader.passes[2].blenddst = GL_ZERO;
modelbumpshader.passes[2].anim_frames[0] = 0;//texture
modelbumpshader.passes[2].texturetype = GL_TEXTURE_2D;
//gl_combine states that we need to use a textures.
modelbumpshader.passes[3].tcgen = TC_GEN_BASE; //multiply by colors
modelbumpshader.passes[3].envmode = GL_COMBINE_ARB;
modelbumpshader.passes[3].combinesrc0 = GL_PREVIOUS_ARB;
modelbumpshader.passes[3].combinesrc1 = GL_PRIMARY_COLOR_ARB;
modelbumpshader.passes[3].combinemode = GL_MODULATE;
modelbumpshader.passes[3].anim_frames[0] = 1; //any, has to be present
modelbumpshader.passes[3].texturetype = GL_TEXTURE_2D;
}
{
wallbumpshader.numpasses = 4;
if (1)
wallbumpshader.passes[0].numMergedPasses = 4;
else
wallbumpshader.passes[0].numMergedPasses = 2;
wallbumpshader.passes[2].numMergedPasses = 2;
wallbumpshader.passes[0].tcgen = TC_GEN_BASE;
wallbumpshader.passes[0].envmode = GL_COMBINE_ARB;
wallbumpshader.passes[0].combinesrc0 = GL_TEXTURE;
wallbumpshader.passes[0].combinemode = GL_REPLACE;
wallbumpshader.passes[0].anim_frames[0] = 0;//bumpmap
wallbumpshader.passes[0].blendsrc = GL_SRC_ALPHA;
wallbumpshader.passes[0].blenddst = GL_ONE_MINUS_SRC_ALPHA;
wallbumpshader.passes[0].texturetype = GL_TEXTURE_2D;
wallbumpshader.passes[1].tcgen = TC_GEN_LIGHTMAP;
wallbumpshader.passes[1].envmode = GL_COMBINE_ARB;
wallbumpshader.passes[1].combinesrc0 = GL_TEXTURE;
wallbumpshader.passes[1].combinesrc1 = GL_PREVIOUS_ARB;
wallbumpshader.passes[1].combinemode = GL_DOT3_RGB_ARB;
wallbumpshader.passes[1].anim_frames[0] = 0;//delux
wallbumpshader.passes[1].texturetype = GL_TEXTURE_2D;
wallbumpshader.passes[2].flags |= SHADER_PASS_BLEND;
wallbumpshader.passes[2].tcgen = TC_GEN_BASE;
wallbumpshader.passes[2].envmode = GL_MODULATE;
wallbumpshader.passes[2].blendsrc = GL_DST_COLOR;
wallbumpshader.passes[2].blenddst = GL_ZERO;
wallbumpshader.passes[2].anim_frames[0] = 0;//texture
wallbumpshader.passes[2].texturetype = GL_TEXTURE_2D;
wallbumpshader.passes[3].tcgen = TC_GEN_LIGHTMAP;
wallbumpshader.passes[3].envmode = GL_BLEND;
wallbumpshader.passes[3].anim_frames[0] = 0;//lightmap
wallbumpshader.passes[3].texturetype = GL_TEXTURE_2D;
}
}
static float *R_TableForFunc ( unsigned int func )
{
switch (func)
{
case SHADER_FUNC_SIN:
return r_sintable;
case SHADER_FUNC_TRIANGLE:
return r_triangletable;
case SHADER_FUNC_SQUARE:
return r_squaretable;
case SHADER_FUNC_SAWTOOTH:
return r_sawtoothtable;
case SHADER_FUNC_INVERSESAWTOOTH:
return r_inversesawtoothtable;
}
// assume noise
return NULL;
}
static void MakeDeforms(shader_t *shader, vec4_t *out, vec4_t *in, int number)
{
float *table;
int d, j;
float args[4], deflect;
deformv_t *dfrm = shader->deforms;
for (d = 0; d < shader->numdeforms; d++, dfrm++)
{
switch(dfrm->type)
{
case DEFORMV_WAVE:
args[0] = dfrm->func.args[0];
args[1] = dfrm->func.args[1];
args[3] = dfrm->func.args[2] + dfrm->func.args[3] * realtime;
table = R_TableForFunc ( dfrm->func.type );
for ( j = 0; j < number; j++ ) {
deflect = dfrm->args[0] * (in[j][0]+in[j][1]+in[j][2]) + args[3];
deflect = sin(deflect)/*FTABLE_EVALUATE ( table, deflect )*/ * args[1] + args[0];
out[j][0] = in[j][0]+deflect;
out[j][1] = in[j][1]+deflect;
out[j][2] = in[j][2]+deflect;
// Deflect vertex along its normal by wave amount
// VectorMA ( out[j], deflect, normalsArray[j], in[j] );
}
break;
case DEFORMV_MOVE:
table = R_TableForFunc ( dfrm->func.type );
deflect = dfrm->func.args[2] + realtime * dfrm->func.args[3];
deflect = FTABLE_EVALUATE (table, deflect) * dfrm->func.args[1] + dfrm->func.args[0];
for ( j = 0; j < number; j++ )
VectorMA ( out[j], deflect, dfrm->args, in[j] );
break;
default:
Sys_Error("Bad deform type %i\n", dfrm->type);
}
in = out;
}
}
static void Mesh_DeformTextureCoords(mesh_t *mesh, shaderpass_t *pass)
{
int d;
// tcmod_t *tcmod = pass->tcmod;
float *in, *out;
switch(pass->tcgen)
{
case TC_GEN_DOTPRODUCT: //take normals, use the dotproduct and produce texture coords for bumpmapping
{
out = tempstarray;
in = (float*)mesh->normals_array;
for (d = 0; d < mesh->numvertexes; d++)
{
out[d*3+0] = DotProduct((in+d*3), mesh->lightaxis[0]);
out[d*3+1] = DotProduct((in+d*3), mesh->lightaxis[1]);
out[d*3+2] = DotProduct((in+d*3), mesh->lightaxis[2]);
}
qglTexCoordPointer(3, GL_FLOAT, 0, out);
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
}
return;
case TC_GEN_LIGHTMAP:
in = (float*)mesh->lmst_array;
if (in)
break; //fallthrought
case TC_GEN_BASE:
in = (float*)mesh->st_array;
break;
default:
Sys_Error("Mesh_DeformTextureCoords: Bad TC_GEN type\n");
return;
}
/*
for (d = 0; d < pass->numtcmods; d++, dfrm++)
{
}
*/
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglTexCoordPointer(2, GL_FLOAT, 0, in);
}
static void Mesh_SetShaderpassState ( shaderpass_t *pass, qboolean mtex )
{
if ( (mtex && (pass->blendmode != GL_REPLACE)) || (pass->flags & SHADER_PASS_BLEND) )
{
qglEnable (GL_BLEND);
qglBlendFunc (pass->blendsrc, pass->blenddst);
}
else
{
qglDisable (GL_BLEND);
}
if (pass->flags & SHADER_PASS_ALPHAFUNC)
{
qglEnable (GL_ALPHA_TEST);
if (pass->alphafunc == SHADER_ALPHA_GT0)
{
qglAlphaFunc (GL_GREATER, 0);
}
else if (pass->alphafunc == SHADER_ALPHA_LT128)
{
qglAlphaFunc (GL_LESS, 0.5f);
}
else if (pass->alphafunc == SHADER_ALPHA_GE128)
{
qglAlphaFunc (GL_GEQUAL, 0.5f);
}
}
else
{
qglDisable (GL_ALPHA_TEST);
}
qglDepthFunc (pass->depthfunc);
if (pass->flags & SHADER_PASS_DEPTHWRITE)
{
qglDepthMask (GL_TRUE);
}
else
{
qglDepthMask (GL_FALSE);
}
}
static void Mesh_DrawPass(shaderpass_t *pass, mesh_t *mesh)
{
Mesh_SetShaderpassState(pass, false);
if (pass->numMergedPasses>1 && gl_mtexarbable)
{
int p;
// Mesh_DrawPass(pass+2,mesh);
// return;
for (p = 0; p < pass->numMergedPasses; p++)
{
qglActiveTextureARB(GL_TEXTURE0_ARB+p);
qglClientActiveTextureARB(GL_TEXTURE0_ARB+p);
GL_BindType(pass[p].texturetype, pass[p].anim_frames[0]);
qglEnable(pass[p].texturetype);
GL_TexEnv(pass[p].envmode);
if (pass[p].envmode == GL_COMBINE_ARB)
{
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, pass[p].combinesrc0);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, pass[p].combinesrc1);
qglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, pass[p].combinemode);
}
Mesh_DeformTextureCoords(mesh, pass+p);
}
qglDrawElements(GL_TRIANGLES, mesh->numindexes, GL_UNSIGNED_INT, mesh->indexes);
for (p = pass->numMergedPasses-1; p >= 0; p--)
{
qglActiveTextureARB(GL_TEXTURE0_ARB+p);
qglClientActiveTextureARB(GL_TEXTURE0_ARB+p);
qglDisable(pass[p].texturetype);
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
}
}
else
{
Mesh_DeformTextureCoords(mesh, pass);
GL_TexEnv(pass->envmode);
GL_Bind(pass->anim_frames[0]);
if (pass->texturetype != GL_TEXTURE_2D)
{
qglDisable(pass->texturetype);
qglEnable(pass->texturetype);
}
qglDrawElements(GL_TRIANGLES, mesh->numindexes, GL_UNSIGNED_INT, mesh->indexes);
if (pass->texturetype != GL_TEXTURE_2D)
{
qglDisable(pass->texturetype);
qglEnable(GL_TEXTURE_2D);
}
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
}
}
shader_t *currentshader;
void GL_PushShader(shader_t *shader)
{
if (!shader)
{
qglDisableClientState( GL_VERTEX_ARRAY );
return;
}
qglEnableClientState( GL_VERTEX_ARRAY );
}
void GL_PushMesh(mesh_t *mesh, int deluxnum, int lmnum)
{
}
void GL_DrawMesh(mesh_t *mesh, shader_t *shader, int texturenum, int lmtexturenum)
{
int i;
if (!shader)
{
shader = &nullshader;
shader->passes[0].anim_frames[0] = texturenum;
shader->passes[0].numMergedPasses=1;
if (lmtexturenum && !texturenum)
{
shader->passes[0].anim_frames[0] = lmtexturenum;
shader->numpasses = 1;
shader->passes[0].flags |= SHADER_PASS_BLEND;
}
else if (lmtexturenum)
{
shader->numpasses = 2;
shader->passes[1].anim_frames[0] = lmtexturenum;//lmtexture;
shader->passes[0].flags &= ~SHADER_PASS_BLEND;
}
else
{
shader->passes[0].flags &= ~SHADER_PASS_BLEND;
shader->numpasses = 1;
}
shader->passes[0].texturetype = GL_TEXTURE_2D;
}
if (!shader->numdeforms)
qglVertexPointer(3, GL_FLOAT, 16, mesh->xyz_array);
else
{
MakeDeforms(shader, tempxyzarray, mesh->xyz_array, mesh->numvertexes);
qglVertexPointer(3, GL_FLOAT, 16, tempxyzarray);
}
if (mesh->normals_array && qglNormalPointer)
{
qglNormalPointer(GL_FLOAT, 0, mesh->normals_array);
qglEnableClientState( GL_NORMAL_ARRAY );
}
qglEnableClientState( GL_VERTEX_ARRAY );
if (mesh->colors_array && qglColorPointer)
{
qglColorPointer(4, GL_UNSIGNED_BYTE, 0, mesh->colors_array);
qglEnableClientState( GL_COLOR_ARRAY );
}
for (i =0 ; i < shader->numpasses; i+=shader->passes[i].numMergedPasses)
Mesh_DrawPass(shader->passes+i, mesh);
qglDisableClientState( GL_VERTEX_ARRAY );
qglDisableClientState( GL_COLOR_ARRAY );
qglDisableClientState( GL_NORMAL_ARRAY );
/* //show normals
if (mesh->normals_array)
{
qglColor3f(1,1,1);
qglDisable(GL_TEXTURE_2D);
qglBegin(GL_LINES);
for (i = 0; i < mesh->numvertexes; i++)
{
qglVertex3f( mesh->xyz_array[i][0],
mesh->xyz_array[i][1],
mesh->xyz_array[i][2]);
qglVertex3f( mesh->xyz_array[i][0] + mesh->normals_array[i][0],
mesh->xyz_array[i][1] + mesh->normals_array[i][1],
mesh->xyz_array[i][2] + mesh->normals_array[i][2]);
}
qglEnd();
qglEnable(GL_TEXTURE_2D);
}
*/
}
void GL_DrawMeshBump(mesh_t *mesh, int texturenum, int lmtexturenum, int bumpnum, int deluxnum)
{
shader_t *shader;
extern int normalisationCubeMap;
if (lmtexturenum)
{
shader = &wallbumpshader;
shader->passes[3].anim_frames[0] = lmtexturenum;
}
else
shader = &modelbumpshader;
shader->passes[0].anim_frames[0] = bumpnum;
if (deluxnum)
{
shader->passes[1].anim_frames[0] = deluxnum;
shader->passes[1].tcgen = TC_GEN_LIGHTMAP;
shader->passes[1].texturetype = GL_TEXTURE_2D;
}
else
{
shader->passes[1].anim_frames[0] = normalisationCubeMap;
shader->passes[1].tcgen = TC_GEN_DOTPRODUCT;
shader->passes[1].texturetype = GL_TEXTURE_CUBE_MAP_ARB;
}
shader->passes[2].anim_frames[0] = texturenum;
// mesh->colors_array=NULL; //don't bother coloring it.
GL_DrawMesh(mesh, shader, 0, 0);
}

View file

@ -1111,6 +1111,12 @@ void GLDraw_DeInit (void)
#endif
}
void GL_DrawAliasMesh (mesh_t *mesh, int texnum);
void GL_DrawMesh(mesh_t *msh, int texturenum)
{
GL_DrawAliasMesh(msh, texturenum);
}
/*
@ -1135,7 +1141,6 @@ void GLDraw_Character (int x, int y, unsigned int num)
if (num == 32)
return; // space
#ifndef Q3SHADERS
num &= 255;
row = num>>4;
@ -1165,10 +1170,11 @@ void GLDraw_Character (int x, int y, unsigned int num)
draw_mesh_st[3][1] = frow+size;
if (num&CON_2NDCHARSETTEXT)
GL_DrawMesh(&draw_mesh, NULL, char_tex2, 0);
GL_DrawMesh(&draw_mesh, char_tex2);
else
GL_DrawMesh(&draw_mesh, NULL, char_texture, 0);
#else
GL_DrawMesh(&draw_mesh, char_texture);
/*#else
if (num&CON_2NDCHARSETTEXT)
GL_Bind (char_tex2);
@ -1197,7 +1203,7 @@ void GLDraw_Character (int x, int y, unsigned int num)
qglVertex2f (x, y+8);
qglEnd ();
#endif
#endif*/
}
void GLDraw_ColouredCharacter (int x, int y, unsigned int num)
@ -1404,7 +1410,6 @@ void GLDraw_Pic (int x, int y, mpic_t *pic)
Scrap_Upload ();
gl = (glpic_t *)pic->data;
#ifndef Q3SHADERS
draw_mesh_xyz[0][0] = x;
draw_mesh_xyz[0][1] = y;
draw_mesh_st[0][0] = gl->sl;
@ -1425,22 +1430,7 @@ void GLDraw_Pic (int x, int y, mpic_t *pic)
draw_mesh_st[3][0] = gl->sl;
draw_mesh_st[3][1] = gl->th;
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
#else
qglColor4f (1,1,1,1);
GL_Bind (gl->texnum);
qglBegin (GL_QUADS);
qglTexCoord2f (gl->sl, gl->tl);
qglVertex2f (x, y);
qglTexCoord2f (gl->sh, gl->tl);
qglVertex2f (x+pic->width, y);
qglTexCoord2f (gl->sh, gl->th);
qglVertex2f (x+pic->width, y+pic->height);
qglTexCoord2f (gl->sl, gl->th);
qglVertex2f (x, y+pic->height);
qglEnd ();
#endif
GL_DrawMesh(&draw_mesh, gl->texnum);
}
void GLDraw_ScalePic (int x, int y, int width, int height, mpic_t *pic)
@ -1519,19 +1509,6 @@ void GLDraw_SubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int
newtl = gl->tl + (srcy*oldglheight)/pic->height;
newth = newtl + (height*oldglheight)/pic->height;
#ifdef Q3SHADERS
GL_Bind (gl->texnum);
qglBegin (GL_QUADS);
qglTexCoord2f (newsl, newtl);
qglVertex2f (x, y);
qglTexCoord2f (newsh, newtl);
qglVertex2f (x+width, y);
qglTexCoord2f (newsh, newth);
qglVertex2f (x+width, y+height);
qglTexCoord2f (newsl, newth);
qglVertex2f (x, y+height);
qglEnd ();
#else
draw_mesh_xyz[0][0] = x;
draw_mesh_xyz[0][1] = y;
draw_mesh_st[0][0] = newsl;
@ -1552,8 +1529,7 @@ void GLDraw_SubPic(int x, int y, mpic_t *pic, int srcx, int srcy, int width, int
draw_mesh_st[3][0] = newsl;
draw_mesh_st[3][1] = newth;
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
#endif
GL_DrawMesh(&draw_mesh, gl->texnum);
}
/*
@ -1814,19 +1790,6 @@ void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float
t2 = t1 + (t2-t1)*gl->th;
t1 += gl->tl;
#ifdef Q3SHADERS
GL_Bind (gl->texnum);
qglBegin (GL_QUADS);
qglTexCoord2f (s1, t1);
qglVertex2f (x, y);
qglTexCoord2f (s2, t1);
qglVertex2f (x+w, y);
qglTexCoord2f (s2, t2);
qglVertex2f (x+w, y+h);
qglTexCoord2f (s1, t2);
qglVertex2f (x, y+h);
qglEnd ();
#else
draw_mesh_xyz[0][0] = x;
draw_mesh_xyz[0][1] = y;
draw_mesh_st[0][0] = s1;
@ -1847,8 +1810,7 @@ void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float
draw_mesh_st[3][0] = s1;
draw_mesh_st[3][1] = t2;
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
#endif
GL_DrawMesh(&draw_mesh, gl->texnum);
}
//=============================================================================

View file

@ -4167,6 +4167,8 @@ void PPL_DrawWorld (void)
void PPL_CreateShaderObjects(void)
{
#ifdef PPL
PPL_CreateLightTexturesProgram();
#endif
PPL_LoadSpecularFragmentProgram();
}

View file

@ -1578,7 +1578,7 @@ void R_Clear (void)
qglClear (GL_DEPTH_BUFFER_BIT);
gldepthmin = 0;
gldepthmax = 1;
qglDepthFunc (gldepthfunc=GL_LEQUAL);
qglDepthFunc (gldepthfunc=GL_GEQUAL);
}
qglDepthRange (gldepthmin, gldepthmax);
@ -1590,7 +1590,7 @@ void R_Clear (void)
R_Mirror
=============
*/
/*
void CL_AddFlagModels (entity_t *ent, int team);
void R_MirrorAddPlayerModels (void)
{
@ -1695,7 +1695,7 @@ void R_MirrorAddPlayerModels (void)
CL_AddVWeapModel(ent, info->vweapindex);
}
*/
void R_Mirror (void)
{

View file

@ -908,7 +908,7 @@ qboolean Shader_Init (void)
{
shaderbuflen = 0;
Con_Printf ( "Initializing Shaders:\n" );
Con_Printf ( "Initializing Shaders.\n" );
COM_EnumerateFiles("scripts/*.shader", Shader_InitCallback, NULL);

View file

@ -543,6 +543,9 @@ void GL_Init(void *(*getglfunction) (char *name))
gl_extensions = qglGetString (GL_EXTENSIONS);
Con_DPrintf ("GL_EXTENSIONS: %s\n", gl_extensions);
if (!gl_extensions)
Sys_Error("no extensions\n");
GL_CheckExtensions (getglfunction);
qglClearColor (0,0,0,0); //clear to black so that it looks a little nicer on start.

View file

@ -384,9 +384,11 @@ void Q_SetProgsParms(qboolean forcompiler)
void PR_Deinit(void)
{
PR_ClearThreads();
PR_fclose_progs(svprogfuncs);
if (svprogfuncs)
{
PR_fclose_progs(svprogfuncs);
CloseProgs(svprogfuncs);
}
svprogfuncs=NULL;
}

View file

@ -1940,13 +1940,7 @@ int MVD_StreamStartListening(int port)
unsigned int nonblocking = true;
address.sin_family = AF_INET;
if (gethostname(name, sizeof(name)) == -1)
return INVALID_SOCKET;
hent = gethostbyname(name);
if (!hent)
return INVALID_SOCKET;
address.sin_addr.s_addr = *(int *)(hent->h_addr_list[0]);
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons((u_short)port);
@ -1981,7 +1975,7 @@ void SV_MVDStream_Poll(void)
struct sockaddr_qstorage addr;
int addrlen;
qboolean wanted;
if (!sv.state)
if (!sv.state || !mvd_streamport.value)
wanted = false;
else if (listenport && (int)mvd_streamport.value != listenport) //easy way to switch... disable for a frame. :)
{

View file

@ -786,7 +786,7 @@ void R_AliasSetupFrame (void)
oframe = 0;
}
bl = currententity->lerptime;
bl = currententity->lerpfrac;
fl = 1.0 - bl;
for (i = 0; i < 3; i++)