Graphics Reference
In-Depth Information
in vec2 vST;
out vec4 fFragColor;
const float DELTA = 0.001;
const vec3 BLUE = vec3( 0.1, 0.1, 0.5 );
const vec3 GREEN = vec3( 0.0, 0.8, 0.0 );
const vec3 BROWN = vec3( 0.6, 0.3, 0.1 );
const vec3 WHITE = vec3( 1.0, 1.0, 1.0 );
const float LNGMIN = -579240./2.;
const float LNGMAX = 579240./2.;
const float LATMIN = -419949./2.;
const float LATMAX = 419949./2.;
const float HGTMAX = 2891;
#define FP_TEXTURE // if we are using a floating point texture
// to contain the elevations, instead of a byte-texture
void main( )
{
vec2 stp0 = vec2( DELTA, 0. );
vec2 st0p = vec2( 0. , DELTA );
float west = texture( uHgtUnit, vST-stp0 ).r;
float east = texture( uHgtUnit, vST+stp0 ).r;
float south = texture( uHgtUnit, vST-st0p ).r;
float north = texture( uHgtUnit, vST+st0p ).r;
#ifndef FP_TEXTURE
west *= HGTMAX;
east *= HGTMAX;
south *= HGTMAX;
north *= HGTMAX;
#endif
vec3 stangent = vec3( 2.*DELTA*(LNGMAX-LNGMIN), 0.,
uExag * ( east - west ) );
vec3 ttangent = vec3( 0., 2.*DELTA*(LATMAX-LATMIN),
uExag * ( north - south ) );
vec3 normal = normalize( cross( stangent, ttangent ) );
float LightIntensity =
(dot(normalize(vec3(uLightX,uLightY,uLightZ)-
vMCposition),normal));
if( LightIntensity < 0.1 )
LightIntensity = 0.1;
Search WWH ::




Custom Search