17 #ifndef OVR_CAPI_GL_Shaders_h
18 #define OVR_CAPI_GL_Shaders_h
23 namespace OVR {
namespace CAPI {
namespace GL {
27 "#extension GL_ARB_shader_texture_lod : enable\n"
28 "#define _FRAGCOLOR_DECLARATION\n"
29 "#define _VS_IN attribute\n"
30 "#define _VS_OUT varying\n"
31 "#define _FS_IN varying\n"
32 "#define _TEXTURELOD texture2DLod\n"
33 "#define _FRAGCOLOR gl_FragColor\n";
37 "#define _FRAGCOLOR_DECLARATION out vec4 FragColor;\n"
39 "#define _VS_OUT out\n"
41 "#define _TEXTURELOD textureLod\n"
42 "#define _FRAGCOLOR FragColor\n";
45 "uniform vec2 PositionOffset;\n"
46 "uniform vec2 Scale;\n"
48 "_VS_IN vec3 Position;\n"
52 " gl_Position = vec4(Position.xy * Scale + PositionOffset, 0.5, 1.0);\n"
62 "uniform vec4 Color;\n"
64 "_FRAGCOLOR_DECLARATION\n"
68 " _FRAGCOLOR = Color;\n"
78 "uniform vec2 EyeToSourceUVScale;\n"
79 "uniform vec2 EyeToSourceUVOffset;\n"
81 "_VS_IN vec2 Position;\n"
82 "_VS_IN vec4 Color;\n"
83 "_VS_IN vec2 TexCoord0;\n"
85 "_VS_OUT vec4 oColor;\n"
86 "_VS_OUT vec2 oTexCoord0;\n"
90 " gl_Position.x = Position.x;\n"
91 " gl_Position.y = Position.y;\n"
92 " gl_Position.z = 0.5;\n"
93 " gl_Position.w = 1.0;\n"
96 " oTexCoord0 = TexCoord0 * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
97 " oTexCoord0.y = 1.0 - oTexCoord0.y;\n"
108 "uniform sampler2D Texture0;\n"
110 "_FS_IN vec4 oColor;\n"
111 "_FS_IN vec2 oTexCoord0;\n"
113 "_FRAGCOLOR_DECLARATION\n"
117 " _FRAGCOLOR = _TEXTURELOD(Texture0, oTexCoord0, 0.0);\n"
118 " _FRAGCOLOR.a = 1.0;\n"
123 "uniform vec2 EyeToSourceUVScale;\n"
124 "uniform vec2 EyeToSourceUVOffset;\n"
125 "uniform mat4 EyeRotationStart;\n"
126 "uniform mat4 EyeRotationEnd;\n"
128 "_VS_IN vec2 Position;\n"
129 "_VS_IN vec4 Color;\n"
130 "_VS_IN vec2 TexCoord0;\n"
132 "_FS_IN vec4 oColor;\n"
133 "_FS_IN vec2 oTexCoord0;\n"
137 " gl_Position.x = Position.x;\n"
138 " gl_Position.y = Position.y;\n"
139 " gl_Position.z = 0.0;\n"
140 " gl_Position.w = 1.0;\n"
144 " vec3 TanEyeAngle = vec3 ( TexCoord0.x, TexCoord0.y, 1.0 );\n"
149 " vec3 TransformedStart = (EyeRotationStart * vec4(TanEyeAngle, 0)).xyz;\n"
150 " vec3 TransformedEnd = (EyeRotationEnd * vec4(TanEyeAngle, 0)).xyz;\n"
152 " vec3 Transformed = mix ( TransformedStart, TransformedEnd, Color.a );\n"
154 " mat4 EyeRotation = mix ( EyeRotationStart, EyeRotationEnd, Color.a );\n"
155 " vec3 Transformed = EyeRotation * TanEyeAngle;\n"
159 " float RecipZ = 1.0 / Transformed.z;\n"
160 " vec2 Flattened = vec2 ( Transformed.x * RecipZ, Transformed.y * RecipZ );\n"
164 " vec2 SrcCoord = Flattened * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
165 " oTexCoord0 = SrcCoord;\n"
166 " oTexCoord0.y = 1.0-oTexCoord0.y;\n"
167 " oColor = vec4(Color.r, Color.r, Color.r, Color.r);\n"
178 "uniform vec2 EyeToSourceUVScale;\n"
179 "uniform vec2 EyeToSourceUVOffset;\n"
181 "_VS_IN vec2 Position;\n"
182 "_VS_IN vec4 Color;\n"
183 "_VS_IN vec2 TexCoord0;\n"
184 "_VS_IN vec2 TexCoord1;\n"
185 "_VS_IN vec2 TexCoord2;\n"
187 "_VS_OUT vec4 oColor;\n"
188 "_VS_OUT vec2 oTexCoord0;\n"
189 "_VS_OUT vec2 oTexCoord1;\n"
190 "_VS_OUT vec2 oTexCoord2;\n"
194 " gl_Position.x = Position.x;\n"
195 " gl_Position.y = Position.y;\n"
196 " gl_Position.z = 0.5;\n"
197 " gl_Position.w = 1.0;\n"
201 " oTexCoord0 = TexCoord0 * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
202 " oTexCoord0.y = 1.0-oTexCoord0.y;\n"
203 " oTexCoord1 = TexCoord1 * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
204 " oTexCoord1.y = 1.0-oTexCoord1.y;\n"
205 " oTexCoord2 = TexCoord2 * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
206 " oTexCoord2.y = 1.0-oTexCoord2.y;\n"
218 "uniform sampler2D Texture0;\n"
220 "_FS_IN vec4 oColor;\n"
221 "_FS_IN vec2 oTexCoord0;\n"
222 "_FS_IN vec2 oTexCoord1;\n"
223 "_FS_IN vec2 oTexCoord2;\n"
225 "_FRAGCOLOR_DECLARATION\n"
229 " float ResultR = _TEXTURELOD(Texture0, oTexCoord0, 0.0).r;\n"
230 " float ResultG = _TEXTURELOD(Texture0, oTexCoord1, 0.0).g;\n"
231 " float ResultB = _TEXTURELOD(Texture0, oTexCoord2, 0.0).b;\n"
233 " _FRAGCOLOR = vec4(ResultR * oColor.r, ResultG * oColor.g, ResultB * oColor.b, 1.0);\n"
238 "uniform vec2 EyeToSourceUVScale;\n"
239 "uniform vec2 EyeToSourceUVOffset;\n"
240 "uniform mat4 EyeRotationStart;\n"
241 "uniform mat4 EyeRotationEnd;\n"
243 "_VS_IN vec2 Position;\n"
244 "_VS_IN vec4 Color;\n"
245 "_VS_IN vec2 TexCoord0;\n"
246 "_VS_IN vec2 TexCoord1;\n"
247 "_VS_IN vec2 TexCoord2;\n"
249 "_VS_OUT vec4 oColor;\n"
250 "_VS_OUT vec2 oTexCoord0;\n"
251 "_VS_OUT vec2 oTexCoord1;\n"
252 "_VS_OUT vec2 oTexCoord2;\n"
256 " gl_Position.x = Position.x;\n"
257 " gl_Position.y = Position.y;\n"
258 " gl_Position.z = 0.0;\n"
259 " gl_Position.w = 1.0;\n"
263 " vec3 TanEyeAngleR = vec3 ( TexCoord0.x, TexCoord0.y, 1.0 );\n"
264 " vec3 TanEyeAngleG = vec3 ( TexCoord1.x, TexCoord1.y, 1.0 );\n"
265 " vec3 TanEyeAngleB = vec3 ( TexCoord2.x, TexCoord2.y, 1.0 );\n"
270 " vec3 TransformedRStart = (EyeRotationStart * vec4(TanEyeAngleR, 0)).xyz;\n"
271 " vec3 TransformedGStart = (EyeRotationStart * vec4(TanEyeAngleG, 0)).xyz;\n"
272 " vec3 TransformedBStart = (EyeRotationStart * vec4(TanEyeAngleB, 0)).xyz;\n"
273 " vec3 TransformedREnd = (EyeRotationEnd * vec4(TanEyeAngleR, 0)).xyz;\n"
274 " vec3 TransformedGEnd = (EyeRotationEnd * vec4(TanEyeAngleG, 0)).xyz;\n"
275 " vec3 TransformedBEnd = (EyeRotationEnd * vec4(TanEyeAngleB, 0)).xyz;\n"
278 " vec3 TransformedR = mix ( TransformedRStart, TransformedREnd, Color.a );\n"
279 " vec3 TransformedG = mix ( TransformedGStart, TransformedGEnd, Color.a );\n"
280 " vec3 TransformedB = mix ( TransformedBStart, TransformedBEnd, Color.a );\n"
282 " mat3 EyeRotation;\n"
283 " EyeRotation[0] = mix ( EyeRotationStart[0], EyeRotationEnd[0], Color.a ).xyz;\n"
284 " EyeRotation[1] = mix ( EyeRotationStart[1], EyeRotationEnd[1], Color.a ).xyz;\n"
285 " EyeRotation[2] = mix ( EyeRotationStart[2], EyeRotationEnd[2], Color.a ).xyz;\n"
286 " vec3 TransformedR = EyeRotation * TanEyeAngleR;\n"
287 " vec3 TransformedG = EyeRotation * TanEyeAngleG;\n"
288 " vec3 TransformedB = EyeRotation * TanEyeAngleB;\n"
292 " float RecipZR = 1.0 / TransformedR.z;\n"
293 " float RecipZG = 1.0 / TransformedG.z;\n"
294 " float RecipZB = 1.0 / TransformedB.z;\n"
295 " vec2 FlattenedR = vec2 ( TransformedR.x * RecipZR, TransformedR.y * RecipZR );\n"
296 " vec2 FlattenedG = vec2 ( TransformedG.x * RecipZG, TransformedG.y * RecipZG );\n"
297 " vec2 FlattenedB = vec2 ( TransformedB.x * RecipZB, TransformedB.y * RecipZB );\n"
301 " vec2 SrcCoordR = FlattenedR * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
302 " vec2 SrcCoordG = FlattenedG * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
303 " vec2 SrcCoordB = FlattenedB * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
305 " oTexCoord0 = SrcCoordR;\n"
306 " oTexCoord0.y = 1.0-oTexCoord0.y;\n"
307 " oTexCoord1 = SrcCoordG;\n"
308 " oTexCoord1.y = 1.0-oTexCoord1.y;\n"
309 " oTexCoord2 = SrcCoordB;\n"
310 " oTexCoord2.y = 1.0-oTexCoord2.y;\n"
312 " oColor = vec4(Color.r, Color.r, Color.r, Color.r);\n"
326 #endif // OVR_CAPI_GL_Shaders_h
const OVR::CAPI::GL::ShaderBase::Uniform SimpleQuad_vs_refl[]
static const char glsl2Prefix[]
static const char Distortion_vs[]
static const char DistortionTimewarp_vs[]
static const char glsl3Prefix[]
static const char SimpleQuad_vs[]
const OVR::CAPI::GL::ShaderBase::Uniform SimpleQuad_fs_refl[]
static const char SimpleQuad_fs[]
const OVR::CAPI::GL::ShaderBase::Uniform DistortionTimewarp_vs_refl[]
const OVR::CAPI::GL::ShaderBase::Uniform DistortionChroma_vs_refl[]
static const char Distortion_fs[]
const OVR::CAPI::GL::ShaderBase::Uniform Distortion_vs_refl[]
static const char DistortionTimewarpChroma_vs[]
static const char DistortionChroma_vs[]
static const char DistortionChroma_fs[]
const OVR::CAPI::GL::ShaderBase::Uniform DistortionTimewarpChroma_vs_refl[]