Compare commits
2 Commits
6eb2ea7586
...
51c33e86ee
Author | SHA1 | Date |
---|---|---|
an | 51c33e86ee | |
an | f0e0176aa8 |
|
@ -1286,7 +1286,7 @@ void LOG_Init(quakeparms_t *parms)
|
|||
return;
|
||||
|
||||
inittime = time(NULL);
|
||||
strftime(session, sizeof(session), "%m/%" PRIi32 "/%Y %H:%M:%S", localtime(&inittime));
|
||||
strftime(session, sizeof(session), "%m/%u/%Y %H:%M:%S", localtime(&inittime));
|
||||
q_snprintf(logfilename, sizeof(logfilename), "%s/qconsole.log", parms->basedir);
|
||||
|
||||
// unlink (logfilename);
|
||||
|
|
|
@ -391,8 +391,8 @@ void PR_ExecuteProgram(func_t fnum)
|
|||
|
||||
CASE(OP_EQ_V)
|
||||
OPC->flt = OPA->vec[0] == OPB->vec[0] &&
|
||||
OPA->vec[1] == OPB->vec[1] &&
|
||||
OPA->vec[2] == OPB->vec[2];
|
||||
OPA->vec[1] == OPB->vec[1] &&
|
||||
OPA->vec[2] == OPB->vec[2];
|
||||
BREAK
|
||||
CASE(OP_EQ_S)
|
||||
OPC->flt = !strcmp(PR_GetString(OPA->string), PR_GetString(OPB->string));
|
||||
|
@ -402,8 +402,8 @@ void PR_ExecuteProgram(func_t fnum)
|
|||
|
||||
CASE(OP_NE_V)
|
||||
OPC->flt = OPA->vec[0] != OPB->vec[0] ||
|
||||
OPA->vec[1] != OPB->vec[1] ||
|
||||
OPA->vec[2] != OPB->vec[2];
|
||||
OPA->vec[1] != OPB->vec[1] ||
|
||||
OPA->vec[2] != OPB->vec[2];
|
||||
BREAK
|
||||
CASE(OP_NE_S)
|
||||
OPC->flt = strcmp(PR_GetString(OPA->string), PR_GetString(OPB->string));
|
||||
|
|
145
source/r_alias.c
145
source/r_alias.c
|
@ -80,6 +80,7 @@ static GLuint fullbrightTexLoc;
|
|||
static GLuint useFullbrightTexLoc;
|
||||
static GLuint useOverbrightLoc;
|
||||
static GLuint useAlphaTestLoc;
|
||||
static GLuint useRFullbrightLoc;
|
||||
|
||||
#define pose1VertexAttrIndex 0
|
||||
#define pose1NormalAttrIndex 1
|
||||
|
@ -131,68 +132,78 @@ void GLAlias_CreateShaders(void)
|
|||
{ "Pose2Normal", pose2NormalAttrIndex }
|
||||
};
|
||||
|
||||
const GLchar *vertSource = \
|
||||
"#version 110\n"
|
||||
"\n"
|
||||
"uniform float Blend;\n"
|
||||
"uniform vec3 ShadeVector;\n"
|
||||
"uniform vec4 LightColor;\n"
|
||||
"attribute vec4 TexCoords; // only xy are used \n"
|
||||
"attribute vec4 Pose1Vert;\n"
|
||||
"attribute vec3 Pose1Normal;\n"
|
||||
"attribute vec4 Pose2Vert;\n"
|
||||
"attribute vec3 Pose2Normal;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"float r_avertexnormal_dot(vec3 vertexnormal) // from MH \n"
|
||||
"{\n"
|
||||
" float dot = dot(vertexnormal, ShadeVector);\n"
|
||||
" // wtf - this reproduces anorm_dots within as reasonable a degree of tolerance as the >= 0 case\n"
|
||||
" if (dot < 0.0)\n"
|
||||
" return 1.0 + dot * (13.0 / 44.0);\n"
|
||||
" else\n"
|
||||
" return 1.0 + dot;\n"
|
||||
"}\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_TexCoord[0] = TexCoords;\n"
|
||||
" vec4 lerpedVert = mix(vec4(Pose1Vert.xyz, 1.0), vec4(Pose2Vert.xyz, 1.0), Blend);\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * lerpedVert;\n"
|
||||
" FogFragCoord = gl_Position.w;\n"
|
||||
" float dot1 = r_avertexnormal_dot(Pose1Normal);\n"
|
||||
" float dot2 = r_avertexnormal_dot(Pose2Normal);\n"
|
||||
" gl_FrontColor = LightColor * vec4(vec3(mix(dot1, dot2, Blend)), 1.0);\n"
|
||||
"}\n";
|
||||
const GLchar *vertSource =
|
||||
"#version 130\n"
|
||||
"\n"
|
||||
"uniform float Blend;\n"
|
||||
"uniform vec3 ShadeVector;\n"
|
||||
"uniform vec4 LightColor;\n"
|
||||
"attribute vec4 TexCoords; // only xy are used \n"
|
||||
"attribute vec4 Pose1Vert;\n"
|
||||
"attribute vec3 Pose1Normal;\n"
|
||||
"attribute vec4 Pose2Vert;\n"
|
||||
"attribute vec3 Pose2Normal;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"float r_avertexnormal_dot(vec3 vertexnormal) // from MH \n"
|
||||
"{\n"
|
||||
" float dot = dot(vertexnormal, ShadeVector);\n"
|
||||
" // wtf - this reproduces anorm_dots within as reasonable a degree of tolerance as the >= 0 case\n"
|
||||
" if(dot < 0.0)\n"
|
||||
" return 1.0 + dot * (13.0 / 44.0);\n"
|
||||
" else\n"
|
||||
" return 1.0 + dot;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_TexCoord[0] = TexCoords;\n"
|
||||
" vec4 lerpedVert = mix(vec4(Pose1Vert.xyz, 1.0), vec4(Pose2Vert.xyz, 1.0), Blend);\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * lerpedVert;\n"
|
||||
" gl_Position = vec4(floor(gl_Position.xyz * 10.0) / 10.0, gl_Position.w);"
|
||||
" gl_Position /= abs(gl_Position.w);\n"
|
||||
" FogFragCoord = gl_Position.w;\n"
|
||||
" float dot1 = r_avertexnormal_dot(Pose1Normal);\n"
|
||||
" float dot2 = r_avertexnormal_dot(Pose2Normal);\n"
|
||||
" gl_FrontColor = LightColor * vec4(vec3(mix(dot1, dot2, Blend)), 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar *fragSource = \
|
||||
"#version 110\n"
|
||||
"\n"
|
||||
"uniform sampler2D Tex;\n"
|
||||
"uniform sampler2D FullbrightTex;\n"
|
||||
"uniform bool UseFullbrightTex;\n"
|
||||
"uniform bool UseOverbright;\n"
|
||||
"uniform bool UseAlphaTest;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 result = texture2D(Tex, gl_TexCoord[0].xy);\n"
|
||||
" if (UseAlphaTest && (result.a < 0.666))\n"
|
||||
" discard;\n"
|
||||
" result *= gl_Color;\n"
|
||||
" if (UseOverbright)\n"
|
||||
" result.rgb *= 2.0;\n"
|
||||
" if (UseFullbrightTex)\n"
|
||||
" result += texture2D(FullbrightTex, gl_TexCoord[0].xy);\n"
|
||||
" result = clamp(result, 0.0, 1.0);\n"
|
||||
" float fog = exp(-gl_Fog.density * gl_Fog.density * FogFragCoord * FogFragCoord);\n"
|
||||
" fog = clamp(fog, 0.0, 1.0);\n"
|
||||
" result = mix(gl_Fog.color, result, fog);\n"
|
||||
" result.a = gl_Color.a;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
|
||||
" gl_FragColor = result;\n"
|
||||
"}\n";
|
||||
"#version 130\n"
|
||||
"\n"
|
||||
"uniform sampler2D Tex;\n"
|
||||
"uniform sampler2D FullbrightTex;\n"
|
||||
"uniform bool UseFullbrightTex;\n"
|
||||
"uniform bool UseOverbright;\n"
|
||||
"uniform bool UseAlphaTest;\n"
|
||||
"uniform bool UseRFullbright;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 result = texture2D(Tex, gl_TexCoord[0].xy);\n"
|
||||
" if(UseAlphaTest && result.a < 0.666)\n"
|
||||
" discard;\n"
|
||||
" if(!UseRFullbright)\n"
|
||||
" {\n"
|
||||
" result *= gl_Color;\n"
|
||||
" if(UseOverbright)\n"
|
||||
" result.rgb *= 2.0;\n"
|
||||
" }\n"
|
||||
" if(UseFullbrightTex)\n"
|
||||
" result += texture2D(FullbrightTex, gl_TexCoord[0].xy);\n"
|
||||
" result = clamp(result, 0.0, 1.0);\n"
|
||||
" if(!UseRFullbright)\n"
|
||||
" {\n"
|
||||
" float fog = exp(-gl_Fog.density * gl_Fog.density * FogFragCoord * FogFragCoord);\n"
|
||||
" fog = clamp(fog, 0.0, 1.0);\n"
|
||||
" result = mix(gl_Fog.color, result, fog);\n"
|
||||
" result.a = gl_Color.a;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
|
||||
" }\n"
|
||||
" gl_FragColor = result;\n"
|
||||
"}\n";
|
||||
|
||||
if(!gl_glsl_alias_able)
|
||||
return;
|
||||
|
@ -210,6 +221,7 @@ void GLAlias_CreateShaders(void)
|
|||
useFullbrightTexLoc = GL_GetUniformLocation(&r_alias_program, "UseFullbrightTex");
|
||||
useOverbrightLoc = GL_GetUniformLocation(&r_alias_program, "UseOverbright");
|
||||
useAlphaTestLoc = GL_GetUniformLocation(&r_alias_program, "UseAlphaTest");
|
||||
useRFullbrightLoc = GL_GetUniformLocation(&r_alias_program, "UseRFullbright");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,6 +279,7 @@ void GL_DrawAliasFrame_GLSL(aliashdr_t *paliashdr, lerpdata_t lerpdata, gltextur
|
|||
GL_Uniform1iFunc(useFullbrightTexLoc, (fb != NULL) ? 1 : 0);
|
||||
GL_Uniform1fFunc(useOverbrightLoc, overbright ? 1 : 0);
|
||||
GL_Uniform1iFunc(useAlphaTestLoc, (currententity->model->flags & MF_HOLEY) ? 1 : 0);
|
||||
GL_Uniform1iFunc(useRFullbrightLoc, r_fullbright_cheatsafe);
|
||||
|
||||
// set textures
|
||||
GL_SelectTexture(GL_TEXTURE0);
|
||||
|
@ -714,6 +727,8 @@ void R_DrawAliasModel(entity_t *e)
|
|||
//
|
||||
// draw it
|
||||
//
|
||||
// call fast path if possible. if the shader compliation failed for some reason,
|
||||
// r_alias_program will be 0.
|
||||
if(r_drawflat_cheatsafe)
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
@ -721,6 +736,10 @@ void R_DrawAliasModel(entity_t *e)
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
srand((int32_t)(cl.time * 1000)); //restore randomness
|
||||
}
|
||||
else if(r_alias_program != 0)
|
||||
{
|
||||
GL_DrawAliasFrame_GLSL(paliashdr, lerpdata, tx, fb);
|
||||
}
|
||||
else if(r_fullbright_cheatsafe)
|
||||
{
|
||||
GL_Bind(tx);
|
||||
|
@ -751,12 +770,6 @@ void R_DrawAliasModel(entity_t *e)
|
|||
GL_DrawAliasFrame(paliashdr, lerpdata);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
// call fast path if possible. if the shader compliation failed for some reason,
|
||||
// r_alias_program will be 0.
|
||||
else if(r_alias_program != 0)
|
||||
{
|
||||
GL_DrawAliasFrame_GLSL(paliashdr, lerpdata, tx, fb);
|
||||
}
|
||||
else if(overbright)
|
||||
{
|
||||
if(gl_texture_env_combine && gl_mtexable && gl_texture_env_add && fb) //case 1: everything in one pass
|
||||
|
|
|
@ -815,52 +815,52 @@ void GLWorld_CreateShaders(void)
|
|||
};
|
||||
|
||||
const GLchar *vertSource = \
|
||||
"#version 110\n"
|
||||
"\n"
|
||||
"attribute vec3 Vert;\n"
|
||||
"attribute vec2 TexCoords;\n"
|
||||
"attribute vec2 LMCoords;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_TexCoord[0] = vec4(TexCoords, 0.0, 0.0);\n"
|
||||
" gl_TexCoord[1] = vec4(LMCoords, 0.0, 0.0);\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * vec4(Vert, 1.0);\n"
|
||||
" FogFragCoord = gl_Position.w;\n"
|
||||
"}\n";
|
||||
"#version 130\n"
|
||||
"\n"
|
||||
"attribute vec3 Vert;\n"
|
||||
"attribute vec2 TexCoords;\n"
|
||||
"attribute vec2 LMCoords;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_TexCoord[0] = vec4(TexCoords, 0.0, 0.0);\n"
|
||||
" gl_TexCoord[1] = vec4(LMCoords, 0.0, 0.0);\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * vec4(Vert, 1.0);\n"
|
||||
" FogFragCoord = gl_Position.w;\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar *fragSource = \
|
||||
"#version 110\n"
|
||||
"\n"
|
||||
"uniform sampler2D Tex;\n"
|
||||
"uniform sampler2D LMTex;\n"
|
||||
"uniform sampler2D FullbrightTex;\n"
|
||||
"uniform bool UseFullbrightTex;\n"
|
||||
"uniform bool UseOverbright;\n"
|
||||
"uniform bool UseAlphaTest;\n"
|
||||
"uniform float Alpha;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 result = texture2D(Tex, gl_TexCoord[0].xy);\n"
|
||||
" if (UseAlphaTest && (result.a < 0.666))\n"
|
||||
" discard;\n"
|
||||
" result *= texture2D(LMTex, gl_TexCoord[1].xy);\n"
|
||||
" if (UseOverbright)\n"
|
||||
" result.rgb *= 2.0;\n"
|
||||
" if (UseFullbrightTex)\n"
|
||||
" result += texture2D(FullbrightTex, gl_TexCoord[0].xy);\n"
|
||||
" result = clamp(result, 0.0, 1.0);\n"
|
||||
" float fog = exp(-gl_Fog.density * gl_Fog.density * FogFragCoord * FogFragCoord);\n"
|
||||
" fog = clamp(fog, 0.0, 1.0);\n"
|
||||
" result = mix(gl_Fog.color, result, fog);\n"
|
||||
" result.a = Alpha;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
|
||||
" gl_FragColor = result;\n"
|
||||
"}\n";
|
||||
"#version 130\n"
|
||||
"\n"
|
||||
"uniform sampler2D Tex;\n"
|
||||
"uniform sampler2D LMTex;\n"
|
||||
"uniform sampler2D FullbrightTex;\n"
|
||||
"uniform bool UseFullbrightTex;\n"
|
||||
"uniform bool UseOverbright;\n"
|
||||
"uniform bool UseAlphaTest;\n"
|
||||
"uniform float Alpha;\n"
|
||||
"\n"
|
||||
"varying float FogFragCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 result = texture2D(Tex, gl_TexCoord[0].xy);\n"
|
||||
" if (UseAlphaTest && (result.a < 0.666))\n"
|
||||
" discard;\n"
|
||||
" result *= texture2D(LMTex, gl_TexCoord[1].xy);\n"
|
||||
" if (UseOverbright)\n"
|
||||
" result.rgb *= 2.0;\n"
|
||||
" if (UseFullbrightTex)\n"
|
||||
" result += texture2D(FullbrightTex, gl_TexCoord[0].xy);\n"
|
||||
" result = clamp(result, 0.0, 1.0);\n"
|
||||
" float fog = exp(-gl_Fog.density * gl_Fog.density * FogFragCoord * FogFragCoord);\n"
|
||||
" fog = clamp(fog, 0.0, 1.0);\n"
|
||||
" result = mix(gl_Fog.color, result, fog);\n"
|
||||
" result.a = Alpha;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
|
||||
" gl_FragColor = result;\n"
|
||||
"}\n";
|
||||
|
||||
if(!gl_glsl_alias_able)
|
||||
return;
|
||||
|
|
|
@ -415,7 +415,7 @@ This is passed to SDL_SetWindowDisplayMode to specify a pixel format
|
|||
with the requested bpp. If we didn't care about bpp we could just pass NULL.
|
||||
================
|
||||
*/
|
||||
static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int32_t width, int32_t height, int32_t refreshrate, int32_t bpp)
|
||||
static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int32_t width, int32_t height, int32_t refreshrate, uint32_t bpp)
|
||||
{
|
||||
static SDL_DisplayMode mode;
|
||||
const int32_t sdlmodes = SDL_GetNumDisplayModes(0);
|
||||
|
@ -426,9 +426,7 @@ static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int32_t width, int32_t height, i
|
|||
if(SDL_GetDisplayMode(0, i, &mode) != 0)
|
||||
continue;
|
||||
|
||||
if(mode.w == width && mode.h == height
|
||||
&& SDL_BITSPERPIXEL(mode.format) == bpp
|
||||
&& mode.refresh_rate == refreshrate)
|
||||
if(mode.w == width && mode.h == height && SDL_BITSPERPIXEL(mode.format) == bpp && mode.refresh_rate == refreshrate)
|
||||
{
|
||||
return &mode;
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ static char const *Sys_GetUserDir(void)
|
|||
char const *system_dir;
|
||||
|
||||
if((system_dir = getenv("XDG_DATA_HOME")))
|
||||
q_snprintf(user_dir, sizeof(user_dir), "%s/%s/%s", home_dir, system_dir, app_name);
|
||||
q_snprintf(user_dir, sizeof(user_dir), "%s/%s", system_dir, app_name);
|
||||
else
|
||||
{
|
||||
if(!(home_dir = Sys_GetHomeDir()))
|
||||
|
|
Loading…
Reference in New Issue