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 #ifndef _VERTEX_H_
17 #define _VERTEX_H_
18 
19 static const char attach_shader_successful_complile_vertex[] =
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     " \n"
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     "{\n"
37     "    vec3    ct; \n"
38     "    float    ss, tt, w, h; \n"
39     " \n"
40     "    vec3 pos = Position; \n"
41     ""
42     "    ss = pos.x / brickMortarWidth; \n"
43     "    tt = pos.z / brickMortarHeight; \n"
44     ""
45     "    if (fract (tt * 0.5) > 0.5) \n"
46     "        ss += 0.5; \n"
47     ""
48     "    ss = fract (ss); \n"
49     "    tt = fract (tt); \n"
50 
51     "    w = step (mwf, ss) - step (1.0 - mwf, ss); \n"
52     "    h = step (mhf, tt) - step (1.0 - mhf, tt); \n"
53     ""
54     "    ct = clamp(mix (mortarColor, brickColor, w * h) * lightIntensity, 0.0, 1.0); \n"
55     ""
56     "    gl_FragColor = vec4 (ct, 1.0); \n"
57     "} \n";
58 
59 static const char color_one_vertex_shader_one[] =
60         "attribute vec4 vPosition;    \n"
61         "attribute vec4 vColor;       \n"
62         "varying vec4 varyColor;      \n"
63         "void main()                  \n"
64         "{                            \n"
65         "   gl_Position = vPosition;  \n"
66         "   varyColor = vColor;       \n"
67         "}                            \n";
68 
69 static const char color_one_vertex_shader[] =
70         "attribute vec4 vPosition;    \n"
71         "void main()                  \n"
72         "{                            \n"
73         "   gl_Position = vPosition;  \n"
74         "}                            \n";
75 
76 #endif
77