1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package android.opengl.cts; 17 18 public class Shaders { 19 public static String successfulcompile_frag = 20 "#ifdef GL_ES \n" 21 + "precision mediump float; \n" 22 + "#endif \n" 23 + "uniform float mortarThickness; \n" 24 + "uniform vec3 brickColor; \n" 25 + "uniform vec3 mortarColor; \n" 26 27 + "uniform float brickMortarWidth; \n" 28 + "uniform float brickMortarHeight; \n" 29 + "uniform float mwf; \n" 30 + "uniform float mhf; \n" 31 32 + "varying vec3 Position; \n" 33 + "varying float lightIntensity; \n" 34 + "\n" 35 + "void main (void){ \n" 36 + " vec3 ct; \n" 37 + " float ss, tt, w, h; \n" 38 + "" 39 + " vec3 pos = Position; \n" 40 + "" 41 + " ss = pos.x / brickMortarWidth; \n" 42 + " tt = pos.z / brickMortarHeight; \n" 43 + " if (fract (tt * 0.5) > 0.5) \n" 44 + " ss += 0.5; \n" 45 46 + " ss = fract (ss); \n" 47 + " tt = fract (tt); \n" 48 49 + " w = step (mwf, ss) - step (1.0 - mwf, ss); \n" 50 + " h = step (mhf, tt) - step (1.0 - mhf, tt); \n" 51 52 + " ct = clamp(mix (mortarColor, brickColor, w * h) * lightIntensity, 0.0, 1.0); \n" 53 54 + " gl_FragColor = vec4 (ct, 1.0); \n" 55 + "} \n"; 56 57 } 58