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,107 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<script type="text/javascript" src="../Common/initShaders.js"></script>
|
||||
<script type="text/javascript" src="../Common/MVnew.js"></script>
|
||||
<script type="text/javascript" src="pickCube5.js"></script>
|
||||
|
||||
<script id="vertex-shader" type="x-shader/x-vertex">
|
||||
#version 300 es
|
||||
|
||||
in vec4 aPosition;
|
||||
in vec3 aNormal;
|
||||
out vec4 vColor;
|
||||
|
||||
uniform vec4 uAmbientProduct, uDiffuseProduct, uSpecularProduct;
|
||||
uniform mat4 uModelViewMatrix;
|
||||
uniform mat4 uProjectionMatrix;
|
||||
uniform vec4 uLightPosition;
|
||||
uniform float uShininess;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
|
||||
vec3 pos = -(uModelViewMatrix * aPosition).xyz;
|
||||
vec3 light = uLightPosition.xyz;
|
||||
vec3 L = normalize(light - pos);
|
||||
|
||||
|
||||
vec3 E = normalize(-pos);
|
||||
vec3 H = normalize(L + E);
|
||||
|
||||
vec4 NN = vec4(aNormal,0);
|
||||
|
||||
// Transform vertex normal into eye coordinates
|
||||
|
||||
vec3 N = normalize((uModelViewMatrix*NN).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;
|
||||
|
||||
uniform int uColorIndex;
|
||||
|
||||
in vec4 vColor;
|
||||
out vec4 fColor;
|
||||
|
||||
void
|
||||
main()
|
||||
{
|
||||
vec4 c[7];
|
||||
c[0] = vColor;
|
||||
c[1] = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
c[2] = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
c[3] = vec4(0.0, 0.0, 1.0, 1.0);
|
||||
c[4] = vec4(1.0, 1.0, 0.0, 1.0);
|
||||
c[5] = vec4(0.0, 1.0, 1.0, 1.0);
|
||||
c[6] = vec4(1.0, 0.0, 1.0, 1.0);
|
||||
|
||||
|
||||
if(uColorIndex == 0) fColor = c[0];
|
||||
else fColor = c[uColorIndex];
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<canvas id="gl-canvas" width="512" height="512">
|
||||
Oops ... your browser doesn't support the HTML5 canvas element
|
||||
</canvas>
|
||||
</div>
|
||||
<div>
|
||||
<button id = "ButtonX">Rotate X</button>
|
||||
<button id = "ButtonY">Rotate Y</button>
|
||||
<button id = "ButtonZ">Rotate Z</button>
|
||||
<button id = "ButtonT">Toggle Rotation</button>
|
||||
</div>
|
||||
<div id = "test">
|
||||
face
|
||||
</div>
|
||||
<div id = "test2">
|
||||
fps 0
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user