mirror of
https://github.com/nzp-team/quakespasm.git
synced 2024-11-10 06:32:03 +00:00
Merge pull request #8 from ScatterBox/main
This commit is contained in:
commit
005a8a92aa
11 changed files with 302 additions and 172 deletions
|
@ -76,7 +76,7 @@ const char *svc_strings[] =
|
||||||
"svc_useprint", // 38
|
"svc_useprint", // 38
|
||||||
"", // 39
|
"", // 39
|
||||||
"svc_bf", // 40 // no data
|
"svc_bf", // 40 // no data
|
||||||
"svc_fog", // 41 // [byte] density [byte] red [byte] green [byte] blue [float] time
|
"svc_fog", // 41 // [byte] start [byte] end [byte] red [byte] green [byte] blue [float] time
|
||||||
"svc_spawnbaseline2", //42 // support for large modelindex, large framenum, alpha, using flags
|
"svc_spawnbaseline2", //42 // support for large modelindex, large framenum, alpha, using flags
|
||||||
"svc_spawnstatic2", // 43 // support for large modelindex, large framenum, alpha, using flags
|
"svc_spawnstatic2", // 43 // support for large modelindex, large framenum, alpha, using flags
|
||||||
"svc_spawnstaticsound2", // 44 // [coord3] [short] samp [byte] vol [byte] aten
|
"svc_spawnstaticsound2", // 44 // [coord3] [short] samp [byte] vol [byte] aten
|
||||||
|
|
|
@ -1203,9 +1203,11 @@ void Con_DrawConsole (int lines, qboolean drawinput)
|
||||||
GL_SetCanvas (CANVAS_CONSOLE);
|
GL_SetCanvas (CANVAS_CONSOLE);
|
||||||
|
|
||||||
// draw the background
|
// draw the background
|
||||||
Draw_ConsoleBackground ();
|
|
||||||
if (!console_enabled && !developer.value)
|
if (!console_enabled && !developer.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Draw_ConsoleBackground ();
|
||||||
|
|
||||||
// draw the buffer text
|
// draw the buffer text
|
||||||
rows = (con_vislines +7)/8;
|
rows = (con_vislines +7)/8;
|
||||||
|
|
|
@ -862,37 +862,10 @@ Draw_ConsoleBackground -- johnfitz -- rewritten
|
||||||
*/
|
*/
|
||||||
void Draw_ConsoleBackground (void)
|
void Draw_ConsoleBackground (void)
|
||||||
{
|
{
|
||||||
float alpha;
|
|
||||||
|
|
||||||
//pic = Draw_CachePic ("gfx/conback.lmp");
|
//GL_SetCanvas (CANVAS_CONSOLE); //in case this is called from weird places
|
||||||
//pic->width = vid.conwidth;
|
|
||||||
//pic->height = vid.conheight;
|
|
||||||
|
|
||||||
alpha = (con_forcedup) ? 1.0 : scr_conalpha.value;
|
Draw_FillByColor (0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 1);
|
||||||
|
|
||||||
GL_SetCanvas (CANVAS_CONSOLE); //in case this is called from weird places
|
|
||||||
|
|
||||||
if (alpha > 0.0)
|
|
||||||
{
|
|
||||||
if (alpha < 1.0)
|
|
||||||
{
|
|
||||||
glEnable (GL_BLEND);
|
|
||||||
glColor4f (1,1,1,alpha);
|
|
||||||
glDisable (GL_ALPHA_TEST);
|
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Draw_FillByColor (0, 0, vid.conwidth, vid.conheight, 0, 0, 0, alpha);
|
|
||||||
|
|
||||||
|
|
||||||
if (alpha < 1.0)
|
|
||||||
{
|
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
|
||||||
glDisable (GL_BLEND);
|
|
||||||
glColor4f (1,1,1,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1232,6 +1205,11 @@ gltexture_t *loadtextureimage (char* filename)
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
data = Image_LoadImage (filename, &w, &h);
|
data = Image_LoadImage (filename, &w, &h);
|
||||||
|
if(data == NULL)
|
||||||
|
{
|
||||||
|
Sys_Error("loadtextureimage: Cannot load the image %s\n", filename);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
gl.gltexture = TexMgr_LoadImage (NULL, filename, w, h, SRC_RGBA, data, filename, sizeof(int)*2, TEXPREF_ALPHA | TEXPREF_NEAREST | TEXPREF_NOPICMIP);
|
gl.gltexture = TexMgr_LoadImage (NULL, filename, w, h, SRC_RGBA, data, filename, sizeof(int)*2, TEXPREF_ALPHA | TEXPREF_NEAREST | TEXPREF_NOPICMIP);
|
||||||
|
|
||||||
|
|
239
source/gl_fog.c
239
source/gl_fog.c
|
@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
//gl_fog.c -- global and volumetric fog
|
//gl_fog.c -- global and volumetric fog
|
||||||
|
|
||||||
|
//sB EDITED THIS AND GOT RID OF VOLUMETRIC FOG IN ORDER TO ADD CONSISTENCY TO NZP BUILDS. SWITCHED TO A START/END VALUE.
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
@ -29,17 +31,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
//
|
//
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#define DEFAULT_DENSITY 0.0
|
#define DEFAULT_DENSITY 1.0
|
||||||
#define DEFAULT_GRAY 0.3
|
#define DEFAULT_GRAY 0.3
|
||||||
|
|
||||||
float fog_start;
|
//extern refdef_t r_refdef;
|
||||||
float fog_end;
|
|
||||||
|
float density = 1.0;
|
||||||
float fog_density_gl;
|
float fog_density_gl;
|
||||||
float fog_red;
|
|
||||||
float fog_green;
|
float fog_start;
|
||||||
float fog_blue;
|
float fog_end;
|
||||||
|
float fog_red;
|
||||||
|
float fog_green;
|
||||||
|
float fog_blue;
|
||||||
|
|
||||||
float old_density;
|
float old_density;
|
||||||
|
float old_start;
|
||||||
|
float old_end;
|
||||||
float old_red;
|
float old_red;
|
||||||
float old_green;
|
float old_green;
|
||||||
float old_blue;
|
float old_blue;
|
||||||
|
@ -54,7 +62,7 @@ Fog_Update
|
||||||
update internal variables
|
update internal variables
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void Fog_Update (float density, float red, float green, float blue, float time)
|
void Fog_Update (float start, float end, float red, float green, float blue, float time)
|
||||||
{
|
{
|
||||||
//save previous settings for fade
|
//save previous settings for fade
|
||||||
if (time > 0)
|
if (time > 0)
|
||||||
|
@ -65,26 +73,32 @@ void Fog_Update (float density, float red, float green, float blue, float time)
|
||||||
float f;
|
float f;
|
||||||
|
|
||||||
f = (fade_done - cl.time) / fade_time;
|
f = (fade_done - cl.time) / fade_time;
|
||||||
old_density = f * old_density + (1.0 - f) * fog_density_gl;
|
old_start = f * old_start + (1.0 - f) * fog_start;
|
||||||
|
old_end = f * old_end + (1.0 - f) * fog_end;
|
||||||
old_red = f * old_red + (1.0 - f) * fog_red;
|
old_red = f * old_red + (1.0 - f) * fog_red;
|
||||||
old_green = f * old_green + (1.0 - f) * fog_green;
|
old_green = f * old_green + (1.0 - f) * fog_green;
|
||||||
old_blue = f * old_blue + (1.0 - f) * fog_blue;
|
old_blue = f * old_blue + (1.0 - f) * fog_blue;
|
||||||
|
old_density = f * old_density + (1.0 - f) * fog_density_gl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
old_density = fog_density_gl;
|
old_start = fog_start;
|
||||||
|
old_end = fog_end;
|
||||||
old_red = fog_red;
|
old_red = fog_red;
|
||||||
old_green = fog_green;
|
old_green = fog_green;
|
||||||
old_blue = fog_blue;
|
old_blue = fog_blue;
|
||||||
|
old_density = fog_density_gl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fog_density_gl = density;
|
fog_start = start;
|
||||||
|
fog_end = end;
|
||||||
fog_red = red;
|
fog_red = red;
|
||||||
fog_green = green;
|
fog_green = green;
|
||||||
fog_blue = blue;
|
fog_blue = blue;
|
||||||
fade_time = time;
|
fade_time = time;
|
||||||
fade_done = cl.time + time;
|
fade_done = cl.time + time;
|
||||||
|
fog_density_gl = ((fog_start / fog_end))/3.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -96,15 +110,16 @@ handle an SVC_FOG message from server
|
||||||
*/
|
*/
|
||||||
void Fog_ParseServerMessage (void)
|
void Fog_ParseServerMessage (void)
|
||||||
{
|
{
|
||||||
float density, red, green, blue, time;
|
float start, end, red, green, blue, time;
|
||||||
|
|
||||||
density = MSG_ReadByte() / 255.0;
|
start = MSG_ReadByte() / 255.0;
|
||||||
|
end = MSG_ReadByte() / 255.0;
|
||||||
red = MSG_ReadByte() / 255.0;
|
red = MSG_ReadByte() / 255.0;
|
||||||
green = MSG_ReadByte() / 255.0;
|
green = MSG_ReadByte() / 255.0;
|
||||||
blue = MSG_ReadByte() / 255.0;
|
blue = MSG_ReadByte() / 255.0;
|
||||||
time = q_max(0.0, MSG_ReadShort() / 100.0);
|
time = q_max(0.0, MSG_ReadShort() / 100.0);
|
||||||
|
|
||||||
Fog_Update (density, red, green, blue, time);
|
Fog_Update (start, end, red, green, blue, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -121,49 +136,67 @@ void Fog_FogCommand_f (void)
|
||||||
default:
|
default:
|
||||||
case 1:
|
case 1:
|
||||||
Con_Printf("usage:\n");
|
Con_Printf("usage:\n");
|
||||||
Con_Printf(" fog <density>\n");
|
Con_Printf(" fog <fade>\n");
|
||||||
|
Con_Printf(" fog <start> <end>\n");
|
||||||
Con_Printf(" fog <red> <green> <blue>\n");
|
Con_Printf(" fog <red> <green> <blue>\n");
|
||||||
Con_Printf(" fog <density> <red> <green> <blue>\n");
|
Con_Printf(" fog <fade> <red> <green> <blue>\n");
|
||||||
|
Con_Printf(" fog <start> <end> <red> <green> <blue>\n");
|
||||||
|
Con_Printf(" fog <start> <end> <red> <green> <blue> <fade>\n");
|
||||||
Con_Printf("current values:\n");
|
Con_Printf("current values:\n");
|
||||||
Con_Printf(" \"density\" is \"%f\"\n", fog_density_gl);
|
Con_Printf(" \"start\" is \"%f\"\n", fog_start);
|
||||||
|
Con_Printf(" \"end\" is \"%f\"\n", fog_end);
|
||||||
Con_Printf(" \"red\" is \"%f\"\n", fog_red);
|
Con_Printf(" \"red\" is \"%f\"\n", fog_red);
|
||||||
Con_Printf(" \"green\" is \"%f\"\n", fog_green);
|
Con_Printf(" \"green\" is \"%f\"\n", fog_green);
|
||||||
Con_Printf(" \"blue\" is \"%f\"\n", fog_blue);
|
Con_Printf(" \"blue\" is \"%f\"\n", fog_blue);
|
||||||
|
Con_Printf(" \"fade\" is \"%f\"\n", fade_time);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: //TEST
|
||||||
|
Fog_Update(fog_start,
|
||||||
|
fog_end,
|
||||||
|
fog_red,
|
||||||
|
fog_green,
|
||||||
|
fog_blue,
|
||||||
|
q_max(0.0, atof(Cmd_Argv(1))));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
|
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
|
||||||
|
q_max(0.0, atof(Cmd_Argv(2))),
|
||||||
fog_red,
|
fog_red,
|
||||||
fog_green,
|
fog_green,
|
||||||
fog_blue,
|
fog_blue,
|
||||||
0.0);
|
0.0);
|
||||||
break;
|
break;
|
||||||
case 3: //TEST
|
|
||||||
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
|
|
||||||
fog_red,
|
|
||||||
fog_green,
|
|
||||||
fog_blue,
|
|
||||||
atof(Cmd_Argv(2)));
|
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
Fog_Update(fog_density_gl,
|
Fog_Update(fog_start,
|
||||||
CLAMP(0.0, atof(Cmd_Argv(1)), 1.0),
|
fog_end,
|
||||||
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
|
CLAMP(0.0, atof(Cmd_Argv(1)), 255.0),
|
||||||
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
|
CLAMP(0.0, atof(Cmd_Argv(2)), 255.0),
|
||||||
|
CLAMP(0.0, atof(Cmd_Argv(3)), 255.0),
|
||||||
0.0);
|
0.0);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5: //TEST
|
||||||
|
Fog_Update(fog_start,
|
||||||
|
fog_end,
|
||||||
|
CLAMP(0.0, atof(Cmd_Argv(1)), 255.0),
|
||||||
|
CLAMP(0.0, atof(Cmd_Argv(2)), 255.0),
|
||||||
|
CLAMP(0.0, atof(Cmd_Argv(3)), 255.0),
|
||||||
|
q_max(0.0, atof(Cmd_Argv(4))));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
|
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
|
||||||
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
|
q_max(0.0, atof(Cmd_Argv(2))),
|
||||||
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
|
CLAMP(0.0, atof(Cmd_Argv(3)), 255.0),
|
||||||
CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
|
CLAMP(0.0, atof(Cmd_Argv(4)), 255.0),
|
||||||
|
CLAMP(0.0, atof(Cmd_Argv(5)), 255.0),
|
||||||
0.0);
|
0.0);
|
||||||
break;
|
break;
|
||||||
case 6: //TEST
|
case 7:
|
||||||
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
|
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
|
||||||
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
|
q_max(0.0, atof(Cmd_Argv(2))),
|
||||||
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
|
CLAMP(0.0, atof(Cmd_Argv(3)), 255.0),
|
||||||
CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
|
CLAMP(0.0, atof(Cmd_Argv(4)), 255.0),
|
||||||
atof(Cmd_Argv(5)));
|
CLAMP(0.0, atof(Cmd_Argv(5)), 255.0),
|
||||||
|
q_max(0.0, atof(Cmd_Argv(6))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,16 +213,22 @@ void Fog_ParseWorldspawn (void)
|
||||||
char key[128], value[4096];
|
char key[128], value[4096];
|
||||||
const char *data;
|
const char *data;
|
||||||
|
|
||||||
//initially no fog
|
|
||||||
fog_density_gl = DEFAULT_DENSITY;
|
fog_density_gl = DEFAULT_DENSITY;
|
||||||
fog_red = DEFAULT_GRAY;
|
//initially no fog
|
||||||
fog_green = DEFAULT_GRAY;
|
fog_start = 0;
|
||||||
fog_blue = DEFAULT_GRAY;
|
old_start = 0;
|
||||||
|
|
||||||
old_density = DEFAULT_DENSITY;
|
fog_end = -1;
|
||||||
old_red = DEFAULT_GRAY;
|
old_end = -1;
|
||||||
old_green = DEFAULT_GRAY;
|
|
||||||
old_blue = DEFAULT_GRAY;
|
fog_red = 0.0;
|
||||||
|
old_red = 0.0;
|
||||||
|
|
||||||
|
fog_green = 0.0;
|
||||||
|
old_green = 0.0;
|
||||||
|
|
||||||
|
fog_blue = 0.0;
|
||||||
|
old_blue = 0.0;
|
||||||
|
|
||||||
fade_time = 0.0;
|
fade_time = 0.0;
|
||||||
fade_done = 0.0;
|
fade_done = 0.0;
|
||||||
|
@ -222,7 +261,7 @@ void Fog_ParseWorldspawn (void)
|
||||||
sscanf(value, "%f %f %f %f %f", &fog_start, &fog_end, &fog_red, &fog_green, &fog_blue);
|
sscanf(value, "%f %f %f %f %f", &fog_start, &fog_end, &fog_red, &fog_green, &fog_blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
fog_density_gl = ((fog_end - fog_start))/6000;
|
fog_density_gl = ((fog_start / fog_end))/3.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +274,8 @@ calculates fog color for this frame, taking into account fade times
|
||||||
*/
|
*/
|
||||||
float *Fog_GetColor (void)
|
float *Fog_GetColor (void)
|
||||||
{
|
{
|
||||||
static float c[4] = {0.3f, 0.3f, 0.3f, 1.0f};
|
static float c[4]; // = {0.1f, 0.1f, 0.1f, 1.0f}
|
||||||
#ifndef VITA
|
//#ifndef VITA
|
||||||
float f;
|
float f;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -257,9 +296,9 @@ float *Fog_GetColor (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//find closest 24-bit RGB value, so solid-colored sky can match the fog perfectly
|
//find closest 24-bit RGB value, so solid-colored sky can match the fog perfectly
|
||||||
for (i=0;i<3;i++)
|
//for (i=0;i<3;i++)
|
||||||
c[i] = (float)(Q_rint(c[i] * 255)) / 255.0f;
|
//c[i] = (float)(Q_rint(c[i] * 255)) / 255.0f;
|
||||||
#endif
|
//#endif
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +307,7 @@ float *Fog_GetColor (void)
|
||||||
Fog_GetDensity
|
Fog_GetDensity
|
||||||
|
|
||||||
returns current density of fog
|
returns current density of fog
|
||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
float Fog_GetDensity (void)
|
float Fog_GetDensity (void)
|
||||||
|
@ -292,8 +332,81 @@ called at the beginning of each frame
|
||||||
*/
|
*/
|
||||||
void Fog_SetupFrame (void)
|
void Fog_SetupFrame (void)
|
||||||
{
|
{
|
||||||
|
//glFogfv(GL_FOG_COLOR, Fog_GetColor());
|
||||||
|
//glFogf(GL_FOG_DENSITY, Fog_GetDensity() / 64.0);
|
||||||
|
|
||||||
|
/*float c[4];
|
||||||
|
float f, s, e;
|
||||||
|
|
||||||
|
if (fade_done > cl.time)
|
||||||
|
{
|
||||||
|
f = (fade_done - cl.time) / fade_time;
|
||||||
|
s = f * old_start + (1.0 - f) * fog_start;
|
||||||
|
e = f * old_end + (1.0 - f) * fog_end;
|
||||||
|
c[0] = f * old_red + (1.0 - f) * fog_red;
|
||||||
|
c[1] = f * old_green + (1.0 - f) * fog_green;
|
||||||
|
c[2] = f * old_blue + (1.0 - f) * fog_blue;
|
||||||
|
c[3] = 1.0;
|
||||||
|
//c[3] = r_skyfog.value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = fog_start;
|
||||||
|
e = fog_end;
|
||||||
|
c[0] = fog_red;
|
||||||
|
c[1] = fog_green;
|
||||||
|
c[2] = fog_blue;
|
||||||
|
c[3] = 1.0;
|
||||||
|
//c[3] = r_skyfog.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e == 0)
|
||||||
|
e = -1;*/
|
||||||
|
|
||||||
glFogfv(GL_FOG_COLOR, Fog_GetColor());
|
glFogfv(GL_FOG_COLOR, Fog_GetColor());
|
||||||
glFogf(GL_FOG_DENSITY, Fog_GetDensity() / 64.0);
|
glFogf(GL_FOG_DENSITY, fog_density_gl);
|
||||||
|
//glFogf(GL_FOG_COLOR, *c);
|
||||||
|
|
||||||
|
//if(s == 0 || e < 0)
|
||||||
|
//glDisable(GL_FOG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
Fog_GetStart
|
||||||
|
returns current start of fog
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
float Fog_GetStart (void)
|
||||||
|
{
|
||||||
|
float f;
|
||||||
|
|
||||||
|
if (fade_done > cl.time)
|
||||||
|
{
|
||||||
|
f = (fade_done - cl.time) / fade_time;
|
||||||
|
return f * old_start + (1.0 - f) * fog_start;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return fog_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
Fog_GetEnd
|
||||||
|
returns current end of fog
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
float Fog_GetEnd (void)
|
||||||
|
{
|
||||||
|
float f;
|
||||||
|
|
||||||
|
if (fade_done > cl.time)
|
||||||
|
{
|
||||||
|
f = (fade_done - cl.time) / fade_time;
|
||||||
|
return f * old_start + (1.0 - f) * fog_end;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return fog_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -305,7 +418,7 @@ called before drawing stuff that should be fogged
|
||||||
*/
|
*/
|
||||||
void Fog_EnableGFog (void)
|
void Fog_EnableGFog (void)
|
||||||
{
|
{
|
||||||
if (Fog_GetDensity() > 0)
|
if (Fog_GetDensity() > 0 || !Fog_GetStart() == 0 || (!Fog_GetEnd()) <= 0)
|
||||||
glEnable(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +431,7 @@ called after drawing stuff that should be fogged
|
||||||
*/
|
*/
|
||||||
void Fog_DisableGFog (void)
|
void Fog_DisableGFog (void)
|
||||||
{
|
{
|
||||||
if (Fog_GetDensity() > 0)
|
if (!Fog_GetStart() == 0 || (!Fog_GetEnd()) <= 0)
|
||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +459,8 @@ called after drawing stuff that is additive blended -- restores fog color
|
||||||
*/
|
*/
|
||||||
void Fog_StopAdditive (void)
|
void Fog_StopAdditive (void)
|
||||||
{
|
{
|
||||||
|
vec3_t color = {0,0,0};
|
||||||
|
|
||||||
if (Fog_GetDensity() > 0)
|
if (Fog_GetDensity() > 0)
|
||||||
glFogfv(GL_FOG_COLOR, Fog_GetColor());
|
glFogfv(GL_FOG_COLOR, Fog_GetColor());
|
||||||
}
|
}
|
||||||
|
@ -358,8 +473,8 @@ void Fog_StopAdditive (void)
|
||||||
|
|
||||||
cvar_t r_vfog = {"r_vfog", "1", CVAR_NONE};
|
cvar_t r_vfog = {"r_vfog", "1", CVAR_NONE};
|
||||||
|
|
||||||
void Fog_DrawVFog (void){}
|
//void Fog_DrawVFog (void){}
|
||||||
void Fog_MarkModels (void){}
|
//void Fog_MarkModels (void){}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//
|
//
|
||||||
|
@ -377,7 +492,7 @@ called whenever a map is loaded
|
||||||
void Fog_NewMap (void)
|
void Fog_NewMap (void)
|
||||||
{
|
{
|
||||||
Fog_ParseWorldspawn (); //for global fog
|
Fog_ParseWorldspawn (); //for global fog
|
||||||
Fog_MarkModels (); //for volumetric fog
|
//Fog_MarkModels (); //for volumetric fog
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -394,10 +509,20 @@ void Fog_Init (void)
|
||||||
//Cvar_RegisterVariable (&r_vfog);
|
//Cvar_RegisterVariable (&r_vfog);
|
||||||
|
|
||||||
//set up global fog
|
//set up global fog
|
||||||
|
/*
|
||||||
fog_density_gl = DEFAULT_DENSITY;
|
fog_density_gl = DEFAULT_DENSITY;
|
||||||
fog_red = DEFAULT_GRAY;
|
fog_red = DEFAULT_GRAY;
|
||||||
fog_green = DEFAULT_GRAY;
|
fog_green = DEFAULT_GRAY;
|
||||||
fog_blue = DEFAULT_GRAY;
|
fog_blue = DEFAULT_GRAY;
|
||||||
|
*/
|
||||||
|
|
||||||
|
fog_start = 0;
|
||||||
|
fog_end = -1;
|
||||||
|
fog_red = 0.5;
|
||||||
|
fog_green = 0.5;
|
||||||
|
fog_blue = 0.5;
|
||||||
|
fade_time = 1;
|
||||||
|
fog_density_gl = DEFAULT_DENSITY;
|
||||||
|
|
||||||
Fog_SetupState ();
|
Fog_SetupState ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,9 +334,11 @@ qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash)
|
||||||
buf = COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf), & mod->path_id);
|
buf = COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf), & mod->path_id);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
if (crash)
|
buf = (unsigned*)COM_LoadStackFile ("models/missing_model.mdl", stackbuf, sizeof(stackbuf), NULL);
|
||||||
Host_Error ("Mod_LoadModel: %s not found", mod->name); //johnfitz -- was "Mod_NumForName"
|
if (buf){
|
||||||
return NULL;
|
Con_Printf ("Missing model %s substituted\n", mod->name);
|
||||||
|
}
|
||||||
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -382,7 +384,7 @@ Loads in a model for the given name
|
||||||
qmodel_t *Mod_ForName (const char *name, qboolean crash)
|
qmodel_t *Mod_ForName (const char *name, qboolean crash)
|
||||||
{
|
{
|
||||||
qmodel_t *mod;
|
qmodel_t *mod;
|
||||||
|
|
||||||
mod = Mod_FindName (name);
|
mod = Mod_FindName (name);
|
||||||
|
|
||||||
return Mod_LoadModel (mod, crash);
|
return Mod_LoadModel (mod, crash);
|
||||||
|
@ -700,7 +702,7 @@ void Mod_LoadTextures (lump_t *l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcpy(loading_name, mt->name);
|
strcpy(loading_name, mt->name);
|
||||||
//free (tx_pixels);
|
//free (pixels);
|
||||||
loading_cur_step++;
|
loading_cur_step++;
|
||||||
SCR_UpdateScreen();
|
SCR_UpdateScreen();
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
|
@ -717,7 +717,7 @@ void Sky_DrawSkyBox (void)
|
||||||
rs_skypolys++;
|
rs_skypolys++;
|
||||||
rs_skypasses++;
|
rs_skypasses++;
|
||||||
|
|
||||||
if (Fog_GetDensity() > 0 && skyfog > 0)
|
/*if (Fog_GetDensity() > 0 && skyfog > 0)
|
||||||
{
|
{
|
||||||
float *c;
|
float *c;
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ void Sky_DrawSkyBox (void)
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
|
|
||||||
rs_skypasses++;
|
rs_skypasses++;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -835,7 +835,7 @@ void Sky_DrawFaceQuad (glpoly_t *p)
|
||||||
{
|
{
|
||||||
GL_Bind (solidskytexture);
|
GL_Bind (solidskytexture);
|
||||||
|
|
||||||
if (r_skyalpha.value < 1.0)
|
//if (r_skyalpha.value < 1.0)
|
||||||
glColor3f (1, 1, 1);
|
glColor3f (1, 1, 1);
|
||||||
|
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
|
@ -847,28 +847,28 @@ void Sky_DrawFaceQuad (glpoly_t *p)
|
||||||
}
|
}
|
||||||
glEnd ();
|
glEnd ();
|
||||||
|
|
||||||
GL_Bind (alphaskytexture);
|
//GL_Bind (alphaskytexture);
|
||||||
glEnable (GL_BLEND);
|
//glEnable (GL_BLEND);
|
||||||
|
|
||||||
if (r_skyalpha.value < 1.0)
|
//if (r_skyalpha.value < 1.0)
|
||||||
glColor4f (1, 1, 1, r_skyalpha.value);
|
//glColor4f (1, 1, 1, r_skyalpha.value);
|
||||||
|
|
||||||
glBegin (GL_QUADS);
|
//glBegin (GL_QUADS);
|
||||||
for (i=0, v=p->verts[0] ; i<4 ; i++, v+=VERTEXSIZE)
|
//for (i=0, v=p->verts[0] ; i<4 ; i++, v+=VERTEXSIZE)
|
||||||
{
|
//{
|
||||||
Sky_GetTexCoord (v, 16, &s, &t);
|
//Sky_GetTexCoord (v, 16, &s, &t);
|
||||||
glTexCoord2f (s, t);
|
//glTexCoord2f (s, t);
|
||||||
glVertex3fv (v);
|
//glVertex3fv (v);
|
||||||
}
|
//}
|
||||||
glEnd ();
|
//glEnd ();
|
||||||
|
|
||||||
glDisable (GL_BLEND);
|
//glDisable (GL_BLEND);
|
||||||
|
|
||||||
rs_skypolys++;
|
rs_skypolys++;
|
||||||
rs_skypasses += 2;
|
rs_skypasses += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Fog_GetDensity() > 0 && skyfog > 0)
|
/*if (Fog_GetDensity() > 0 && skyfog > 0)
|
||||||
{
|
{
|
||||||
float *c;
|
float *c;
|
||||||
|
|
||||||
|
@ -887,7 +887,7 @@ void Sky_DrawFaceQuad (glpoly_t *p)
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
|
|
||||||
rs_skypasses++;
|
rs_skypasses++;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -959,15 +959,15 @@ void Sky_DrawSkyLayers (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (r_skyalpha.value < 1.0)
|
//if (r_skyalpha.value < 1.0)
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
for (i=0 ; i<6 ; i++)
|
for (i=0 ; i<6 ; i++)
|
||||||
if (skymins[0][i] < skymaxs[0][i] && skymins[1][i] < skymaxs[1][i])
|
if (skymins[0][i] < skymaxs[0][i] && skymins[1][i] < skymaxs[1][i])
|
||||||
Sky_DrawFace (i);
|
Sky_DrawFace (i);
|
||||||
|
|
||||||
if (r_skyalpha.value < 1.0)
|
//if (r_skyalpha.value < 1.0)
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -999,10 +999,12 @@ void Sky_DrawSky (void)
|
||||||
//
|
//
|
||||||
Fog_DisableGFog ();
|
Fog_DisableGFog ();
|
||||||
glDisable (GL_TEXTURE_2D);
|
glDisable (GL_TEXTURE_2D);
|
||||||
if (Fog_GetDensity() > 0)
|
/*if (Fog_GetDensity() > 0)
|
||||||
glColor3fv (Fog_GetColor());
|
glColor3fv (Fog_GetColor());
|
||||||
else
|
else*/
|
||||||
glColor3fv (skyflatcolor);
|
//glColor3fv (skyflatcolor);
|
||||||
|
|
||||||
|
//glColor3fv (Fog_GetColor());
|
||||||
Sky_ProcessTextureChains ();
|
Sky_ProcessTextureChains ();
|
||||||
Sky_ProcessEntities ();
|
Sky_ProcessEntities ();
|
||||||
glColor3f (1, 1, 1);
|
glColor3f (1, 1, 1);
|
||||||
|
@ -1011,7 +1013,7 @@ void Sky_DrawSky (void)
|
||||||
//
|
//
|
||||||
// render slow sky: cloud layers or skybox
|
// render slow sky: cloud layers or skybox
|
||||||
//
|
//
|
||||||
if (!r_fastsky.value && !(Fog_GetDensity() > 0 && skyfog >= 1))
|
/*if (!r_fastsky.value && !(Fog_GetDensity() > 0))
|
||||||
{
|
{
|
||||||
glDepthFunc(GL_GEQUAL);
|
glDepthFunc(GL_GEQUAL);
|
||||||
glDepthMask(0);
|
glDepthMask(0);
|
||||||
|
@ -1023,7 +1025,11 @@ void Sky_DrawSky (void)
|
||||||
|
|
||||||
glDepthMask(1);
|
glDepthMask(1);
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
}
|
}*/
|
||||||
|
glDepthFunc(GL_GEQUAL);
|
||||||
|
glDepthMask(0);
|
||||||
|
Sky_DrawSkyBox ();
|
||||||
|
glDepthMask(1);
|
||||||
|
glDepthFunc(GL_LEQUAL);
|
||||||
Fog_EnableGFog ();
|
Fog_EnableGFog ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,13 +411,13 @@ void M_Paused_Menu_Key (int key)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
/*case K_BBUTTON:
|
case K_BBUTTON:
|
||||||
case K_ESCAPE:
|
case K_ESCAPE:
|
||||||
paused_hack = false;
|
paused_hack = false;
|
||||||
key_dest = key_game;
|
key_dest = key_game;
|
||||||
m_state = m_none;
|
m_state = m_none;
|
||||||
break;
|
break;
|
||||||
*/
|
|
||||||
case K_DOWNARROW:
|
case K_DOWNARROW:
|
||||||
S_LocalSound ("sounds/menu/navigate.wav");
|
S_LocalSound ("sounds/menu/navigate.wav");
|
||||||
if (++M_Paused_Cusor >= Max_Paused_Items)
|
if (++M_Paused_Cusor >= Max_Paused_Items)
|
||||||
|
@ -580,7 +580,13 @@ void M_Main_Draw (void)
|
||||||
case 1: Draw_ColoredStringScale(10, y + 305, "Adjust your Settings to Optimize your Experience.", 1, 1, 1, 1, 1.5f); break;
|
case 1: Draw_ColoredStringScale(10, y + 305, "Adjust your Settings to Optimize your Experience.", 1, 1, 1, 1, 1.5f); break;
|
||||||
//case 2: Draw_ColoredStringScale(10, y + 305, "View locked or unlocked Achievements.", 1, 1, 1, 1, 1.5f); break;
|
//case 2: Draw_ColoredStringScale(10, y + 305, "View locked or unlocked Achievements.", 1, 1, 1, 1, 1.5f); break;
|
||||||
case 2: Draw_ColoredStringScale(10, y + 305, "See who made NZ:P possible.", 1, 1, 1, 1, 1.5f); break;
|
case 2: Draw_ColoredStringScale(10, y + 305, "See who made NZ:P possible.", 1, 1, 1, 1, 1.5f); break;
|
||||||
case 3: Draw_ColoredStringScale(10, y + 305, "Return to Horizon (SwitchOS).", 1, 1, 1, 1, 1.5f); break;
|
case 3:
|
||||||
|
#ifdef NX
|
||||||
|
Draw_ColoredStringScale(10, y + 305, "Return to Horizon (SwitchOS).", 1, 1, 1, 1, 1.5f);
|
||||||
|
#else
|
||||||
|
Draw_ColoredStringScale(10, y + 305, "Return to Vita Homescreen.", 1, 1, 1, 1, 1.5f);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1191,9 +1191,9 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
glBlendFunc (GL_ONE, GL_ONE);
|
glBlendFunc (GL_ONE, GL_ONE);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glColor3f(entalpha,entalpha,entalpha);
|
glColor3f(entalpha,entalpha,entalpha);
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
GL_DrawAliasFrame (paliashdr, lerpdata);
|
GL_DrawAliasFrame (paliashdr, lerpdata);
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
@ -1254,9 +1254,9 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
shading = false;
|
shading = false;
|
||||||
glColor3f(entalpha,entalpha,entalpha);
|
glColor3f(entalpha,entalpha,entalpha);
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
GL_DrawAliasFrame (paliashdr, lerpdata);
|
GL_DrawAliasFrame (paliashdr, lerpdata);
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
@ -1273,9 +1273,9 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc (GL_ONE, GL_ONE);
|
glBlendFunc (GL_ONE, GL_ONE);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
GL_DrawAliasFrame (paliashdr, lerpdata);
|
GL_DrawAliasFrame (paliashdr, lerpdata);
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -1290,9 +1290,9 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
shading = false;
|
shading = false;
|
||||||
glColor3f(entalpha,entalpha,entalpha);
|
glColor3f(entalpha,entalpha,entalpha);
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
GL_DrawAliasFrame (paliashdr, lerpdata);
|
GL_DrawAliasFrame (paliashdr, lerpdata);
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
@ -1331,9 +1331,9 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
shading = false;
|
shading = false;
|
||||||
glColor3f(entalpha,entalpha,entalpha);
|
glColor3f(entalpha,entalpha,entalpha);
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
GL_DrawAliasFrame (paliashdr, lerpdata);
|
GL_DrawAliasFrame (paliashdr, lerpdata);
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
|
@ -373,7 +373,7 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
Fog_DisableGFog ();
|
Fog_DisableGFog ();
|
||||||
GL_Bind (t->gltexture);
|
GL_Bind (t->gltexture);
|
||||||
DrawGLPoly (s->polys);
|
DrawGLPoly (s->polys);
|
||||||
Fog_EnableGFog ();
|
//
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
|
|
||||||
//second pass -- lightmap with black fog, modulate blended
|
//second pass -- lightmap with black fog, modulate blended
|
||||||
|
@ -382,7 +382,7 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
glDepthMask (GL_FALSE);
|
glDepthMask (GL_FALSE);
|
||||||
glEnable (GL_BLEND);
|
glEnable (GL_BLEND);
|
||||||
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); //2x modulate
|
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); //2x modulate
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
#else
|
#else
|
||||||
|
@ -395,11 +395,11 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
glVertex3fv (v);
|
glVertex3fv (v);
|
||||||
}
|
}
|
||||||
glEnd ();
|
glEnd ();
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
|
|
||||||
//third pass -- black geo with normal fog, additive blended
|
//third pass -- black geo with normal fog, additive blended
|
||||||
if (Fog_GetDensity() > 0)
|
/*if (Fog_GetDensity() > 0)
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ONE); //add
|
glBlendFunc(GL_ONE, GL_ONE); //add
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
@ -408,17 +408,19 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
glColor3f(1,1,1);
|
glColor3f(1,1,1);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
glDepthMask (GL_TRUE);
|
glDepthMask (GL_TRUE);
|
||||||
|
Fog_EnableGFog ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gl_mtexable) //case 4: texture and lightmap in one pass, regular modulation
|
if (gl_mtexable) //case 4: texture and lightmap in one pass, regular modulation
|
||||||
{
|
{
|
||||||
|
Fog_DisableGFog ();
|
||||||
GL_DisableMultitexture(); // selects TEXTURE0
|
GL_DisableMultitexture(); // selects TEXTURE0
|
||||||
GL_Bind (t->gltexture);
|
GL_Bind (t->gltexture);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
@ -441,12 +443,15 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
glEnd ();
|
glEnd ();
|
||||||
GL_DisableMultitexture ();
|
GL_DisableMultitexture ();
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
|
Fog_EnableGFog ();
|
||||||
}
|
}
|
||||||
else if (entalpha < 1 || (s->flags & SURF_DRAWFENCE)) //case 5: can't do multipass if entity has alpha, so just draw the texture
|
else if (entalpha < 1 || (s->flags & SURF_DRAWFENCE)) //case 5: can't do multipass if entity has alpha, so just draw the texture
|
||||||
{
|
{
|
||||||
|
Fog_DisableGFog ();
|
||||||
GL_Bind (t->gltexture);
|
GL_Bind (t->gltexture);
|
||||||
DrawGLPoly (s->polys);
|
DrawGLPoly (s->polys);
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
|
Fog_EnableGFog ();
|
||||||
}
|
}
|
||||||
else //case 6: texture in one pass, lightmap in a second pass, fog in third pass
|
else //case 6: texture in one pass, lightmap in a second pass, fog in third pass
|
||||||
{
|
{
|
||||||
|
@ -454,7 +459,7 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
Fog_DisableGFog ();
|
Fog_DisableGFog ();
|
||||||
GL_Bind (t->gltexture);
|
GL_Bind (t->gltexture);
|
||||||
DrawGLPoly (s->polys);
|
DrawGLPoly (s->polys);
|
||||||
Fog_EnableGFog ();
|
//
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
|
|
||||||
//second pass -- lightmap with black fog, modulate blended
|
//second pass -- lightmap with black fog, modulate blended
|
||||||
|
@ -463,7 +468,7 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
glDepthMask (GL_FALSE);
|
glDepthMask (GL_FALSE);
|
||||||
glEnable (GL_BLEND);
|
glEnable (GL_BLEND);
|
||||||
glBlendFunc (GL_ZERO, GL_SRC_COLOR); //modulate
|
glBlendFunc (GL_ZERO, GL_SRC_COLOR); //modulate
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
#else
|
#else
|
||||||
|
@ -476,11 +481,11 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
glVertex3fv (v);
|
glVertex3fv (v);
|
||||||
}
|
}
|
||||||
glEnd ();
|
glEnd ();
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
|
|
||||||
//third pass -- black geo with normal fog, additive blended
|
//third pass -- black geo with normal fog, additive blended
|
||||||
if (Fog_GetDensity() > 0)
|
/*if (Fog_GetDensity() > 0)
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ONE); //add
|
glBlendFunc(GL_ONE, GL_ONE); //add
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
@ -489,11 +494,13 @@ void R_DrawSequentialPoly (msurface_t *s)
|
||||||
glColor3f(1,1,1);
|
glColor3f(1,1,1);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
rs_brushpasses++;
|
rs_brushpasses++;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
glDepthMask (GL_TRUE);
|
glDepthMask (GL_TRUE);
|
||||||
|
|
||||||
|
Fog_EnableGFog ();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -517,9 +524,9 @@ fullbrights:
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
glColor3f (entalpha, entalpha, entalpha);
|
glColor3f (entalpha, entalpha, entalpha);
|
||||||
GL_Bind (t->fullbright);
|
GL_Bind (t->fullbright);
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
DrawGLPoly (s->polys);
|
DrawGLPoly (s->polys);
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
|
@ -139,6 +139,8 @@ void R_DrawSpriteModel (entity_t *e)
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Fog_DisableGFog ();
|
||||||
|
|
||||||
//johnfitz: offset decals
|
//johnfitz: offset decals
|
||||||
if (psprite->type == SPR_ORIENTED)
|
if (psprite->type == SPR_ORIENTED)
|
||||||
|
@ -179,4 +181,6 @@ void R_DrawSpriteModel (entity_t *e)
|
||||||
//johnfitz: offset decals
|
//johnfitz: offset decals
|
||||||
if (psprite->type == SPR_ORIENTED)
|
if (psprite->type == SPR_ORIENTED)
|
||||||
GL_PolygonOffset (OFFSET_NONE);
|
GL_PolygonOffset (OFFSET_NONE);
|
||||||
|
|
||||||
|
Fog_EnableGFog ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1197,24 +1197,24 @@ void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
//to make fog work with multipass lightmapping, need to do one pass
|
//to make fog work with multipass lightmapping, need to do one pass
|
||||||
//with no fog, one modulate pass with black fog, and one additive
|
//with no fog, one modulate pass with black fog, and one additive
|
||||||
//pass with black geometry and normal fog
|
//pass with black geometry and normal fog
|
||||||
Fog_DisableGFog ();
|
//Fog_DisableGFog ();
|
||||||
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
||||||
Fog_EnableGFog ();
|
//Fog_EnableGFog ();
|
||||||
glDepthMask (GL_FALSE);
|
glDepthMask (GL_FALSE);
|
||||||
glEnable (GL_BLEND);
|
glEnable (GL_BLEND);
|
||||||
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR); //2x modulate
|
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR); //2x modulate
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
R_DrawLightmapChains ();
|
R_DrawLightmapChains ();
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
if (Fog_GetDensity() > 0)
|
//if (Fog_GetDensity() > 0)
|
||||||
{
|
//{
|
||||||
glBlendFunc(GL_ONE, GL_ONE); //add
|
//glBlendFunc(GL_ONE, GL_ONE); //add
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
glColor3f(0,0,0);
|
//glColor3f(0,0,0);
|
||||||
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
||||||
glColor3f(1,1,1);
|
//glColor3f(1,1,1);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
}
|
//}
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
glDepthMask (GL_TRUE);
|
glDepthMask (GL_TRUE);
|
||||||
|
@ -1239,24 +1239,24 @@ void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
//to make fog work with multipass lightmapping, need to do one pass
|
//to make fog work with multipass lightmapping, need to do one pass
|
||||||
//with no fog, one modulate pass with black fog, and one additive
|
//with no fog, one modulate pass with black fog, and one additive
|
||||||
//pass with black geometry and normal fog
|
//pass with black geometry and normal fog
|
||||||
Fog_DisableGFog ();
|
//Fog_DisableGFog ();
|
||||||
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
||||||
Fog_EnableGFog ();
|
//Fog_EnableGFog ();
|
||||||
glDepthMask (GL_FALSE);
|
glDepthMask (GL_FALSE);
|
||||||
glEnable (GL_BLEND);
|
glEnable (GL_BLEND);
|
||||||
glBlendFunc(GL_ZERO, GL_SRC_COLOR); //modulate
|
glBlendFunc(GL_ZERO, GL_SRC_COLOR); //modulate
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
R_DrawLightmapChains ();
|
R_DrawLightmapChains ();
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
if (Fog_GetDensity() > 0)
|
//if (Fog_GetDensity() > 0)
|
||||||
{
|
//{
|
||||||
glBlendFunc(GL_ONE, GL_ONE); //add
|
//glBlendFunc(GL_ONE, GL_ONE); //add
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
glColor3f(0,0,0);
|
//glColor3f(0,0,0);
|
||||||
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
R_DrawTextureChains_TextureOnly (model, ent, chain);
|
||||||
glColor3f(1,1,1);
|
//glColor3f(1,1,1);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
}
|
//}
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
glDepthMask (GL_TRUE);
|
glDepthMask (GL_TRUE);
|
||||||
|
@ -1273,9 +1273,9 @@ fullbrights:
|
||||||
glBlendFunc (GL_ONE, GL_ONE);
|
glBlendFunc (GL_ONE, GL_ONE);
|
||||||
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
glColor3f (entalpha, entalpha, entalpha);
|
glColor3f (entalpha, entalpha, entalpha);
|
||||||
Fog_StartAdditive ();
|
//Fog_StartAdditive ();
|
||||||
R_DrawTextureChains_Glow (model, ent, chain);
|
R_DrawTextureChains_Glow (model, ent, chain);
|
||||||
Fog_StopAdditive ();
|
//Fog_StopAdditive ();
|
||||||
glColor3f (1, 1, 1);
|
glColor3f (1, 1, 1);
|
||||||
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
Loading…
Reference in a new issue