gallium: add target-helpers/wrap_screen.c to C_SOURCES
[mesa/mesa-lb.git] / progs / glsl / CH06-brick.frag
blob06ef04e3afb0e317f4f2eb7d0f66b2c5aa110e09
1 //
2 // Fragment shader for procedural bricks
3 //
4 // Authors: Dave Baldwin, Steve Koren, Randi Rost
5 //          based on a shader by Darwyn Peachey
6 //
7 // Copyright (c) 2002-2006 3Dlabs Inc. Ltd. 
8 //
9 // See 3Dlabs-License.txt for license information
12 uniform vec3  BrickColor, MortarColor;
13 uniform vec2  BrickSize;
14 uniform vec2  BrickPct;
16 varying vec2  MCposition;
17 varying float LightIntensity;
19 void main()
21     vec3  color;
22     vec2  position, useBrick;
23     
24     position = MCposition / BrickSize;
26     if (fract(position.y * 0.5) > 0.5)
27         position.x += 0.5;
29     position = fract(position);
31     useBrick = step(position, BrickPct);
33     color  = mix(MortarColor, BrickColor, useBrick.x * useBrick.y);
34     color *= LightIntensity;
35     gl_FragColor = vec4(color, 1.0);