Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef OVR_SHADER
- #define OVR_SHADER
- // Vertex Shader
- static const char* vertexShader =
- "#version 110\n"
- "uniform vec2 EyeToSourceUVScale;\n"
- "uniform vec2 EyeToSourceUVOffset;\n"
- "attribute vec4 Position;\n"
- //"attribute vec4 Color;\n"
- // Vignette Fade and TimeWarpFactor encoded into Pos.z and Pos.w
- "attribute vec2 TexCoord0;\n"
- "attribute vec2 TexCoord1;\n"
- "attribute vec2 TexCoord2;\n"
- "varying vec4 oColor; \n"
- "varying vec2 oTexCoord0;\n"
- "varying vec2 oTexCoord1;\n"
- "varying vec2 oTexCoord2;\n"
- "void main() {\n"
- " gl_Position.x = Position.x;\n"
- " gl_Position.y = Position.y;\n"
- " gl_Position.z = 0.5;\n"
- " gl_Position.w = 1.0;\n"
- // Vertex inputs are in TanEyeAngle space for the R,G,B channels
- // (i.e. after chromatic aberration and distortion).
- // Scale them into the correct [0-1],[0-1] UV lookup space (depending on eye)
- " oTexCoord0 = TexCoord0 * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
- " oTexCoord0.y = 1.0-oTexCoord0.y;\n"
- " oTexCoord1 = TexCoord1 * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
- " oTexCoord1.y = 1.0-oTexCoord1.y;\n"
- " oTexCoord2 = TexCoord2 * EyeToSourceUVScale + EyeToSourceUVOffset;\n"
- " oTexCoord2.y = 1.0-oTexCoord2.y;\n"
- " oColor = vec4(Position.w, Position.w, Position.w, Position.z);\n" // Used for VignetteFade.
- "}\n";
- // Fragment Shader
- static const char* fragmentShader =
- "#version 110 \n"
- "uniform sampler2D Texture;\n"
- "varying vec4 oColor;\n"
- "varying vec2 oTexCoord0;\n"
- "varying vec2 oTexCoord1;\n"
- "varying vec2 oTexCoord2;\n"
- "void main() {\n"
- //"gl_FragColor = oColor * texture2D(Texture, oTexCoord1);\n"
- " gl_FragColor.r = oColor.r * texture2D(Texture, oTexCoord0).r;\n"
- " gl_FragColor.g = oColor.g * texture2D(Texture, oTexCoord1).g;\n"
- " gl_FragColor.b = oColor.b * texture2D(Texture, oTexCoord2).b;\n"
- " gl_FragColor.a = 1.0;\n"
- "}\n";
- #endif /* OVR_SHADER */
Advertisement
Add Comment
Please, Sign In to add comment