forked from vjeux/jsWoWModelViewer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodelviewer.html
More file actions
83 lines (63 loc) · 2.32 KB
/
modelviewer.html
File metadata and controls
83 lines (63 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<html>
<head>
<!-- Binary Libs -->
<script src="https://raw.github.com/vjeux/jDataView/master/jquery/jquery-1.7.1-binary-ajax.js"></script>
<script src="https://raw.github.com/vjeux/jDataView/master/src/jdataview.js"></script>
<script src="https://raw.github.com/vjeux/jParser/master/src/jparser.js"></script>
<!-- WebGL Libs -->
<script src="scripts/sylvester.js"></script>
<script src="scripts/glUtils.js"></script>
<script src="scripts/glUtilities.js"></script>
<!-- Main -->
<script src="scripts/m2.js"></script>
<script src="scripts/modelviewer.js"></script>
<script id="shader-vs" type="x-shader/x-vertex">
attribute vec3 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying vec3 vLightWeighting;
varying vec2 vTextureCoord;
void main(void) {
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
vLightWeighting = aVertexPosition - vec3(-4, 0, 1);
vTextureCoord = aTextureCoord;
}
</script>
<script id="shader-fs" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
varying vec3 vLightWeighting;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
void main(void) {
vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
gl_FragColor = vec4(textureColor.rgb, 1);
}
</script>
<style>
fieldset { display: inline-block; }
</style>
</head>
<body>
<button onclick="stop = true;">Stop</button>
<fieldset id="translate">
<legend>Camera</legend>
<section>X: <input type="range" min="-10" max="10" value="0" step="0.1" /> <span></span></section>
<section>Y: <input type="range" min="-10" max="10" value="-1" step="0.1" /> <span></span></section>
<section>Z: <input type="range" min="-10" max="10" value="-0.2" step="0.1" /> <span></span></section>
</fieldset>
<fieldset id="rotate">
<legend>Look At</legend>
<section>X: <input type="range" min="-10" max="10" value="0.2" step="0.1" /> <span></span></section>
<section>Y: <input type="range" min="-10" max="10" value="3.2" step="0.1" /> <span></span></section>
<section>Z: <input type="range" min="-10" max="10" value="0.2" step="0.1" /> <span></span></section>
</fieldset>
<br />
<canvas id="glSurface" style="border: none;" width="500" height="500"></canvas>
<br />
Open the console (firebug, web inspector ...) to view the parsed model.
<textarea></textarea>
</body>
</html>