GLSL: Some rendering tweaks (default gl_ldr and gl_halflambert (new) to 1)
This commit is contained in:
parent
2658e93683
commit
d35f7350fe
4 changed files with 63 additions and 26 deletions
|
@ -312,10 +312,9 @@ void CBaseMonster::Physics(void)
|
|||
}
|
||||
|
||||
/* support for think/nextthink */
|
||||
if (think && nextthink > 0.0) {
|
||||
if (think && nextthink > 0.0f) {
|
||||
if (nextthink < time) {
|
||||
nextthink = 0.0f;
|
||||
print("^2CBaseMonster::Physics: Trigger think()\n");
|
||||
think();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -517,10 +517,9 @@ CBaseNPC::Physics(void)
|
|||
}
|
||||
|
||||
/* support for think/nextthink */
|
||||
if (think && nextthink > 0.0) {
|
||||
if (think && nextthink > 0.0f) {
|
||||
if (nextthink < time) {
|
||||
nextthink = 0.0f;
|
||||
print("^2CBaseMonster::Physics: Trigger think()\n");
|
||||
think();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
!!permu FOG
|
||||
!!samps diffuse reflectcube
|
||||
!!cvardf gl_affinemodels=0
|
||||
!!cvardf gl_ldr=0
|
||||
!!cvardf gl_ldr=1
|
||||
!!cvardf gl_halflambert=1
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
|
@ -25,7 +26,10 @@ varying vec3 light;
|
|||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
|
||||
float hl( vec3 normal, vec3 dir ) {
|
||||
float lambert( vec3 normal, vec3 dir ) {
|
||||
return dot( normal, dir );
|
||||
}
|
||||
float halflambert( vec3 normal, vec3 dir ) {
|
||||
return ( dot( normal, dir ) * 0.5 ) + 0.5;
|
||||
}
|
||||
|
||||
|
@ -50,12 +54,15 @@ varying vec3 light;
|
|||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
tex_c = v_texcoord;
|
||||
light = e_light_ambient + (e_light_mul * hl(n, e_light_dir));
|
||||
|
||||
if (gl_halflambert == 1.0) {
|
||||
light = e_light_ambient + (e_light_mul * halflambert(n, e_light_dir));
|
||||
} else {
|
||||
light = e_light_ambient + (e_light_mul * lambert(n, e_light_dir));
|
||||
}
|
||||
|
||||
if (gl_ldr == 1.0) {
|
||||
if (light.r > 1.0) light.r = 1.0;
|
||||
if (light.g > 1.0) light.g = 1.0;
|
||||
if (light.b > 1.0) light.b = 1.0;
|
||||
light *= 0.75;
|
||||
}
|
||||
#ifdef CHROME
|
||||
vec3 rorg = rlv(vec3(0,0,0), w, e_light_dir);
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
!!ver 110
|
||||
!!samps diffuse lightmap reflectcube normalmap
|
||||
!!permu LIGHTSTYLED
|
||||
!!samps diffuse reflectcube normalmap
|
||||
|
||||
!!samps lightmap
|
||||
!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec2 lm_c;
|
||||
|
||||
varying vec2 lm0;
|
||||
#ifdef LIGHTSTYLED
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
#ifdef REFLECTCUBE
|
||||
varying vec3 eyevector;
|
||||
|
@ -12,10 +20,20 @@ varying mat3 invsurface;
|
|||
#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;
|
||||
lm_c = v_lmcoord;
|
||||
gl_Position = ftetransform();
|
||||
|
||||
#ifdef REFLECTCUBE
|
||||
|
@ -31,10 +49,34 @@ varying mat3 invsurface;
|
|||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
vec3 lightmap_fragment(void)
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
lightmaps = texture2D(s_lightmap0, lm0).rgb * e_lmscale[0].rgb;
|
||||
lightmaps += texture2D(s_lightmap1, lm1).rgb * e_lmscale[1].rgb;
|
||||
lightmaps += texture2D(s_lightmap2, lm2).rgb * e_lmscale[2].rgb;
|
||||
lightmaps += texture2D(s_lightmap3, lm3).rgb * e_lmscale[3].rgb;
|
||||
#else
|
||||
lightmaps = texture2D(s_lightmap, lm0).rgb * e_lmscale.rgb;
|
||||
#endif
|
||||
return lightmaps;
|
||||
}
|
||||
|
||||
void main ( void )
|
||||
{
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
vec3 light = texture2D(s_lightmap, lm_c).rgb * e_lmscale.rgb;
|
||||
|
||||
/* get the alphatesting out of the way first */
|
||||
#ifdef MASK
|
||||
if (diffuse_f.a < 0.6) {
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
/* lighting */
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
|
||||
#ifdef REFLECTCUBE
|
||||
#ifdef BUMP
|
||||
|
@ -53,24 +95,14 @@ varying mat3 invsurface;
|
|||
vec3 normal_f = vec3(0, 0, 1);
|
||||
#endif
|
||||
vec3 cube_c;
|
||||
vec4 out_f = vec4( 1.0, 1.0, 1.0, 1.0 );
|
||||
diffuse_f.rgb *= light.rgb;
|
||||
|
||||
cube_c = reflect( normalize(-eyevector), normal_f);
|
||||
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, diffuse_f.a);
|
||||
diffuse_f = out_f;
|
||||
#else
|
||||
diffuse_f.rgb *= light.rgb;
|
||||
#ifdef MASK
|
||||
if (diffuse_f.a < e_colourident.a) {
|
||||
discard;
|
||||
}
|
||||
diffuse_f.rgb = mix( textureCube(s_reflectcube, cube_c ).rgb, diffuse_f.rgb, diffuse_f.a);
|
||||
#endif
|
||||
#endif
|
||||
diffuse_f *= e_colourident;
|
||||
|
||||
diffuse_f *= e_colourident;
|
||||
gl_FragColor = diffuse_f;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue