aboutsummaryrefslogtreecommitdiff
path: root/Gem/examples/data/brick.frag
blob: 53e4f1b62bb61e5116587d78b9cbcaec06b1e218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
varying vec3 BrickColor_f, MortarColor_f;
varying vec2 BrickSize_f, BrickPct_f;

varying vec2 MCposition;
varying float LightIntensity;


void main()
{
   vec3 color;
   vec2 position, useBrick;
   position = MCposition / BrickSize_f;
  
   if (fract(position.y * 0.5) > 0.5)
      position.x += 0.5;

   position = fract(position);

   useBrick = step(position, BrickPct_f);

   color    = mix(MortarColor_f, BrickColor_f, useBrick.x * useBrick.y);
   color   *= LightIntensity;
   gl_FragColor = vec4(color, 1.0);
}