Various tweaks to documentation inside the codebase, more verbose general
information prints to console to aid non-devs in sending bug reports and finding other issues. Updates to some of the GLSL. Minor material fixes.
This commit is contained in:
parent
084414db40
commit
a687d7b330
35 changed files with 643 additions and 1101 deletions
|
@ -1,8 +1,9 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//======= Copyright (c) 2015-2022 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Blending terrain and masking its edges for a smooth transition into alpha.
|
||||
// Scrolling shader for patches that get blended on top of existing geometry
|
||||
// with vertex colors defining fading out
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//======= Copyright (c) 2015-2022 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Blending terrain and masking its edges for a smooth transition into alpha.
|
||||
// Alternate version of caustics that's practically inverted for subtract blends
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
|
|
|
@ -1,176 +1,172 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightmapped surface that will use its normalmap alpha for both specularity
|
||||
// as well as environment cube reflectivity.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu DELUXE
|
||||
!!samps diffuse normalmap lightmap deluxemap reflectcube
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipSpecular
|
||||
!!cvardf r_skipLightmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
|
||||
varying vec2 lm0;
|
||||
#ifdef LIGHTSTYLED
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void lightmapped_init(void)
|
||||
{
|
||||
lm0 = v_lmcoord;
|
||||
#ifdef LIGHTSTYLED
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
lightmapped_init();
|
||||
invsurface[0] = v_svector;
|
||||
invsurface[1] = v_tvector;
|
||||
invsurface[2] = v_normal;
|
||||
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
#if r_skipLightmap==0
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb
|
||||
#define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb
|
||||
#define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb
|
||||
#define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb
|
||||
#else
|
||||
#define LIGHTMAP texture2D(s_lightmap, lm0).rgb
|
||||
#endif
|
||||
#else
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP1 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP2 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP3 vec3(0.5,0.5,0.5)
|
||||
#else
|
||||
#define LIGHTMAP vec3(0.5,0.5,0.5)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb;
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb;
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb;
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb;
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
return lightmaps;
|
||||
}
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 lightmap_fragment(vec3 normal_f)
|
||||
{
|
||||
#ifndef DELUXE
|
||||
return lightmap_fragment();
|
||||
#else
|
||||
vec3 lightmaps;
|
||||
|
||||
#if defined(LIGHTSTYLED)
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb * dot(normal_f, (texture2D(s_deluxemap0, lm0).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb * dot(normal_f, (texture2D(s_deluxemap1, lm1).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb * dot(normal_f, (texture2D(s_deluxemap2, lm2).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb * dot(normal_f, (texture2D(s_deluxemap3, lm3).rgb - 0.5) * 2.0);
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb * dot(normal_f, (texture2D(s_deluxemap, lm0).rgb - 0.5) * 2.0);
|
||||
#endif
|
||||
|
||||
return lightmaps;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 cube_c;
|
||||
vec4 out_f = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
#if r_skipDiffuse==0
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
#define diffuse_f vec4(1.0, 1.0, 1.0, 1.0)
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==1
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,0.5)
|
||||
#endif
|
||||
|
||||
float gloss = texture2D(s_normalmap, tex_c).a;
|
||||
float spec;
|
||||
|
||||
vec3 halfdir = normalize(normalize(eyevector) - e_light_dir);
|
||||
spec = pow(max(dot(halfdir, normal_f), 0.0), FTE_SPECULAR_EXPONENT);
|
||||
spec *= (gloss * 0.1);
|
||||
|
||||
#if r_skipNormal==1
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#else
|
||||
diffuse_f.rgb *= lightmap_fragment(normal_f);
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
#if r_skipSpecular==0
|
||||
cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
out_f.rgb = mix(textureCube(s_reflectcube, cube_c).rgb, diffuse_f.rgb, gloss);
|
||||
#endif
|
||||
|
||||
out_f.rgb += spec;
|
||||
|
||||
gl_FragColor = fog4(out_f);
|
||||
}
|
||||
#endif
|
||||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightmapped surface that sticks to walls.
|
||||
//
|
||||
// diffusemap = albedo (rgba)
|
||||
// normalmap = normal (rgb), reflectmask (a)
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu DELUXE
|
||||
!!permu LIGHTSTYLED
|
||||
!!samps diffuse
|
||||
|
||||
!!samps lightmap
|
||||
!!samps =BUMP normalmap reflectcube
|
||||
!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3
|
||||
!!samps =DELUXE deluxemap
|
||||
!!samps =LIGHTSTYLED =DELUXE deluxemap1 deluxemap2 deluxemap3
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!cvardf r_fullbright
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
// basics
|
||||
varying vec2 tex_c;
|
||||
varying vec2 lm0;
|
||||
|
||||
// unfortunately we do support lightstyles
|
||||
#if defined(LIGHTSTYLED)
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
// useful for terrain blending
|
||||
varying vec4 vex_color;
|
||||
|
||||
// dynamic shadows
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef BUMP
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void lightmapped_init(void)
|
||||
{
|
||||
lm0 = v_lmcoord;
|
||||
#if defined(LIGHTSTYLED)
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
lightmapped_init();
|
||||
tex_c = v_texcoord;
|
||||
vex_color = v_colour;
|
||||
gl_Position = ftetransform();
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
|
||||
#ifdef BUMP
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
invsurface[0] = v_svector;
|
||||
invsurface[1] = v_tvector;
|
||||
invsurface[2] = v_normal;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
#if defined(LIGHTSTYLED)
|
||||
#define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb
|
||||
#define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb
|
||||
#define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb
|
||||
#define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb
|
||||
#else
|
||||
#define LIGHTMAP texture2D(s_lightmap, lm0).rgb
|
||||
#endif
|
||||
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#if defined(LIGHTSTYLED)
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb;
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb;
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb;
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb;
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
return (r_fullbright == 1) ? vec3(1.0, 1.0, 1.0) : lightmaps;
|
||||
}
|
||||
|
||||
vec3 lightmap_fragment(vec3 normal_f)
|
||||
{
|
||||
#ifndef DELUXE
|
||||
return lightmap_fragment();
|
||||
#else
|
||||
vec3 lightmaps;
|
||||
|
||||
#if defined(LIGHTSTYLED)
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb * dot(normal_f, (texture2D(s_deluxemap0, lm0).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb * dot(normal_f, (texture2D(s_deluxemap1, lm1).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb * dot(normal_f, (texture2D(s_deluxemap2, lm2).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb * dot(normal_f, (texture2D(s_deluxemap3, lm3).rgb - 0.5) * 2.0);
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb * dot(normal_f, (texture2D(s_deluxemap, lm0).rgb - 0.5) * 2.0);
|
||||
#endif
|
||||
|
||||
return (r_fullbright == 1) ? vec3(1.0, 1.0, 1.0) : lightmaps;
|
||||
#endif
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 diffuse_f;
|
||||
float alpha;
|
||||
|
||||
diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
diffuse_f.rgb *= diffuse_f.a;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
// the lighting stage for the world
|
||||
#if defined(BUMP)
|
||||
vec3 cube_c;
|
||||
vec3 env_f;
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
float refl = texture2D(s_normalmap, tex_c).a;
|
||||
diffuse_f.rgb *= lightmap_fragment(normal_f);
|
||||
|
||||
cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
env_f = textureCube(s_reflectcube, cube_c).rgb * (e_lmscale.rgb * 0.25);
|
||||
diffuse_f.rgb = mix(env_f, diffuse_f.rgb, refl);
|
||||
#else
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#endif
|
||||
|
||||
// start blend at half-way point
|
||||
alpha = diffuse_f.a;
|
||||
|
||||
if (alpha > 1.0)
|
||||
alpha = 1.0;
|
||||
|
||||
gl_FragColor = vec4(fog3(diffuse_f.rgb), alpha);
|
||||
}
|
||||
#endif
|
|
@ -87,18 +87,19 @@ varying mat3 invsurface;
|
|||
#else
|
||||
lightmaps = texture2D(s_lightmap, lm0).rgb * e_lmscale.rgb;
|
||||
#endif
|
||||
#if gl_ldr==1
|
||||
if (lightmaps.r > 1.5)
|
||||
lightmaps.r = 1.5f;
|
||||
if (lightmaps.g > 1.5)
|
||||
lightmaps.g = 1.5f;
|
||||
if (lightmaps.b > 1.5)
|
||||
lightmaps.b = 1.5f;
|
||||
if (gl_ldr == 1.0) {
|
||||
|
||||
lightmaps.rgb * 0.5f;
|
||||
lightmaps.rgb = floor(lightmaps.rgb * vec3(32,64,32))/vec3(32,64,32);
|
||||
lightmaps.rgb * 2.0f;
|
||||
#endif
|
||||
if (lightmaps.r > 1.5)
|
||||
lightmaps.r = 1.5f;
|
||||
if (lightmaps.g > 1.5)
|
||||
lightmaps.g = 1.5f;
|
||||
if (lightmaps.b > 1.5)
|
||||
lightmaps.b = 1.5f;
|
||||
|
||||
lightmaps.rgb * 0.5f;
|
||||
lightmaps.rgb = floor(lightmaps.rgb * vec3(32,64,32))/vec3(32,64,32);
|
||||
lightmaps.rgb * 2.0f;
|
||||
}
|
||||
|
||||
return lightmaps;
|
||||
}
|
||||
|
|
|
@ -3,46 +3,67 @@
|
|||
// Purpose:
|
||||
//
|
||||
// Lightmapped surface.
|
||||
//
|
||||
// diffusemap = albedo (rgba)
|
||||
// normalmap = normal (rgb), reflectmask (a)
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FOG
|
||||
|
||||
!!permu BUMP
|
||||
!!permu DELUXE
|
||||
!!permu LIGHTSTYLED
|
||||
!!samps diffuse normalmap
|
||||
!!permu FULLBRIGHT
|
||||
!!samps diffuse
|
||||
|
||||
!!samps lightmap
|
||||
!!samps =BUMP normalmap reflectcube
|
||||
!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3
|
||||
!!samps =DELUXE deluxemap
|
||||
!!samps =LIGHTSTYLED =DELUXE deluxemap1 deluxemap2 deluxemap3
|
||||
!!samps =FULLBRIGHT fullbright
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!cvardf r_fullbright
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
!!cvardf r_skipLightmap
|
||||
!!cvardf r_skipFullbright
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipEnvmap
|
||||
!!cvardf r_skipLightmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
// basics
|
||||
varying vec2 tex_c;
|
||||
|
||||
varying vec2 lm0;
|
||||
#ifdef LIGHTSTYLED
|
||||
|
||||
// unfortunately we do support lightstyles
|
||||
#if defined(LIGHTSTYLED)
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
// useful for terrain blending
|
||||
varying vec4 vex_color;
|
||||
|
||||
// dynamic shadows
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef BUMP
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void lightmapped_init(void)
|
||||
{
|
||||
lm0 = v_lmcoord;
|
||||
#ifdef LIGHTSTYLED
|
||||
#if defined(LIGHTSTYLED)
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
|
@ -53,11 +74,22 @@ varying vec2 lm1, lm2, lm3;
|
|||
{
|
||||
lightmapped_init();
|
||||
tex_c = v_texcoord;
|
||||
vex_color = v_colour;
|
||||
gl_Position = ftetransform();
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
|
||||
#ifdef BUMP
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
invsurface[0] = v_svector;
|
||||
invsurface[1] = v_tvector;
|
||||
invsurface[2] = v_normal;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -65,8 +97,7 @@ varying vec2 lm1, lm2, lm3;
|
|||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
#if r_skipLightmap==0
|
||||
#ifdef LIGHTSTYLED
|
||||
#if defined(LIGHTSTYLED)
|
||||
#define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb
|
||||
#define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb
|
||||
#define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb
|
||||
|
@ -74,22 +105,13 @@ varying vec2 lm1, lm2, lm3;
|
|||
#else
|
||||
#define LIGHTMAP texture2D(s_lightmap, lm0).rgb
|
||||
#endif
|
||||
#else
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP1 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP2 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP3 vec3(0.5,0.5,0.5)
|
||||
#else
|
||||
#define LIGHTMAP vec3(0.5,0.5,0.5)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if r_skipLightmap == 0
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
#if defined(LIGHTSTYLED)
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb;
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb;
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb;
|
||||
|
@ -97,10 +119,9 @@ varying vec2 lm1, lm2, lm3;
|
|||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
return lightmaps;
|
||||
return (r_fullbright == 1) ? vec3(1.0, 1.0, 1.0) : lightmaps;
|
||||
}
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 lightmap_fragment(vec3 normal_f)
|
||||
{
|
||||
#ifndef DELUXE
|
||||
|
@ -117,32 +138,81 @@ varying vec2 lm1, lm2, lm3;
|
|||
lightmaps = LIGHTMAP * e_lmscale.rgb * dot(normal_f, (texture2D(s_deluxemap, lm0).rgb - 0.5) * 2.0);
|
||||
#endif
|
||||
|
||||
return lightmaps;
|
||||
return (r_fullbright == 1) ? vec3(1.0, 1.0, 1.0) : lightmaps;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
return vec3(1.0,1.0,1.0);
|
||||
}
|
||||
vec3 lightmap_fragment(vec3 normal_f)
|
||||
{
|
||||
return vec3(1.0,1.0,1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 diffuse_f;
|
||||
float alpha;
|
||||
|
||||
#if r_skipDiffuse==0
|
||||
diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
diffuse_f = vec4(1.0,1.0,1.0,1.0);
|
||||
#endif
|
||||
#if r_skipDiffuse == 0
|
||||
diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
diffuse_f = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
#ifdef MASK
|
||||
// alpha-testing happens here
|
||||
if (vex_color.a >= 0.99)
|
||||
if (diffuse_f.a < MASK)
|
||||
discard;
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
diffuse_f.rgb *= lightmap_fragment(normal_f);
|
||||
#else
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#endif
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(diffuse_f);
|
||||
// the lighting stage for the world
|
||||
#if defined(BUMP)
|
||||
|
||||
// whether to respect our bump, or to act flat
|
||||
#if r_skipNormal == 0
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
diffuse_f.rgb *= lightmap_fragment(normal_f);
|
||||
#else
|
||||
vec3 normal_f = vec3(0.0, 0.0, 1.0);
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#endif
|
||||
|
||||
// environment mapping happens here
|
||||
#if r_skipEnvmap == 0
|
||||
vec3 cube_c;
|
||||
vec3 env_f;
|
||||
float refl = texture2D(s_normalmap, tex_c).a;
|
||||
cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] +
|
||||
cube_c.y * invsurface[1] +
|
||||
cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
env_f = textureCube(s_reflectcube, cube_c).rgb * (e_lmscale.rgb * 0.25);
|
||||
diffuse_f.rgb = mix(env_f, diffuse_f.rgb, refl);
|
||||
#endif
|
||||
#else
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#endif
|
||||
|
||||
#if defined(FULLBRIGHT) && r_skipFullbright == 0
|
||||
diffuse_f.rgb += texture2D(s_fullbright, tex_c).rgb;
|
||||
#endif
|
||||
|
||||
// start blend at half-way point
|
||||
alpha = vex_color.a * 1.5;
|
||||
|
||||
if (alpha > 1.0)
|
||||
alpha = 1.0;
|
||||
|
||||
gl_FragColor = vec4(fog3(diffuse_f.rgb), alpha);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,13 +10,15 @@
|
|||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu DELUXE
|
||||
!!samps diffuse lightmap deluxemap reflection
|
||||
!!samps diffuse lightmap deluxemap normalmap
|
||||
!!samps reflect=0
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipSpecular
|
||||
!!cvardf r_skipDiffuse
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipLightmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
@ -128,14 +130,22 @@ varying vec2 lm1, lm2, lm3;
|
|||
void main (void)
|
||||
{
|
||||
vec2 stc;
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
vec4 diffuse_f;
|
||||
|
||||
#if r_skipDiffuse == 0
|
||||
diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
diffuse_f = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==1
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,0.5)
|
||||
#else
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
#endif
|
||||
|
||||
float refl = texture2D(s_normalmap, tex_c).a;
|
||||
|
||||
#if r_skipNormal==1
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#else
|
||||
|
@ -146,8 +156,7 @@ varying vec2 lm1, lm2, lm3;
|
|||
stc = (1.0 + (tf.xy / tf.w)) * 0.5;
|
||||
stc.t -= 1.5* invsurface[2].z / 1080.0;
|
||||
|
||||
diffuse_f.rgb = mix(texture2D(s_reflection, stc).rgb, diffuse_f.rgb, diffuse_f.a);
|
||||
diffuse_f.a = 1.0;
|
||||
diffuse_f.rgb = mix(texture2D(s_reflect, stc).rgb, diffuse_f.rgb, refl);
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightmapped surface that contains an environment cube as a reflection.
|
||||
// Alpha channel of the diffuse decides reflectivity.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu DELUXE
|
||||
!!samps diffuse normalmap reflectcube lightmap deluxemap
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipSpecular
|
||||
!!cvardf r_skipLightmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
|
||||
varying vec2 lm0;
|
||||
#ifdef LIGHTSTYLED
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void lightmapped_init(void)
|
||||
{
|
||||
lm0 = v_lmcoord;
|
||||
#ifdef LIGHTSTYLED
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
lightmapped_init();
|
||||
invsurface[0] = v_svector;
|
||||
invsurface[1] = v_tvector;
|
||||
invsurface[2] = v_normal;
|
||||
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
#if r_skipLightmap==0
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb
|
||||
#define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb
|
||||
#define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb
|
||||
#define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb
|
||||
#else
|
||||
#define LIGHTMAP texture2D(s_lightmap, lm0).rgb
|
||||
#endif
|
||||
#else
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP1 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP2 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP3 vec3(0.5,0.5,0.5)
|
||||
#else
|
||||
#define LIGHTMAP vec3(0.5,0.5,0.5)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb;
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb;
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb;
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb;
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
return lightmaps;
|
||||
}
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 lightmap_fragment(vec3 normal_f)
|
||||
{
|
||||
#ifndef DELUXE
|
||||
return lightmap_fragment();
|
||||
#else
|
||||
vec3 lightmaps;
|
||||
|
||||
#if defined(LIGHTSTYLED)
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb * dot(normal_f, (texture2D(s_deluxemap0, lm0).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb * dot(normal_f, (texture2D(s_deluxemap1, lm1).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb * dot(normal_f, (texture2D(s_deluxemap2, lm2).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb * dot(normal_f, (texture2D(s_deluxemap3, lm3).rgb - 0.5) * 2.0);
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb * dot(normal_f, (texture2D(s_deluxemap, lm0).rgb - 0.5) * 2.0);
|
||||
#endif
|
||||
|
||||
return lightmaps;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 cube_c;
|
||||
vec3 env_f;
|
||||
|
||||
#if r_skipDiffuse==0
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
vec4 diffuse_f = vec4(1.0,1.0,1.0,1.0);
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
#define refl diffuse_f.a
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,1.0)
|
||||
#define refl (diffuse_f.a / 2.0) + 0.5
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==1
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#else
|
||||
diffuse_f.rgb *= lightmap_fragment(normal_f);
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
#if r_skipSpecular==0
|
||||
vec4 out_f = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
env_f = textureCube(s_reflectcube, cube_c).rgb * (e_lmscale.rgb * 0.25);
|
||||
out_f.rgb = mix(env_f, diffuse_f.rgb, refl);
|
||||
|
||||
// Add fog to the final fragment
|
||||
gl_FragColor = fog4(out_f);
|
||||
#else
|
||||
gl_FragColor = fog4(diffuse_f);;
|
||||
#endif
|
||||
}
|
||||
#endif
|
|
@ -1,167 +0,0 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightmapped surface with specular highlighting. It'll assume a base value
|
||||
// for specularity... this is if you want to save VRAM but really want a glow.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu DELUXE
|
||||
!!samps diffuse normalmap lightmap deluxemap
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipSpecular
|
||||
!!cvardf r_skipLightmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 eyevector;
|
||||
|
||||
varying vec2 lm0;
|
||||
#ifdef LIGHTSTYLED
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void lightmapped_init(void)
|
||||
{
|
||||
lm0 = v_lmcoord;
|
||||
#ifdef LIGHTSTYLED
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
lightmapped_init();
|
||||
tex_c = v_texcoord;
|
||||
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
|
||||
gl_Position = ftetransform();
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
#if r_skipLightmap==0
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb
|
||||
#define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb
|
||||
#define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb
|
||||
#define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb
|
||||
#else
|
||||
#define LIGHTMAP texture2D(s_lightmap, lm0).rgb
|
||||
#endif
|
||||
#else
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP1 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP2 vec3(0.5,0.5,0.5)
|
||||
#define LIGHTMAP3 vec3(0.5,0.5,0.5)
|
||||
#else
|
||||
#define LIGHTMAP vec3(0.5,0.5,0.5)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb;
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb;
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb;
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb;
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
return lightmaps;
|
||||
}
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 lightmap_fragment(vec3 normal_f)
|
||||
{
|
||||
#ifndef DELUXE
|
||||
return lightmap_fragment();
|
||||
#else
|
||||
vec3 lightmaps;
|
||||
|
||||
#if defined(LIGHTSTYLED)
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb * dot(normal_f, (texture2D(s_deluxemap0, lm0).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb * dot(normal_f, (texture2D(s_deluxemap1, lm1).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb * dot(normal_f, (texture2D(s_deluxemap2, lm2).rgb - 0.5) * 2.0);
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb * dot(normal_f, (texture2D(s_deluxemap3, lm3).rgb - 0.5) * 2.0);
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb * dot(normal_f, (texture2D(s_deluxemap, lm0).rgb - 0.5) * 2.0);
|
||||
#endif
|
||||
|
||||
return lightmaps;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void main (void)
|
||||
{
|
||||
float gloss = texture2D(s_normalmap, tex_c).a * 0.1;
|
||||
float spec;
|
||||
|
||||
#if r_skipDiffuse==0
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
#define diffuse_f vec4(1.0, 1.0, 1.0, 1.0)
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,0.5)
|
||||
#endif
|
||||
|
||||
if (diffuse_f.a < 0.5) {
|
||||
discard;
|
||||
}
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==1
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#else
|
||||
diffuse_f.rgb *= lightmap_fragment(normal_f);
|
||||
#endif
|
||||
|
||||
#if r_skipSpecular==0
|
||||
vec3 halfdir = normalize(normalize(eyevector) - e_light_dir);
|
||||
spec = pow(max(dot(halfdir, normal_f), 0.0), FTE_SPECULAR_EXPONENT);
|
||||
spec *= 0.05;
|
||||
diffuse_f.rgb += spec;
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(diffuse_f);
|
||||
}
|
||||
#endif
|
|
@ -5,6 +5,9 @@
|
|||
// Code for all the dynamic light passes. The renderer is not aware of any
|
||||
// surface properties beyond diffuse, normal and specularity.
|
||||
// Alpha-masked surfaces suffer greatly because of this.
|
||||
//
|
||||
// diffusemap = albedo (rgba)
|
||||
// normalmap = normal (rgb), reflectmask (a)
|
||||
//==============================================================================
|
||||
|
||||
!!ver 100 300
|
||||
|
@ -12,16 +15,13 @@
|
|||
!!permu FRAMEBLEND
|
||||
!!permu SKELETAL
|
||||
!!permu FOG
|
||||
!!permu REFLECTCUBEMASK
|
||||
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps diffuse normalmap specular reflectcube reflectmask
|
||||
!!samps diffuse
|
||||
!!samps =BUMP normalmap reflectcube
|
||||
!!samps =PCF shadowmap
|
||||
!!samps =CUBE projectionmap
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
!!cvardf r_skipNormal
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
//if there's no vertex normals known, disable some stuff.
|
||||
|
@ -40,11 +40,8 @@ varying vec3 lightvector;
|
|||
varying vec4 vc;
|
||||
#endif
|
||||
|
||||
#if defined(SPECULAR) || defined(REFLECTCUBEMASK)
|
||||
#ifdef BUMP
|
||||
varying vec3 eyevector;
|
||||
#endif
|
||||
|
||||
#ifdef REFLECTCUBEMASK
|
||||
varying mat3 invsurface;
|
||||
#endif
|
||||
|
||||
|
@ -84,14 +81,11 @@ varying vec3 lightvector;
|
|||
vc = v_colour;
|
||||
#endif
|
||||
|
||||
#if defined(SPECULAR) || defined(REFLECTCUBEMASK)
|
||||
#ifdef BUMP
|
||||
vec3 eyeminusvertex = e_eyepos - w.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, s.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, t.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, n.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef REFLECTCUBEMASK
|
||||
invsurface = mat3(v_svector, v_tvector, v_normal);
|
||||
#endif
|
||||
|
||||
|
@ -131,27 +125,12 @@ varying vec3 lightvector;
|
|||
#if defined(FLAT)
|
||||
vec4 bases = vec4(FLAT, FLAT, FLAT, 1.0);
|
||||
#else
|
||||
#if r_skipDiffuse==0
|
||||
vec4 bases = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
vec4 bases = vec4(0.5, 0.5, 0.5, 1.0);
|
||||
#endif
|
||||
vec4 bases = texture2D(s_diffuse, tex_c);
|
||||
#endif
|
||||
|
||||
#if defined(BUMP) || defined(SPECULAR) || defined(REFLECTCUBEMASK)
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5) * 2.0;
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,1.0)
|
||||
#endif
|
||||
#elif defined(REFLECTCUBEMASK)
|
||||
#define normal_f vec3(0.0,0.0,1.0)
|
||||
#endif
|
||||
|
||||
#ifdef SPECULAR
|
||||
vec4 specs = texture2D(s_specular, tex_c);
|
||||
#define gloss specs.a
|
||||
#define specrgb specs.rgb
|
||||
#ifdef BUMP
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5) * 2.0;
|
||||
float refl = 1.0 - texture2D(s_normalmap, tex_c).a;
|
||||
#endif
|
||||
|
||||
#ifdef NOBUMP
|
||||
|
@ -167,19 +146,12 @@ varying vec3 lightvector;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* take existing specular map into account to appoint a new glossy light */
|
||||
#ifdef SPECULAR
|
||||
vec3 halfdir = normalize(normalize(eyevector) + nl);
|
||||
float spec = pow(max(dot(halfdir, normal_f), 0.0), gloss);
|
||||
diff += l_lightcolourscale.z * spec * specrgb;
|
||||
#endif
|
||||
|
||||
/* respect the reflectcube surface */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
#ifdef BUMP
|
||||
vec3 rtc = reflect(-eyevector, normal_f);
|
||||
rtc = rtc.x * invsurface[0] + rtc.y * invsurface[1] + rtc.z * invsurface[2];
|
||||
rtc = (m_model * vec4(rtc.xyz,0.0)).xyz;
|
||||
diff += texture2D(s_reflectmask, tex_c).rgb * textureCube(s_reflectcube, rtc).rgb;
|
||||
diff += textureCube(s_reflectcube, rtc).rgb * refl;
|
||||
#endif
|
||||
|
||||
/* filter the colour by the cubemap projection */
|
||||
|
@ -187,13 +159,11 @@ varying vec3 lightvector;
|
|||
diff *= textureCube(s_projectionmap, vtexprojcoord.xyz).rgb;
|
||||
#endif
|
||||
|
||||
if (bases.a < 0.5)
|
||||
discard;
|
||||
|
||||
if (vc.a < 0.5)
|
||||
discard;
|
||||
diff.rgb *= bases.a;
|
||||
|
||||
diff *= colorscale * l_lightcolour;
|
||||
gl_FragColor = vec4(fog3additive(diff), 1.0);
|
||||
diff.rgb *= vc.a;
|
||||
|
||||
gl_FragColor = vec4(fog3additive(diff), vc.a);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,26 +2,33 @@
|
|||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightmapped surface of which the alpha channel decides the masking.
|
||||
// Blending terrain and masking its edges for a smooth transition into alpha.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu DELUXE
|
||||
!!samps diffuse normalmap lightmap deluxemap
|
||||
!!samps diffuse normalmap
|
||||
|
||||
!!samps lightmap
|
||||
!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3
|
||||
!!samps =DELUXE deluxemap
|
||||
!!samps =LIGHTSTYLED =DELUXE deluxemap1 deluxemap2 deluxemap3
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!cvardf r_fullbright
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipLightmap
|
||||
!!cvardf r_skipNormal
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec4 vex_color;
|
||||
|
||||
varying vec2 lm0;
|
||||
#ifdef LIGHTSTYLED
|
||||
|
@ -43,10 +50,12 @@ varying vec2 lm1, lm2, lm3;
|
|||
#endif
|
||||
}
|
||||
|
||||
void main ()
|
||||
void main ( void )
|
||||
{
|
||||
lightmapped_init();
|
||||
tex_c = v_texcoord;
|
||||
vex_color = v_colour;
|
||||
|
||||
gl_Position = ftetransform();
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
|
@ -91,7 +100,7 @@ varying vec2 lm1, lm2, lm3;
|
|||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
return lightmaps;
|
||||
return (r_fullbright == 1) ? vec3(1.0, 1.0, 1.0) : lightmaps;
|
||||
}
|
||||
|
||||
#if r_skipNormal==0
|
||||
|
@ -111,39 +120,47 @@ varying vec2 lm1, lm2, lm3;
|
|||
lightmaps = LIGHTMAP * e_lmscale.rgb * dot(normal_f, (texture2D(s_deluxemap, lm0).rgb - 0.5) * 2.0);
|
||||
#endif
|
||||
|
||||
return lightmaps;
|
||||
return (r_fullbright == 1) ? vec3(1.0, 1.0, 1.0) : lightmaps;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void main (void)
|
||||
void main ( void )
|
||||
{
|
||||
#if r_skipDiffuse==0
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
vec3 diffuse_f = texture2D(s_diffuse, tex_c).rgb;
|
||||
#else
|
||||
vec4 diffuse_f = vec4(1.0,1.0,1.0,1.0);
|
||||
vec3 diffuse_f = vec3(1.0,1.0,1.0);
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==1
|
||||
vec3 normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,1.0)
|
||||
float bw = 1.0 - (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0;
|
||||
vec4 vcol = vex_color;
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f;
|
||||
normal_f = normalize(texture2D(s_normalmap, tex_c).rgb - 0.5);
|
||||
#endif
|
||||
|
||||
if (diffuse_f.a < 0.5) {
|
||||
discard;
|
||||
if (vcol.a < 1.0) {
|
||||
// contrast enhancement
|
||||
#ifdef BWMASK
|
||||
bw *= ((bw * 2.0) * BWMASK);
|
||||
#endif
|
||||
if (bw > vcol.a) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
#if r_skipNormal==1
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#else
|
||||
#if r_skipNormal==0
|
||||
diffuse_f.rgb *= lightmap_fragment(normal_f);
|
||||
#else
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(diffuse_f);
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
gl_FragColor = vec4(fog3(diffuse_f), 1.0);
|
||||
}
|
||||
#endif
|
|
@ -2,27 +2,42 @@
|
|||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Basic lightgrid-lit surface. Also supports a fullbrightmap.
|
||||
// Lightgrid-lit surface, normalmap's alpha contains environment cube reflec-
|
||||
// tivity.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FRAMEBLEND
|
||||
!!permu BUMP
|
||||
!!permu FULLBRIGHT
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu SKELETAL
|
||||
!!samps diffuse fullbright normalmap
|
||||
!!samps diffuse
|
||||
!!samps =BUMP normalmap reflectcube
|
||||
!!samps =FULLBRIGHT fullbright
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
!!cvardf r_skipFullbright
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipEnvmap
|
||||
!!cvardf r_skipLightmap
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!cvardf r_fullbright
|
||||
!!cvardf r_lambertscale
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 norm;
|
||||
|
||||
#ifdef BUMP
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
@ -30,56 +45,103 @@ varying vec3 norm;
|
|||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
|
||||
void main (void)
|
||||
void main ()
|
||||
{
|
||||
vec3 n, s, t, w;
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
norm = n;
|
||||
|
||||
n = normalize(n);
|
||||
s = normalize(s);
|
||||
t = normalize(t);
|
||||
tex_c = v_texcoord;
|
||||
|
||||
#ifdef BUMP
|
||||
/* normalmap */
|
||||
invsurface = mat3(s, t, n);
|
||||
|
||||
/* reflect */
|
||||
vec3 eyeminusvertex = e_eyepos - w.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, s.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, t.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, n.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
#ifdef HALFLAMBERT
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
#else
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return max(dot(normal, dir), 0.0);
|
||||
}
|
||||
|
||||
float halflambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
#endif
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 diff_f = texture2D(s_diffuse, tex_c);
|
||||
vec4 fb_f = texture2D(s_fullbright, tex_c);
|
||||
vec4 diff_f;
|
||||
vec3 light;
|
||||
|
||||
if (diff_f.a < 0.5) {
|
||||
#if r_skipDiffuse == 0
|
||||
diff_f = texture2D(s_diffuse, tex_c);
|
||||
#else
|
||||
diff_f = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
#endif
|
||||
|
||||
// bump goes here
|
||||
#if defined(BUMP)
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f = (texture2D(s_normalmap, tex_c).rgb - 0.5) * 2.0;
|
||||
#else
|
||||
vec3 normal_f = vec3(0.0, 0.0, 1.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MASK
|
||||
if (diff_f.a < MASK) {
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HALFLAMBERT
|
||||
light = e_light_ambient + (e_light_mul * halflambert(norm, e_light_dir));
|
||||
#else
|
||||
light = e_light_ambient + (e_light_mul * lambert(norm, e_light_dir));
|
||||
#endif
|
||||
|
||||
diff_f.rgb *= light;
|
||||
diff_f.rgb += fb_f.rgb;
|
||||
#if defined(BUMP)
|
||||
/* directional light */
|
||||
light = (e_light_mul * lambert(normal_f, e_light_dir)) * 2.0f;
|
||||
/* reverse ambient */
|
||||
light += (e_light_ambient * lambert(normal_f, reflect(normal_f, e_light_dir))) * 0.5f;
|
||||
#else
|
||||
light = (e_light_mul * lambert(norm, e_light_dir)) * 2.0f;
|
||||
light += (e_light_ambient * lambert(norm, reflect(norm, e_light_dir))) * 0.5f;
|
||||
light *= 2.0f;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diff_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
diff_f.rgb *= light;
|
||||
|
||||
#if defined(BUMP) && r_skipEnvmap==0
|
||||
vec3 cube_c;
|
||||
float refl = 1.0 - texture2D(s_normalmap, tex_c).a;
|
||||
cube_c = reflect(normalize(eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
diff_f.rgb += textureCube(s_reflectcube, cube_c).rgb * refl;
|
||||
#endif
|
||||
|
||||
#if defined(FULLBRIGHT) && r_skipFullbright==0
|
||||
diff_f.rgb += texture2D(s_fullbright, tex_c).rgb;
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(diff_f * e_colourident) * e_lmscale;
|
||||
}
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightgrid-lit surface, normalmap's alpha contains environment cube reflec-
|
||||
// tivity.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FRAMEBLEND
|
||||
!!permu FOG
|
||||
!!permu SKELETAL
|
||||
!!samps diffuse reflectcube normalmap
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipSpecular
|
||||
!!cvardf r_skipNormal
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 eyevector;
|
||||
varying vec3 norm;
|
||||
varying mat3 invsurface;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
norm = n;
|
||||
n = normalize(n);
|
||||
s = normalize(s);
|
||||
t = normalize(t);
|
||||
tex_c = v_texcoord;
|
||||
|
||||
/* normalmap */
|
||||
invsurface = mat3(s, t, n);
|
||||
|
||||
/* reflect */
|
||||
vec3 eyeminusvertex = e_eyepos - w.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, s.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, t.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, n.xyz);
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return max(dot(normal, dir), 0.0);
|
||||
}
|
||||
|
||||
float halflambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 cube_c;
|
||||
vec4 out_f = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
vec4 diff_f = texture2D(s_diffuse, tex_c);
|
||||
vec3 light;
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f = (texture2D(s_normalmap, tex_c).rgb - 0.5) * 2.0;
|
||||
float refl = texture2D(s_normalmap, tex_c).a;
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,1.0)
|
||||
float refl = texture2D(s_normalmap, tex_c).a;
|
||||
#endif
|
||||
|
||||
if (diff_f.a < 0.5) {
|
||||
discard;
|
||||
}
|
||||
|
||||
#ifdef HALFLAMBERT
|
||||
light = e_light_ambient + (e_light_mul * halflambert(norm, e_light_dir));
|
||||
#else
|
||||
light = e_light_ambient + (e_light_mul * lambert(norm, e_light_dir));
|
||||
#endif
|
||||
|
||||
#if r_skipSpecular==0
|
||||
cube_c = reflect(normalize(eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
diff_f.rgb = mix(textureCube(s_reflectcube, cube_c).rgb, diff_f.rgb, diff_f.a);
|
||||
#endif
|
||||
|
||||
diff_f.rgb *= light;
|
||||
out_f.rgb = mix(textureCube(s_reflectcube, cube_c).rgb, diff_f.rgb, refl);
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
out_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(out_f * e_colourident) * e_lmscale;
|
||||
}
|
||||
#endif
|
|
@ -89,15 +89,17 @@ varying mat3 invsurface;
|
|||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
#ifdef HALFLAMBERT
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
#else
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return max(dot(normal, dir), 0.0);
|
||||
}
|
||||
|
||||
float halflambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
#endif
|
||||
|
||||
void main ()
|
||||
{
|
||||
|
@ -122,11 +124,9 @@ varying mat3 invsurface;
|
|||
discard;
|
||||
}
|
||||
|
||||
#ifdef HALFLAMBERT
|
||||
light = e_light_ambient + (e_light_mul * halflambert(norm, e_light_dir));
|
||||
#else
|
||||
light = e_light_ambient + (e_light_mul * lambert(norm, e_light_dir));
|
||||
#endif
|
||||
light += (e_light_mul * lambert(norm, e_light_dir)) * 2.0f; /* directional light */
|
||||
light += (e_light_ambient * lambert(norm, reflect(norm, e_light_dir))) * 0.5f; /* reverse ambient */
|
||||
light *= 2.0f;
|
||||
|
||||
#if r_skipSpecular==0
|
||||
vec3 halfdir = normalize(normalize(eyevector) + e_light_dir);
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightgrid-lit surface that contains environment cube reflectivity in the
|
||||
// diffusemaps' alpha channel and specularity in the normalmaps' alpha channel.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FRAMEBLEND
|
||||
!!permu FOG
|
||||
!!permu SKELETAL
|
||||
!!cvarf gl_specular
|
||||
!!samps diffuse normalmap reflectcube
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipSpecular
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 eyevector;
|
||||
varying vec3 norm;
|
||||
varying mat3 invsurface;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
void main ()
|
||||
{
|
||||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
norm = n;
|
||||
n = normalize(n);
|
||||
s = normalize(s);
|
||||
t = normalize(t);
|
||||
tex_c = v_texcoord;
|
||||
|
||||
/* normalmap */
|
||||
invsurface = mat3(s, t, n);
|
||||
|
||||
/* reflect */
|
||||
eyevector = e_eyepos - w.xyz;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return max(dot(normal, dir), 0.0);
|
||||
}
|
||||
|
||||
float halflambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec3 cube_c;
|
||||
vec4 diffuse_f = texture2D( s_diffuse, tex_c );
|
||||
|
||||
vec3 new_e_light_dir = vec3(cos(e_time), sin(e_time), 0);
|
||||
vec3 light;
|
||||
|
||||
#if r_skipNormal==0
|
||||
vec3 normal_f = (texture2D(s_normalmap, tex_c).rgb - 0.5) * 2.0;
|
||||
float gloss = texture2D(s_normalmap, tex_c).a;
|
||||
#else
|
||||
#define normal_f vec3(0.0,0.0,1.0)
|
||||
float gloss = texture2D(s_normalmap, tex_c).a;
|
||||
#endif
|
||||
|
||||
#ifdef HALFLAMBERT
|
||||
light = e_light_ambient + (e_light_mul * halflambert(norm, e_light_dir));
|
||||
#else
|
||||
light = e_light_ambient + (e_light_mul * lambert(norm, e_light_dir));
|
||||
#endif
|
||||
|
||||
#if r_skipSpecular==0
|
||||
vec3 halfdir = normalize(normalize(eyevector) + e_light_dir);
|
||||
vec3 bumps = normalize(invsurface * (normal_f));
|
||||
float spec = pow(max(dot(halfdir, bumps), 0.0), FTE_SPECULAR_EXPONENT);
|
||||
spec *= 5.0 * (1.0 - gloss);
|
||||
diffuse_f.rgb += spec * diffuse_f.a;
|
||||
#endif
|
||||
|
||||
/* reflectcube */
|
||||
cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
diffuse_f.rgb = mix(textureCube(s_reflectcube, cube_c).rgb, diffuse_f.rgb, diffuse_f.a);
|
||||
diffuse_f.rgb *= light;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4( diffuse_f * e_colourident ) * e_lmscale;
|
||||
}
|
||||
#endif
|
|
@ -1,109 +0,0 @@
|
|||
//======= Copyright (c) 2015-2020 Vera Visions LLC. All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Lightgrid-lit surface, normalmap alpha contains specularity & reflectivity.
|
||||
//==============================================================================
|
||||
|
||||
!!ver 110
|
||||
!!permu FRAMEBLEND
|
||||
!!permu FOG
|
||||
!!permu SKELETAL
|
||||
!!cvarf gl_specular
|
||||
!!samps diffuse normalmap reflectcube
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
!!cvardf r_skipNormal
|
||||
!!cvardf r_skipSpecular
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 eyevector;
|
||||
varying vec3 norm;
|
||||
varying mat3 invsurface;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
void main ()
|
||||
{
|
||||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
norm = n;
|
||||
n = normalize(n);
|
||||
s = normalize(s);
|
||||
t = normalize(t);
|
||||
tex_c = v_texcoord;
|
||||
|
||||
/* normalmap */
|
||||
invsurface = mat3(s, t, n);
|
||||
|
||||
/* reflect */
|
||||
eyevector = e_eyepos - w.xyz;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return max(dot(normal, dir), 0.0);
|
||||
}
|
||||
|
||||
float halflambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec3 cube_c;
|
||||
vec4 diffuse_f = texture2D( s_diffuse, tex_c );
|
||||
vec3 normal_f = (texture2D(s_normalmap, tex_c).rgb - 0.5) * 2.0;
|
||||
float gloss = texture2D( s_normalmap, tex_c ).a;
|
||||
vec3 new_e_light_dir = vec3(cos(e_time), sin(e_time), 0);
|
||||
vec3 light;
|
||||
|
||||
#ifdef HALFLAMBERT
|
||||
light = e_light_ambient + (e_light_mul * halflambert(norm, e_light_dir));
|
||||
#else
|
||||
light = e_light_ambient + (e_light_mul * lambert(norm, e_light_dir));
|
||||
#endif
|
||||
|
||||
#if r_skipSpecular==0
|
||||
// gloss pass
|
||||
vec3 halfdir = normalize(normalize(eyevector) + e_light_dir);
|
||||
vec3 bumps = normalize(invsurface * (normal_f));
|
||||
float spec = pow(max(dot(halfdir, bumps), 0.0), FTE_SPECULAR_EXPONENT);
|
||||
spec *= 5.0 * (1.0 - gloss);
|
||||
diffuse_f.rgb += spec;
|
||||
// envmap pass
|
||||
cube_c = reflect(normalize(-eyevector), normal_f.rgb * 0.5);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
diffuse_f.rgb = mix(textureCube(s_reflectcube, cube_c).rgb, diffuse_f.rgb, gloss);
|
||||
#endif
|
||||
|
||||
diffuse_f.rgb *= light;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4( diffuse_f * e_colourident ) * e_lmscale;
|
||||
}
|
||||
#endif
|
|
@ -1,13 +1,11 @@
|
|||
// Vera Visions Material
|
||||
{
|
||||
surfaceparm metal
|
||||
|
||||
diffusemap textures/sfx/alpha.tga
|
||||
polygonOffset 1
|
||||
diffusemap "textures/sfx/mirror.tga"
|
||||
normalmap "textures/sfx/mirror_n.tga"
|
||||
|
||||
{
|
||||
program lightmapped_reflectcube
|
||||
map $diffuse
|
||||
map $normalmap
|
||||
map $reflectcube
|
||||
program lightmapped_reflect
|
||||
map $reflection
|
||||
}
|
||||
}
|
||||
|
|
BIN
platform/base_textures.pk3dir/textures/sfx/mirror_n.tga
Normal file
BIN
platform/base_textures.pk3dir/textures/sfx/mirror_n.tga
Normal file
Binary file not shown.
|
@ -1,12 +1,7 @@
|
|||
// Vera Visions Material
|
||||
{
|
||||
program lightmapped
|
||||
polygonOffset 1
|
||||
diffusemap "textures/sfx/alpha.tga"
|
||||
|
||||
{
|
||||
program lightmapped_reflectcube
|
||||
map $diffuse
|
||||
map $normalmap
|
||||
map $reflectcube
|
||||
}
|
||||
normalmap "textures/sfx/mirror_n.tga"
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
surfaceParm nonsolid
|
||||
surfaceParm trans
|
||||
surfaceParm nodlight
|
||||
surfaceParm noshadows
|
||||
|
||||
diffusemap textures/decals/puddle01.tga
|
||||
normalmap textures/liquid/water1_n.tga
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
surfaceparm trans
|
||||
|
||||
if $programs
|
||||
program lightmapped_alphatest
|
||||
program lightmapped
|
||||
diffusemap "textures/measure/ladder.tga"
|
||||
else
|
||||
{
|
||||
map "textures/measure/ladder.tga"
|
||||
alphaFunc GE128
|
||||
{
|
||||
map "textures/measure/ladder.tga"
|
||||
alphaFunc GE128
|
||||
depthWrite
|
||||
rgbGen identity
|
||||
}
|
||||
{
|
||||
}
|
||||
{
|
||||
map $lightmap
|
||||
rgbGen identity
|
||||
blendFunc filter
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Vera Visions Material
|
||||
{
|
||||
program lightmapped_alphatest
|
||||
program lightmapped
|
||||
diffusemap textures/measure/rail.tga
|
||||
}
|
||||
|
|
|
@ -331,10 +331,12 @@ EFX_Init(void)
|
|||
int efx_default;
|
||||
int efx_underwater;
|
||||
|
||||
print("--------- Initializing EFXDefs ----------\n");
|
||||
|
||||
#ifndef EFXDATA_DYNAMIC
|
||||
g_efx = (reverbinfo_t *)memalloc(sizeof(reverbinfo_t) * EFXDATA_MAX);
|
||||
g_efx_name = (string *)memalloc(sizeof(string) * EFXDATA_MAX);
|
||||
print(sprintf("EFX_Init: Allocated %d bytes\n", (sizeof(string) * EFXDATA_MAX) + (sizeof(reverbinfo_t) * EFXDATA_MAX)));
|
||||
print(sprintf("allocated %d bytes for EFXDefs.\n", (sizeof(string) * EFXDATA_MAX) + (sizeof(reverbinfo_t) * EFXDATA_MAX)));
|
||||
#endif
|
||||
|
||||
efx_default = EFX_Load("default");
|
||||
|
|
|
@ -14,6 +14,15 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_UpdateSeat
|
||||
|
||||
Updates our seat pointers, call this when you need to verify we're
|
||||
getting the current player's info and not someone elses on the same
|
||||
machine (splitscreen)
|
||||
=================
|
||||
*/
|
||||
void
|
||||
CSQC_UpdateSeat(void)
|
||||
{
|
||||
|
@ -22,11 +31,18 @@ CSQC_UpdateSeat(void)
|
|||
pSeatLocal = &g_seatslocal[s];
|
||||
}
|
||||
|
||||
/* This file houses all of the callbacks and entry points the engine
|
||||
calls by itself */
|
||||
/*
|
||||
=================
|
||||
CSQC_Init
|
||||
|
||||
First thing inited in the progs. Before any world is initialized.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
CSQC_Init(float apilevel, string enginename, float engineversion)
|
||||
{
|
||||
print("--------- Initializing Client Game ----------\n");
|
||||
|
||||
pSeat = &g_seats[0];
|
||||
pSeatLocal = &g_seatslocal[0];
|
||||
|
||||
|
@ -113,12 +129,23 @@ CSQC_Init(float apilevel, string enginename, float engineversion)
|
|||
cvar_set("_menu_singleplayer", "1");
|
||||
else
|
||||
cvar_set("_menu_singleplayer", "0");
|
||||
|
||||
/* end msg */
|
||||
print("Client game initialized.\n");
|
||||
}
|
||||
|
||||
/* Rendering Caches */
|
||||
/*
|
||||
=================
|
||||
CSQC_RendererRestarted
|
||||
|
||||
Called by vid_reload callbacks
|
||||
=================
|
||||
*/
|
||||
void
|
||||
CSQC_RendererRestarted(string rstr)
|
||||
{
|
||||
print("--------- Reloading Graphical Resources ----------\n");
|
||||
|
||||
/* Fonts */
|
||||
Font_Load("fonts/font16.font", FONT_16);
|
||||
Font_Load("fonts/font20.font", FONT_20);
|
||||
|
@ -146,6 +173,9 @@ CSQC_RendererRestarted(string rstr)
|
|||
Sky_Update(TRUE);
|
||||
Entities_RendererRestarted();
|
||||
DetailTex_Init();
|
||||
|
||||
/* end msg */
|
||||
print("Graphical resources reloaded.\n");
|
||||
}
|
||||
|
||||
/* this is so that profile_csqc reports more accurate statistics as to
|
||||
|
@ -156,6 +186,13 @@ CSQC_RenderScene(void)
|
|||
renderscene();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_UpdateView
|
||||
|
||||
Run every single frame we're connected to a session.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
CSQC_UpdateView(float w, float h, float focus)
|
||||
{
|
||||
|
@ -211,19 +248,22 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
pSeat = &g_seats[s];
|
||||
pSeatLocal = &g_seatslocal[s];
|
||||
|
||||
/* set up our single/split viewport */
|
||||
View_CalcViewport(s, w, h);
|
||||
setproperty(VF_ACTIVESEAT, (float)s);
|
||||
|
||||
setproperty(VF_MIN, video_mins);
|
||||
setproperty(VF_SIZE, video_res);
|
||||
|
||||
pSeat->m_ePlayer = self = findfloat(world, entnum, player_localentnum);
|
||||
pl = (player)self;
|
||||
|
||||
/* player slot not present */
|
||||
if (!self) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* this needs to be moved into a base_client method */
|
||||
#if 1
|
||||
if (self.classname == "player") {
|
||||
Predict_PlayerPreFrame(pl);
|
||||
|
||||
|
@ -274,9 +314,12 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
pSeat->m_vecPredictedVelocity = spec.velocity;
|
||||
pSeat->m_flPredictedFlags = spec.flags;
|
||||
}
|
||||
#endif
|
||||
|
||||
addentities(MASK_ENGINE);
|
||||
|
||||
/* ideally move this into a base_player method */
|
||||
#if 1
|
||||
if (pSeat->m_flCameraTime > time || pSeat->m_flCameraTime == -1) {
|
||||
view_angles = pSeat->m_vecCameraAngle;
|
||||
setproperty(VF_ORIGIN, pSeat->m_vecCameraOrigin);
|
||||
|
@ -346,6 +389,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
setproperty(VF_CL_VIEWANGLES, view_angles);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
setproperty(VF_DRAWWORLD, 1);
|
||||
SkyCamera_Setup(getproperty(VF_ORIGIN));
|
||||
|
@ -365,6 +409,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
View_DrawViewModel();
|
||||
}
|
||||
|
||||
/* this is running whenever we're doing 'buildcubemaps' */
|
||||
if (g_iCubeProcess == TRUE) {
|
||||
setproperty(VF_ORIGIN, g_vecCubePos);
|
||||
setproperty(VF_SIZE_X, g_dCubeSize);
|
||||
|
@ -373,9 +418,11 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
setproperty(VF_AFOV, 90);
|
||||
}
|
||||
|
||||
/* render the scene, then put monitor RenderTargets on top */
|
||||
CSQC_RenderScene();
|
||||
RenderTarget_Monitor_Update();
|
||||
|
||||
/* all 2D operations happen after this point */
|
||||
for (entity b = world; (b = findfloat(b, ::isCSQC, 1));) {
|
||||
NSEntity pf = (NSEntity) b;
|
||||
pf.postdraw();
|
||||
|
@ -409,18 +456,24 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
}
|
||||
}
|
||||
|
||||
/* move this into base_client methods */
|
||||
#if 1
|
||||
if (self.classname == "player")
|
||||
Predict_PlayerPostFrame((player)self);
|
||||
else if (self.classname == "spectator")
|
||||
Predict_SpectatorPostFrame((spectator)self);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* this sucks and doesn't take seats into account */
|
||||
EFX_UpdateListener();
|
||||
DSP_UpdateSoundscape();
|
||||
|
||||
/* draw AL debug info (no regard for seating */
|
||||
if (autocvar_s_al_debug)
|
||||
EFX_DebugInfo();
|
||||
|
||||
/* make sure we're not running these on invalid seats post frame */
|
||||
pSeat = __NULL__;
|
||||
pSeatLocal = __NULL__;
|
||||
}
|
||||
|
@ -1010,6 +1063,7 @@ Whenever the world is fully initialized...
|
|||
void
|
||||
CSQC_WorldLoaded(void)
|
||||
{
|
||||
print("--------- Initializing Client World ----------\n");
|
||||
DetailTex_Init();
|
||||
|
||||
/* Primarily for the flashlight */
|
||||
|
@ -1029,13 +1083,15 @@ CSQC_WorldLoaded(void)
|
|||
}
|
||||
if (strTokenized != "{") {
|
||||
print("^1[WARNING] ^7Bad entity data\n");
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (!Entities_ParseLump()) {
|
||||
print("^1[WARNING] ^7Bad entity data\n");
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print("Client world initialized.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1066,10 +1122,12 @@ Incase you need to free something
|
|||
void
|
||||
CSQC_Shutdown(void)
|
||||
{
|
||||
print("--------- Shutting Client Game ----------\n");
|
||||
Decal_Shutdown();
|
||||
Sentences_Shutdown();
|
||||
Titles_Shutdown();
|
||||
Sound_Shutdown();
|
||||
PropData_Shutdown();
|
||||
EFX_Shutdown();
|
||||
print("Client game shutdown.\n");
|
||||
}
|
||||
|
|
|
@ -95,12 +95,14 @@ Sentences_Init(void)
|
|||
string temp;
|
||||
int c, i;
|
||||
|
||||
print("--------- Initializing SentencesDef (CLIENT) ----------\n");
|
||||
|
||||
Sentences_Shutdown();
|
||||
|
||||
fs_sentences = fopen("sound/sentences.txt", FILE_READ);
|
||||
|
||||
if (fs_sentences < 0) {
|
||||
print("^1WARNING: ^7Could NOT load sound/sentences.txt\n");
|
||||
print("^1could not load sound/sentences.txt\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -126,7 +128,7 @@ Sentences_Init(void)
|
|||
g_sentences_count);
|
||||
#else
|
||||
if (g_sentences_count + 1 >= SENTENCES_LIMIT) {
|
||||
print("^1WARNING: ^7Reached limit of max sentences!\n");
|
||||
print("^1reached limit of max sentences!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -152,6 +154,7 @@ Sentences_Init(void)
|
|||
}
|
||||
|
||||
fclose(fs_sentences);
|
||||
print(sprintf("SentencesDef initialized with %i entries.\n", g_sentences_count));
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -86,12 +86,14 @@ Titles_Init(void)
|
|||
int braced;
|
||||
int id = 0;
|
||||
|
||||
print("--------- Initializing TitlesDef ----------\n");
|
||||
|
||||
Titles_Shutdown();
|
||||
|
||||
fs_titles = fopen("titles.txt", FILE_READ);
|
||||
|
||||
if (fs_titles < 0) {
|
||||
print("^1WARNING: ^7Could NOT load titles.txt\n");
|
||||
print("^1could NOT load titles.txt\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -128,7 +130,7 @@ Titles_Init(void)
|
|||
}
|
||||
}
|
||||
|
||||
dprint(sprintf("^2Titles_Init^7: found %i titles\n", g_titles_count));
|
||||
print(sprintf("read %i titleDefs (%i bytes).\n", g_titles_count, sizeof(titles_t) * g_titles_count));
|
||||
g_titles = memalloc(sizeof(titles_t) * g_titles_count);
|
||||
fseek(fs_titles, 0);
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ light_dynamic::ReceiveEntity(float flNew, float flFlags)
|
|||
void
|
||||
light_dynamic::RendererRestarted(void)
|
||||
{
|
||||
#if 0
|
||||
float p = dynamiclight_spawnstatic(origin, m_flDistance, m_vecLight / 255);
|
||||
dynamiclight_set(p, LFIELD_ANGLES, angles);
|
||||
|
||||
|
@ -167,6 +168,7 @@ light_dynamic::RendererRestarted(void)
|
|||
dynamiclight_set(p, LFIELD_STYLE, m_flStyle);
|
||||
if (m_strPattern)
|
||||
dynamiclight_set(p, LFIELD_STYLESTRING, m_strPattern);
|
||||
#endif
|
||||
}
|
||||
void
|
||||
light_dynamic::Initialized(void)
|
||||
|
|
|
@ -270,7 +270,7 @@ The 'self' global does not refer to anything.
|
|||
void
|
||||
SetNewParms(void)
|
||||
{
|
||||
iprint("Setting New Level Parameters");
|
||||
print("--------- Setting New Level Parameters ----------\n");
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.LevelNewParms();
|
||||
|
@ -291,7 +291,7 @@ allocated for every client.
|
|||
void
|
||||
SetChangeParms(void)
|
||||
{
|
||||
iprint("Setting Level-Change Parameters");
|
||||
print("--------- Setting Level-Change Parameters ----------\n");
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.LevelChangeParms((base_player)self);
|
||||
|
@ -385,7 +385,7 @@ Called when the QC module gets loaded. No entities exist yet.
|
|||
void
|
||||
init(float prevprogs)
|
||||
{
|
||||
iprint("Initializing Server-Module");
|
||||
print("--------- Initializing Server-Module ----------\n");
|
||||
Plugin_Init();
|
||||
PropData_Init();
|
||||
SurfData_Init();
|
||||
|
@ -402,7 +402,7 @@ method called at the beginning of them having spawned.
|
|||
void
|
||||
init_respawn(void)
|
||||
{
|
||||
iprint("Respawning Entities");
|
||||
print("--------- Respawning Server Entities ----------\n");
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.InitPostEnts();
|
||||
|
@ -425,7 +425,7 @@ initents
|
|||
void
|
||||
initents(void)
|
||||
{
|
||||
iprint("Initializing Entities");
|
||||
print("--------- Initializing Server Entities ----------\n");
|
||||
|
||||
/* sound shader init */
|
||||
Sound_Init();
|
||||
|
@ -524,7 +524,7 @@ var int autocvar_sv_levelexec = 1;
|
|||
void
|
||||
worldspawn(void)
|
||||
{
|
||||
iprint("Initializing World");
|
||||
print("--------- Initializing World ----------\n");
|
||||
lightstyle(0, "m");
|
||||
lightstyle(1, "mmnmmommommnonmmonqnmmo");
|
||||
lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
|
||||
|
@ -664,6 +664,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
|
|||
float n;
|
||||
NSEntity loadent = __NULL__;
|
||||
|
||||
print("--------- Loading Existing Save ----------\n");
|
||||
|
||||
#ifdef REEDICT
|
||||
while ((e=nextent(e))) {
|
||||
|
@ -733,6 +734,8 @@ SV_PerformSave(float fh, float entcount, float playerslots)
|
|||
float i = 0;
|
||||
entity e;
|
||||
|
||||
print("--------- Performing Save ----------\n");
|
||||
|
||||
for (i = 0; i < entcount; i++) {
|
||||
NSEntity willsave;
|
||||
e = edict_num(i);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
/* FIXME: world.... sigh, we should box this into a worldspawn class */
|
||||
.string materials_file;
|
||||
|
||||
var int g_hlmaterial_entries;
|
||||
|
||||
float
|
||||
HLMaterials_Fetch(string tex_name)
|
||||
{
|
||||
|
@ -33,13 +35,14 @@ HLMaterials_Load(string filename)
|
|||
|
||||
fileMaterial = fopen(filename, FILE_READ);
|
||||
if (fileMaterial >= 0) {
|
||||
print(strcat("^2HLMaterials_Load: loading ", filename,"!\n"));
|
||||
print(strcat("parsing material definitions from ", filename,"\n"));
|
||||
while ((sTemp = fgets(fileMaterial))) {
|
||||
/* tokenize and just parse this stuff in */
|
||||
if (tokenize_console(sTemp) == 2) {
|
||||
mat_type = strtoupper(argv(0));
|
||||
tex_name = Materials_FixName(strtolower(argv(1)));
|
||||
hash_add(hashMaterials, tex_name, str2chr(mat_type, 0));
|
||||
g_hlmaterial_entries++;
|
||||
}
|
||||
}
|
||||
fclose(fileMaterial);
|
||||
|
@ -51,6 +54,9 @@ HLMaterials_Load(string filename)
|
|||
void
|
||||
HLMaterials_Init(void)
|
||||
{
|
||||
print("--------- Initializing HLMaterials ----------\n");
|
||||
|
||||
g_hlmaterial_entries = 0;
|
||||
hashMaterials = __NULL__;
|
||||
hashMaterials = hash_createtab(2, HASH_ADD);
|
||||
|
||||
|
@ -72,6 +78,8 @@ HLMaterials_Init(void)
|
|||
/* the way TW did it back in '03 */
|
||||
HLMaterials_Load(sprintf("maps/%s.mat", mapname));
|
||||
|
||||
/* Trinity does it this way */
|
||||
/* Trinity-Renderer does it this way */
|
||||
HLMaterials_Load(sprintf("maps/%s_materials.txt", mapname));
|
||||
|
||||
print(sprintf("HLMaterials initiailized with %i entries.\n", g_hlmaterial_entries));
|
||||
}
|
||||
|
|
|
@ -28,13 +28,16 @@ Mapcycle_Init(void)
|
|||
|
||||
if (!autocvar_mapcycle_enabled)
|
||||
return;
|
||||
|
||||
print("--------- Initializing MapCycle ----------\n");
|
||||
|
||||
/*if (Rules_IsMultiplayer())
|
||||
return;*/
|
||||
|
||||
fs_mapcycle = fopen(autocvar_mapcycle_file, FILE_READ);
|
||||
|
||||
if (fs_mapcycle < 0) {
|
||||
print(strcat("^1WARNING: ^7Could NOT load ", autocvar_mapcycle_file, "\n"));
|
||||
print(strcat("^1could not load ", autocvar_mapcycle_file, "\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -61,4 +64,6 @@ Mapcycle_Init(void)
|
|||
|
||||
/* the current map in the list will decide the nextmap */
|
||||
readcmd(sprintf("alias nextmap m%i\n", map_next));
|
||||
|
||||
print(sprintf("mapcycle initialized with %i entries.\n", mapcount));
|
||||
}
|
||||
|
|
|
@ -146,23 +146,10 @@ Node_AutoLink(node_t *new)
|
|||
}
|
||||
}
|
||||
|
||||
/* generate node tree, used for AI movement/navigation */
|
||||
void
|
||||
Nodes_Init(void)
|
||||
Nodes_BuildFromEnts(void)
|
||||
{
|
||||
iprint("Initializing Nodes-Subsystem");
|
||||
g_nodes_present = FALSE;
|
||||
|
||||
/* skip if present. TODO: check if they're out of date? */
|
||||
if (whichpack(sprintf("data/%s.way", mapname))) {
|
||||
g_nodes_present = TRUE;
|
||||
#ifdef NODE_DEBUG
|
||||
Nodes_Load(sprintf("%s.way", mapname));
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
dprint("[^2NODES^7] Rebuilding node tree...");
|
||||
print("rebuilding node tree...");
|
||||
|
||||
/* run through the ents and rebuild the tree */
|
||||
for (entity a = world; (a = find(a, ::classname, "info_node"));) {
|
||||
|
@ -187,11 +174,33 @@ Nodes_Init(void)
|
|||
Node_AutoLink(n);
|
||||
}
|
||||
|
||||
dprint(" ^2DONE\n");
|
||||
dprint(sprintf("[^2NODES^7] %i nodes found.\n", g_iNodes));
|
||||
print(sprintf("%i possible nodes found in %s\n", g_iNodes, mapname));
|
||||
|
||||
if (g_iNodes)
|
||||
if (g_iNodes) {
|
||||
print(sprintf("saving nodes nodes for %s\n", mapname));
|
||||
Nodes_Save(sprintf("%s.way", mapname));
|
||||
} else {
|
||||
print(sprintf("no node data found for %s\n", mapname));
|
||||
}
|
||||
}
|
||||
|
||||
/* generate node tree, used for AI movement/navigation */
|
||||
void
|
||||
Nodes_Init(void)
|
||||
{
|
||||
print("--------- Initializing Nodes Subsystem ----------\n");
|
||||
g_nodes_present = FALSE;
|
||||
|
||||
/* skip if present. TODO: check if they're out of date? */
|
||||
if (whichpack(sprintf("data/%s.way", mapname))) {
|
||||
g_nodes_present = TRUE;
|
||||
#ifdef NODE_DEBUG
|
||||
print(sprintf("loading existing nodes for %s\n", mapname));
|
||||
Nodes_Load(sprintf("%s.way", mapname));
|
||||
#endif
|
||||
} else {
|
||||
Nodes_BuildFromEnts();
|
||||
}
|
||||
|
||||
/* we don't need these any longer */
|
||||
#ifndef NODE_DEBUG
|
||||
|
@ -201,6 +210,8 @@ Nodes_Init(void)
|
|||
memfree(g_pNodes);
|
||||
g_iNodes = 0;
|
||||
#endif
|
||||
|
||||
print("Nodes subsystem initialized.\n");
|
||||
}
|
||||
|
||||
#ifdef NODE_DEBUG
|
||||
|
|
|
@ -31,7 +31,7 @@ Plugin_Init(void)
|
|||
int i;
|
||||
|
||||
if (autocvar_sv_plugins) {
|
||||
iprint("Initializing Plugins");
|
||||
print("--------- Initializing Plugins ----------\n");
|
||||
g_plugins_enabled = 1;
|
||||
} else {
|
||||
g_plugins_enabled = 0;
|
||||
|
@ -41,7 +41,7 @@ Plugin_Init(void)
|
|||
pdb = fopen("plugins.txt", FILE_READ);
|
||||
|
||||
if (pdb < 0) {
|
||||
print("^2Plugins^7: No plugins.txt found. Disabling.\n");
|
||||
print("^1no plugins.txt found.\n");
|
||||
g_plugins_enabled = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ Plugin_Init(void)
|
|||
}
|
||||
}
|
||||
|
||||
print(sprintf("^1Plugins^7: Initialized %i plugins\n", g_plugincount));
|
||||
print(sprintf("initialized %i plugins.\n", g_plugincount));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -30,7 +30,7 @@ Sentences_Init(void)
|
|||
string temp;
|
||||
int c;
|
||||
|
||||
iprint("Initializing Sentences-Subsystem");
|
||||
print("--------- Initializing SentencesDef (SERVER) ----------\n");
|
||||
|
||||
if (g_sentences_count > 0) {
|
||||
g_sentences_count = 0;
|
||||
|
@ -44,7 +44,7 @@ Sentences_Init(void)
|
|||
fs_sentences = fopen("sound/sentences.txt", FILE_READ);
|
||||
|
||||
if (fs_sentences < 0) {
|
||||
print("^1WARNING: ^7Could NOT load sound/sentences.txt\n");
|
||||
print("^1could not load sound/sentences.txt\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ Sentences_Init(void)
|
|||
g_sentences_count);
|
||||
#else
|
||||
if (g_sentences_count + 1 >= SENTENCES_LIMIT) {
|
||||
print("^1WARNING: ^7Reached limit of max sentences!\n");
|
||||
print("^1reached limit of max sentences!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ Sentences_Init(void)
|
|||
}
|
||||
|
||||
fclose(fs_sentences);
|
||||
print(sprintf("SentencesDef initialized with %i entries.\n", g_sentences_count));
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -145,13 +145,6 @@ dprint(string m)
|
|||
return prior(m);
|
||||
}
|
||||
|
||||
/* info print */
|
||||
void
|
||||
iprint(string m)
|
||||
{
|
||||
print(sprintf("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081 %s ^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082\n", m));
|
||||
}
|
||||
|
||||
void
|
||||
crossprint(string m)
|
||||
{
|
||||
|
|
|
@ -379,11 +379,16 @@ PropData_ParseLine(string line)
|
|||
void
|
||||
PropData_Init(void)
|
||||
{
|
||||
|
||||
filestream fh;
|
||||
string line;
|
||||
int index;
|
||||
|
||||
#ifdef SERVER
|
||||
print("--------- Initializing PropDefs (SERVER) ----------\n");
|
||||
#else
|
||||
print("--------- Initializing PropDefs (CLIENT) ----------\n");
|
||||
#endif
|
||||
|
||||
/* remove old data */
|
||||
PropData_Shutdown();
|
||||
|
||||
|
@ -415,8 +420,8 @@ PropData_Init(void)
|
|||
/* alocate our stuff */
|
||||
g_propdata = (propdata_t *)memalloc(sizeof(propdata_t) * PROPDATA_MAX);
|
||||
g_breakmodel = (breakmodel_t *)memalloc(sizeof(breakmodel_t) * PROPDATA_MAX);
|
||||
print(sprintf("PropData_Init: Allocated %d bytes for prop data\n", sizeof(propdata_t) * PROPDATA_MAX));
|
||||
print(sprintf("PropData_Init: Allocated %d bytes for breakmodels\n", sizeof(breakmodel_t) * PROPDATA_MAX));
|
||||
print(sprintf("allocated %d bytes for prop data.\n", sizeof(propdata_t) * PROPDATA_MAX));
|
||||
print(sprintf("allocated %d bytes for breakmodels.\n", sizeof(breakmodel_t) * PROPDATA_MAX));
|
||||
#endif
|
||||
|
||||
fseek(fh, 0);
|
||||
|
@ -426,6 +431,8 @@ PropData_Init(void)
|
|||
PropData_ParseLine(line);
|
||||
}
|
||||
fclose(fh);
|
||||
|
||||
print("PropData initialized.\n");
|
||||
}
|
||||
|
||||
/* we can only tokenize one thing at a time, so we save the type for the current
|
||||
|
|
|
@ -44,15 +44,23 @@ Sound_Shutdown(void)
|
|||
void
|
||||
Sound_Init(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
print("--------- Initializing SoundDef (SERVER) ----------\n");
|
||||
#else
|
||||
print("--------- Initializing SoundDef (CLIENT) ----------\n");
|
||||
#endif
|
||||
|
||||
/* make sure it's all reset */
|
||||
Sound_Shutdown();
|
||||
|
||||
#ifndef SOUNDSHADER_DYNAMIC
|
||||
g_sounds = (snd_t *)memalloc(sizeof(snd_t) * SOUNDSHADER_MAX);
|
||||
print(sprintf("Sound_Init: Allocated %d bytes\n", sizeof(snd_t) * SOUNDSHADER_MAX));
|
||||
print(sprintf("allocated %d bytes for soundDef\n", sizeof(snd_t) * SOUNDSHADER_MAX));
|
||||
#endif
|
||||
|
||||
precache_sound("misc/missing.wav");
|
||||
|
||||
print("SoundDef initialized.\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -313,9 +321,9 @@ Sound_Precache(string shader)
|
|||
fclose(fh);
|
||||
}
|
||||
|
||||
dprint("^1[SOUND] No shader found for ");
|
||||
dprint(shader);
|
||||
dprint("\n");
|
||||
print("^1no soundDef found for ");
|
||||
print(shader);
|
||||
print("\n");
|
||||
|
||||
search_end(sh);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue