summaryrefslogtreecommitdiffstats
path: root/src/GLSLShaderTest/wood.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/GLSLShaderTest/wood.frag')
-rw-r--r--src/GLSLShaderTest/wood.frag66
1 files changed, 0 insertions, 66 deletions
diff --git a/src/GLSLShaderTest/wood.frag b/src/GLSLShaderTest/wood.frag
deleted file mode 100644
index eecf91f..0000000
--- a/src/GLSLShaderTest/wood.frag
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Simple fragment shader for wood
-//
-// Author: John Kessenich
-//
-// Copyright (c) 2002-2004 3Dlabs Inc. Ltd.
-//
-// See 3Dlabs-License.txt for license information
-//
-
-//uniform float GrainSizeRecip;
-//uniform vec3 DarkColor;
-//uniform vec3 spread;
-const float GrainSizeRecip = 1.0;
-const vec3 DarkColor = vec3 (0.6, 0.3, 0.1);
-const vec3 spread = vec3 (0.15, 0.075, 0.0);
-
-varying float lightIntensity;
-varying vec3 Position;
-
-void main (void)
-{
- //
- // cheap noise
- //
- vec3 location = Position;
- vec3 floorvec = vec3(floor(10.0 * Position.x), 0.0, floor(10.0 * Position.z));
- vec3 noise = Position * 10.0 - floorvec - 0.5;
- noise *= noise;
- location += noise * 0.12;
-
- //
- // distance from axis
- //
- float dist = location.x * location.x + location.z * location.z;
- float grain = dist * GrainSizeRecip;
-
- //
- // grain effects as function of distance
- //
- float brightness = fract(grain);
- if (brightness > 0.5)
- brightness = (1.0 - brightness);
- vec3 color = DarkColor + brightness * spread;
-
- brightness = fract(grain * 7.0);
- if (brightness > 0.5)
- brightness = 1.0 - brightness;
- color -= brightness * spread;
-
- //
- // also as a function of lines parallel to the axis
- //
- brightness = fract(grain * 47.0) * 0.60;
- float line = fract(Position.z + Position.x);
- float snap = floor(line * 20.0) * (1.0/20.0);
- if (line < snap + 0.006)
- color -= brightness * spread;
-
- //
- // apply lighting effects from vertex processor
- //
- color = clamp(color * lightIntensity, 0.0, 1.0);
-
- gl_FragColor = vec4(color, 1.0);
-}