58 lines
1.2 KiB
HTML
58 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<button id = "ButtonX">Rotate X</button>
|
|
<button id = "ButtonY">Rotate Y</button>
|
|
<button id = "ButtonZ">Rotate Z</button>
|
|
<button id = "ButtonT">Toggle Rotation</button>
|
|
|
|
|
|
<script id="vertex-shader" type="x-shader/x-vertex">
|
|
#version 300 es
|
|
|
|
in vec4 aPosition;
|
|
in vec3 aNormal;
|
|
out vec3 R;
|
|
|
|
uniform mat4 uModelViewMatrix;
|
|
uniform mat4 uProjectionMatrix;
|
|
uniform mat3 uNormalMatrix;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = uProjectionMatrix*uModelViewMatrix*aPosition;
|
|
|
|
vec3 eyePos = normalize((uModelViewMatrix*aPosition).xyz);
|
|
vec3 N = normalize(uNormalMatrix*aNormal);
|
|
|
|
R = reflect(eyePos, N);
|
|
}
|
|
</script>
|
|
|
|
<script id="fragment-shader" type="x-shader/x-fragment">
|
|
#version 300 es
|
|
|
|
precision mediump float;
|
|
|
|
in vec3 R;
|
|
out vec4 fColor;
|
|
|
|
uniform samplerCube uTexMap;
|
|
|
|
void main()
|
|
{
|
|
fColor = texture(uTexMap, R);
|
|
}
|
|
</script>
|
|
|
|
<script type="text/javascript" src="../Common/initShaders.js"></script>
|
|
<script type="text/javascript" src="../Common/MVnew.js"></script>
|
|
<script type="text/javascript" src="reflectionMap2.js"></script>
|
|
|
|
<body>
|
|
<canvas id="gl-canvas" width="1000" height="1000">
|
|
Oops ... your browser doesn't support the HTML5 canvas element
|
|
</canvas>
|
|
</body>
|
|
</html>
|