forked from dirkk0/multiplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multiplay.html
executable file
·142 lines (103 loc) · 3.82 KB
/
multiplay.html
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>three.js - pointerlock controls</title>
<style>
html, body {
width: 100%;
height: 100%;
}
body {
background-color: #ffffff;
margin: 0;
overflow: hidden;
font-family: arial;
}
#blocker {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
}
#stats { position: absolute; top:0; left: 0 }
#stats #fps { background: transparent !important }
#stats #fps #fpsText { color: #555 !important }
#stats #fps #fpsGraph { display: none }
#instructions {
width: 100%;
height: 100%;
display: -webkit-box;
display: -moz-box;
display: box;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
box-orient: horizontal;
-webkit-box-pack: center;
-moz-box-pack: center;
box-pack: center;
-webkit-box-align: center;
-moz-box-align: center;
box-align: center;
color: #ffffff;
text-align: center;
cursor: pointer;
}
</style>
<script type="x-shader/x-vertex" id="vertexShader">
// varying vec3 worldPosition;
// void main() {
// vec4 mPosition = modelMatrix * vec4( position, 1.0 );
// gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
// worldPosition = mPosition.xyz;
// }
varying vec3 vWorldPosition;
void main() {
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
vWorldPosition = worldPosition.xyz;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<script type="x-shader/x-fragment" id="fragmentShader">
// uniform vec3 topColor;
// uniform vec3 bottomColor;
// uniform float offset;
// uniform float exponent;
// varying vec3 worldPosition;
// void main() {
// float h = normalize( worldPosition + offset ).y;
// gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( h, exponent ), 0.0 ) ), 1.0 );
//
// }
uniform vec3 topColor;
uniform vec3 bottomColor;
uniform float offset;
uniform float exponent;
varying vec3 vWorldPosition;
void main() {
float h = normalize( vWorldPosition + offset ).y;
gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( h, exponent ), 0.0 ) ), 1.0 );
}
</script>
</head>
<body>
<script src="js/three.min.js"></script>
<script src="js/PointerLockControls.js"></script>
<script src="js/AnaglyphEffect.js"></script>
<script src="js/stats.min.js"></script>
<script src="js/seedrandom.js"></script>
<!-- <script src="http://davidbau.com/encode/seedrandom.js"></script>
-->
<script src="/socket.io/socket.io.js"></script>
<script src="/js/multiplay.js"></script>
<div id="blocker">
<div id="instructions">
<span style="font-size:20px">Click to play</span>
<br />
(W, A, S, D = Move, SPACE = Jump, MOUSE = Look around)
</div>
</div>
<script>
</script>
</body>
</html>