Initial transfer of larger repo from git. IF full history and branches are needed must go to github at https://github.com/DulcisL/CCUCoding.git
This commit is contained in:
commit
c09ce40be0
4048 files changed
+603256
No files matched your search
@@ -0,0 +1,109 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<script id="vertex-shader" type="x-shader/x-vertex">
|
||||
#version 300 es
|
||||
|
||||
in vec4 aPosition;
|
||||
in vec4 aNormal;
|
||||
|
||||
out vec4 vColor;
|
||||
|
||||
|
||||
uniform vec4 uAmbientProduct, uDiffuseProduct, uSpecularProduct;
|
||||
uniform mat4 uModelViewMatrix;
|
||||
uniform mat4 uProjectionMatrix;
|
||||
uniform vec4 uLightPosition;
|
||||
uniform float uShininess;
|
||||
uniform mat3 uNormalMatrix;
|
||||
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
vec3 pos = (uModelViewMatrix * aPosition).xyz;
|
||||
vec3 light = uLightPosition.xyz;
|
||||
vec3 L;
|
||||
|
||||
// check for directional light
|
||||
|
||||
if(uLightPosition.w == 0.0) L = normalize(uLightPosition.xyz);
|
||||
else L = normalize(uLightPosition.xyz - pos);
|
||||
|
||||
|
||||
|
||||
vec3 E = -normalize(pos);
|
||||
vec3 H = normalize(L + E);
|
||||
|
||||
// Transform vertex normal into eye coordinates
|
||||
|
||||
vec3 N = normalize(uNormalMatrix*aNormal.xyz);
|
||||
|
||||
// Compute terms in the illumination equation
|
||||
vec4 ambient = uAmbientProduct;
|
||||
|
||||
float Kd = max( dot(L, N), 0.0 );
|
||||
vec4 diffuse = Kd*uDiffuseProduct;
|
||||
|
||||
float Ks = pow( max(dot(N, H), 0.0), uShininess );
|
||||
vec4 specular = Ks * uSpecularProduct;
|
||||
|
||||
if( dot(L, N) < 0.0 ) {
|
||||
specular = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
gl_Position = uProjectionMatrix * uModelViewMatrix * aPosition;
|
||||
|
||||
vColor = ambient + diffuse + specular;
|
||||
vColor.a = 1.0;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="fragment-shader" type="x-shader/x-fragment">
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
|
||||
in vec4 vColor;
|
||||
out vec4 fColor;
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
|
||||
fColor = vColor;
|
||||
|
||||
}
|
||||
</script>
|
||||
<p></p>
|
||||
<select id="Subdivisions" size="4">
|
||||
<option value="0">Increase Subdivisions</option>
|
||||
<option value="1">Decrease Subdivisions</option>
|
||||
<option value="2">Increase R</option>
|
||||
<option value="3">Decrease R</option>
|
||||
</select>
|
||||
<select id="Theta/ Phi" size="4">
|
||||
<option value="0">Increase Theta</option>
|
||||
<option value="1">Decrease Theta</option>
|
||||
<option value="2">Increase Phi</option>
|
||||
<option value="3">Decrease Phi</option>
|
||||
</select>
|
||||
<select id="Light movement" size="4">
|
||||
<option value="0">Light Left/ Right</option>
|
||||
<option value="1">Light Up / Down</option>
|
||||
<option value="2">Light Forward / Back</option>
|
||||
<option value="3">Reset Light</option>
|
||||
</select>
|
||||
<p></p>
|
||||
|
||||
<script type="text/javascript" src="../Common/initShaders.js"></script>
|
||||
<script type="text/javascript" src="../Common/MVnew.js"></script>
|
||||
<script type="text/javascript" src="exercise3d.js"></script>
|
||||
|
||||
<body>
|
||||
<canvas id="gl-canvas" width="512" height="512">
|
||||
Oops ... your browser doesn't support the HTML5 canvas element
|
||||
</canvas>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user