diff options
author | Brian <[email protected]> | 2007-01-15 17:27:24 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-01-15 17:27:24 -0700 |
commit | 2ccd26469541ef042bb1aec8ade3dc4736f694cf (patch) | |
tree | 90132405bcf4384d9bfe76e88e18f363b923b674 /progs/glsl/CH06-brick.frag.txt | |
parent | f6507157e290b783c036e9459886e0f7ae60ef7b (diff) |
Added new directory of GL shading language demos: glsl
Diffstat (limited to 'progs/glsl/CH06-brick.frag.txt')
-rw-r--r-- | progs/glsl/CH06-brick.frag.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/progs/glsl/CH06-brick.frag.txt b/progs/glsl/CH06-brick.frag.txt new file mode 100644 index 00000000000..06ef04e3afb --- /dev/null +++ b/progs/glsl/CH06-brick.frag.txt @@ -0,0 +1,36 @@ +// +// Fragment shader for procedural bricks +// +// Authors: Dave Baldwin, Steve Koren, Randi Rost +// based on a shader by Darwyn Peachey +// +// Copyright (c) 2002-2006 3Dlabs Inc. Ltd. +// +// See 3Dlabs-License.txt for license information +// + +uniform vec3 BrickColor, MortarColor; +uniform vec2 BrickSize; +uniform vec2 BrickPct; + +varying vec2 MCposition; +varying float LightIntensity; + +void main() +{ + vec3 color; + vec2 position, useBrick; + + position = MCposition / BrickSize; + + if (fract(position.y * 0.5) > 0.5) + position.x += 0.5; + + position = fract(position); + + useBrick = step(position, BrickPct); + + color = mix(MortarColor, BrickColor, useBrick.x * useBrick.y); + color *= LightIntensity; + gl_FragColor = vec4(color, 1.0); +} |