Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/shaders/glsl/common/los_fragment.h
#ifndef INCLUDED_LOS_FRAGMENT | #ifndef INCLUDED_LOS_FRAGMENT | ||||
#define INCLUDED_LOS_FRAGMENT | #define INCLUDED_LOS_FRAGMENT | ||||
#if !IGNORE_LOS | #if !IGNORE_LOS | ||||
uniform sampler2D losTex; | uniform sampler2D losTex; | ||||
varying vec2 v_los; | varying vec2 v_los; | ||||
#endif | #endif | ||||
float getLOS() | float getLOS() | ||||
{ | { | ||||
#if !IGNORE_LOS | #if !IGNORE_LOS | ||||
float los = texture2D(losTex, v_los).r; | float los = texture2D(losTex, v_los).r; | ||||
float threshold = 0.03; | float threshold = 0.03; | ||||
return (los - threshold) / (1.0 - threshold); | return clamp(los - threshold, 0.0, 1.0) / (1.0 - threshold); | ||||
#else | #else | ||||
return 1.0; | return 1.0; | ||||
#endif | #endif | ||||
} | } | ||||
#endif // INCLUDED_LOS_FRAGMENT | #endif // INCLUDED_LOS_FRAGMENT |
Wildfire Games · Phabricator