Created
September 23, 2011 20:46
-
-
Save cjcliffe/1238401 to your computer and use it in GitHub Desktop.
Minimal Custom Shader with full pipeline rendering for CubicVR.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="vs" type="x-shader/x-vertex"> | |
void main(void) | |
{ | |
vertexTexCoordOut = cubicvr_texCoord(); | |
gl_Position = matrixProjection * matrixModelView * cubicvr_transform(); | |
vertexNormalOut = matrixNormal * cubicvr_normal(); | |
cubicvr_lighting(); | |
} | |
</script> | |
<script id="fs" type="x-shader/x-fragment"> | |
void main(void) | |
{ | |
vec2 texCoord = cubicvr_texCoord(); | |
vec4 color = cubicvr_color(texCoord); | |
vec3 normal = cubicvr_normal(texCoord); | |
color = cubicvr_environment(color,normal,texCoord); | |
color = cubicvr_lighting(color,normal,texCoord); | |
gl_FragColor = clamp(color,0.0,1.0); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment