elation-engine 0.9.113 → 0.9.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/systems/render.css +5 -1
- package/package.json +1 -1
- package/scripts/assets.js +103 -20
- package/scripts/assetworker.js +18 -1
- package/scripts/external/holoplay.js +1494 -0
- package/scripts/external/octree.js +0 -0
- package/scripts/external/three/CSS3DRenderer.js +46 -43
- package/scripts/external/three/CubemapToEquirectangular.js +1 -1
- package/scripts/external/three/three-extras.js +1553 -392
- package/scripts/external/three/three-icosa.js +2575 -0
- package/scripts/external/three/three-loaders.js +925 -133
- package/scripts/external/three/three-postprocessing.js +3 -3
- package/scripts/external/three/three-r116dev.js +50930 -0
- package/scripts/external/three/three-spotlighttextures.js +50953 -0
- package/scripts/external/three/three-vrm.js +2 -2
- package/scripts/external/three/three-working.js +35968 -0
- package/scripts/external/three/three.js +38532 -24087
- package/scripts/external/three-mesh-bvh.js +5370 -0
- package/scripts/external/three-old/BVHLoader.js +406 -0
- package/scripts/external/three-old/ColladaLoader.js +5519 -0
- package/scripts/external/three-old/ColladaLoader2.js +1694 -0
- package/scripts/external/three-old/CubemapToEquirectangular.js +188 -0
- package/scripts/external/three-old/DDSLoader.js +269 -0
- package/scripts/external/three-old/FBXLoader-mine.js +5063 -0
- package/scripts/external/three-old/FBXLoader.js +5112 -0
- package/scripts/external/three-old/FlyControls.js +295 -0
- package/scripts/external/three-old/GLTF2Loader.js +2950 -0
- package/scripts/external/three-old/GLTFLoader.js +2213 -0
- package/scripts/external/three-old/JSONLoader.js +435 -0
- package/scripts/external/three-old/MTLLoader.js +533 -0
- package/scripts/external/three-old/OBJLoader-experimental.js +874 -0
- package/scripts/external/three-old/OBJLoader-working.js +727 -0
- package/scripts/external/three-old/OBJLoader.js +723 -0
- package/scripts/external/three-old/OBJMTLLoader.js +440 -0
- package/scripts/external/three-old/OrbitControls.js +592 -0
- package/scripts/external/three-old/PLYLoader.js +517 -0
- package/scripts/external/three-old/TransformControls.js +1100 -0
- package/scripts/external/three-old/VRMLLoader.js +1021 -0
- package/scripts/external/three-old/glTFLoader-combined.js +2513 -0
- package/scripts/external/three-old/nodethree.js +44018 -0
- package/scripts/external/three-old/render/BleachBypassShader.js +64 -0
- package/scripts/external/three-old/render/BloomPass.js +116 -0
- package/scripts/external/three-old/render/CSS3DRenderer.js +310 -0
- package/scripts/external/three-old/render/ClearPass.js +44 -0
- package/scripts/external/three-old/render/ConvolutionShader.js +101 -0
- package/scripts/external/three-old/render/CopyShader.js +46 -0
- package/scripts/external/three-old/render/EffectComposer.js +211 -0
- package/scripts/external/three-old/render/FXAAShader.js +88 -0
- package/scripts/external/three-old/render/FilmPass.js +60 -0
- package/scripts/external/three-old/render/FilmShader.js +104 -0
- package/scripts/external/three-old/render/ManualMSAARenderPass.js +168 -0
- package/scripts/external/three-old/render/MaskPass.js +97 -0
- package/scripts/external/three-old/render/OculusRenderPass.js +84 -0
- package/scripts/external/three-old/render/OculusRiftEffect.js +240 -0
- package/scripts/external/three-old/render/PortalRenderPass.js +166 -0
- package/scripts/external/three-old/render/RecordingPass.js +208 -0
- package/scripts/external/three-old/render/RenderPass.js +57 -0
- package/scripts/external/three-old/render/SSAOShader.js +259 -0
- package/scripts/external/three-old/render/SepiaShader.js +54 -0
- package/scripts/external/three-old/render/ShaderPass.js +66 -0
- package/scripts/external/three-old/render/VREffect.js +482 -0
- package/scripts/external/three-old/shimthree.js +23 -0
- package/scripts/external/three-old/stats.js +6 -0
- package/scripts/external/three-old/three-88dev.js +45004 -0
- package/scripts/external/three-old/three-backgroundoptimization.js +44432 -0
- package/scripts/external/three-old/three-updates.js +44735 -0
- package/scripts/external/three-old/three-working.js +44719 -0
- package/scripts/external/three-old/three.js +44431 -0
- package/scripts/external/three-old/threex.rendererstats.js +66 -0
- package/scripts/external/three-old/tween.js +13 -0
- package/scripts/external/webvr-polyfill-new.js +3497 -0
- package/scripts/external/webvr-polyfill-newest.js +3491 -0
- package/scripts/external/webvr-polyfill-old.js +6337 -0
- package/scripts/geometries.js +2 -2
- package/scripts/math.js +6 -6
- package/scripts/systems/admin.js +1 -1
- package/scripts/systems/controls.js +6 -4
- package/scripts/systems/physics.js +10 -10
- package/scripts/systems/render.js +58 -20
- package/scripts/systems/render2.js +38 -0
- package/scripts/things/camera.js +6 -1
- package/scripts/things/generic-trackedvectors.js +1875 -0
- package/scripts/things/generic.js +3 -4
- package/scripts/things/label2d.js +1 -1
- package/scripts/things/leapmotion.js +6 -6
- package/scripts/things/menu.js +1 -1
- package/scripts/things/player-bak.js +638 -0
- package/scripts/things/player.js +28 -10
- package/scripts/things/skysphere.js +1 -1
- package/scripts/things/terrain.js +1 -1
- package/scripts/things/text.js +1 -1
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author James Baicoianu / http://www.baicoianu.com/
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
THREE.FlyControls = function ( object, domElement ) {
|
|
6
|
+
|
|
7
|
+
this.object = object;
|
|
8
|
+
|
|
9
|
+
this.domElement = ( domElement !== undefined ) ? domElement : document;
|
|
10
|
+
if ( domElement ) this.domElement.setAttribute( 'tabindex', -1 );
|
|
11
|
+
|
|
12
|
+
// API
|
|
13
|
+
|
|
14
|
+
this.movementSpeed = 1.0;
|
|
15
|
+
this.rollSpeed = 0.005;
|
|
16
|
+
|
|
17
|
+
this.dragToLook = false;
|
|
18
|
+
this.autoForward = false;
|
|
19
|
+
|
|
20
|
+
// disable default target object behavior
|
|
21
|
+
|
|
22
|
+
//this.object.useQuaternion = true;
|
|
23
|
+
|
|
24
|
+
// internals
|
|
25
|
+
|
|
26
|
+
this.tmpQuaternion = new THREE.Quaternion();
|
|
27
|
+
|
|
28
|
+
this.mouseStatus = 0;
|
|
29
|
+
|
|
30
|
+
this.moveState = { up: 0, down: 0, left: 0, right: 0, forward: 0, back: 0, pitchUp: 0, pitchDown: 0, yawLeft: 0, yawRight: 0, rollLeft: 0, rollRight: 0 };
|
|
31
|
+
this.moveVector = new THREE.Vector3( 0, 0, 0 );
|
|
32
|
+
this.rotationVector = new THREE.Vector3( 0, 0, 0 );
|
|
33
|
+
|
|
34
|
+
this.handleEvent = function ( event ) {
|
|
35
|
+
|
|
36
|
+
if ( typeof this[ event.type ] == 'function' ) {
|
|
37
|
+
|
|
38
|
+
this[ event.type ]( event );
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
this.keydown = function( event ) {
|
|
45
|
+
|
|
46
|
+
if ( event.altKey ) {
|
|
47
|
+
|
|
48
|
+
return;
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//event.preventDefault();
|
|
53
|
+
|
|
54
|
+
switch ( event.keyCode ) {
|
|
55
|
+
|
|
56
|
+
case 16: /* shift */ this.movementSpeedMultiplier = .1; break;
|
|
57
|
+
|
|
58
|
+
case 87: /*W*/ this.moveState.forward = 1; break;
|
|
59
|
+
case 83: /*S*/ this.moveState.back = 1; break;
|
|
60
|
+
|
|
61
|
+
case 65: /*A*/ this.moveState.left = 1; break;
|
|
62
|
+
case 68: /*D*/ this.moveState.right = 1; break;
|
|
63
|
+
|
|
64
|
+
case 82: /*R*/ this.moveState.up = 1; break;
|
|
65
|
+
case 70: /*F*/ this.moveState.down = 1; break;
|
|
66
|
+
|
|
67
|
+
case 38: /*up*/ this.moveState.pitchUp = 1; break;
|
|
68
|
+
case 40: /*down*/ this.moveState.pitchDown = 1; break;
|
|
69
|
+
|
|
70
|
+
case 37: /*left*/ this.moveState.yawLeft = 1; break;
|
|
71
|
+
case 39: /*right*/ this.moveState.yawRight = 1; break;
|
|
72
|
+
|
|
73
|
+
case 81: /*Q*/ this.moveState.rollLeft = 1; break;
|
|
74
|
+
case 69: /*E*/ this.moveState.rollRight = 1; break;
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.updateMovementVector();
|
|
79
|
+
this.updateRotationVector();
|
|
80
|
+
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.keyup = function( event ) {
|
|
84
|
+
|
|
85
|
+
switch( event.keyCode ) {
|
|
86
|
+
|
|
87
|
+
case 16: /* shift */ this.movementSpeedMultiplier = 1; break;
|
|
88
|
+
|
|
89
|
+
case 87: /*W*/ this.moveState.forward = 0; break;
|
|
90
|
+
case 83: /*S*/ this.moveState.back = 0; break;
|
|
91
|
+
|
|
92
|
+
case 65: /*A*/ this.moveState.left = 0; break;
|
|
93
|
+
case 68: /*D*/ this.moveState.right = 0; break;
|
|
94
|
+
|
|
95
|
+
case 82: /*R*/ this.moveState.up = 0; break;
|
|
96
|
+
case 70: /*F*/ this.moveState.down = 0; break;
|
|
97
|
+
|
|
98
|
+
case 38: /*up*/ this.moveState.pitchUp = 0; break;
|
|
99
|
+
case 40: /*down*/ this.moveState.pitchDown = 0; break;
|
|
100
|
+
|
|
101
|
+
case 37: /*left*/ this.moveState.yawLeft = 0; break;
|
|
102
|
+
case 39: /*right*/ this.moveState.yawRight = 0; break;
|
|
103
|
+
|
|
104
|
+
case 81: /*Q*/ this.moveState.rollLeft = 0; break;
|
|
105
|
+
case 69: /*E*/ this.moveState.rollRight = 0; break;
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.updateMovementVector();
|
|
110
|
+
this.updateRotationVector();
|
|
111
|
+
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
this.mousedown = function( event ) {
|
|
115
|
+
|
|
116
|
+
if ( this.domElement !== document ) {
|
|
117
|
+
|
|
118
|
+
this.domElement.focus();
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
|
|
125
|
+
if ( this.dragToLook && event.button == 0) {
|
|
126
|
+
|
|
127
|
+
this.mouseStatus ++;
|
|
128
|
+
|
|
129
|
+
} else {
|
|
130
|
+
|
|
131
|
+
switch ( event.button ) {
|
|
132
|
+
|
|
133
|
+
case 0: this.object.moveForward = true; break;
|
|
134
|
+
case 2: this.object.moveBackward = true; break;
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
this.mousemove = function( event ) {
|
|
143
|
+
|
|
144
|
+
if ( !this.dragToLook || this.mouseStatus > 0 ) {
|
|
145
|
+
|
|
146
|
+
var container = this.getContainerDimensions();
|
|
147
|
+
var halfWidth = container.size[ 0 ] / 2;
|
|
148
|
+
var halfHeight = container.size[ 1 ] / 2;
|
|
149
|
+
|
|
150
|
+
this.moveState.yawLeft = - ( ( event.pageX - container.offset[ 0 ] ) - halfWidth ) / halfWidth;
|
|
151
|
+
this.moveState.pitchDown = ( ( event.pageY - container.offset[ 1 ] ) - halfHeight ) / halfHeight;
|
|
152
|
+
|
|
153
|
+
this.updateRotationVector();
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
this.mouseup = function( event ) {
|
|
160
|
+
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
|
|
164
|
+
if ( this.dragToLook && event.button == 0) {
|
|
165
|
+
|
|
166
|
+
this.mouseStatus --;
|
|
167
|
+
|
|
168
|
+
this.moveState.yawLeft = this.moveState.pitchDown = 0;
|
|
169
|
+
|
|
170
|
+
} else {
|
|
171
|
+
|
|
172
|
+
switch ( event.button ) {
|
|
173
|
+
|
|
174
|
+
case 0: this.moveForward = false; break;
|
|
175
|
+
case 2: this.moveBackward = false; break;
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
this.updateRotationVector();
|
|
182
|
+
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
this.update = function( delta ) {
|
|
186
|
+
|
|
187
|
+
var moveMult = delta * this.movementSpeed;
|
|
188
|
+
var rotMult = delta * this.rollSpeed;
|
|
189
|
+
var changed = false;
|
|
190
|
+
var lastPosition = this.object.position.clone();
|
|
191
|
+
|
|
192
|
+
if (this.moveVector.lengthSq() > 1e-6) {
|
|
193
|
+
this.object.translateX( this.moveVector.x * moveMult );
|
|
194
|
+
this.object.translateY( this.moveVector.y * moveMult );
|
|
195
|
+
this.object.translateZ( this.moveVector.z * moveMult );
|
|
196
|
+
this.object.matrix.setPosition( this.object.position );
|
|
197
|
+
changed = true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (this.rotationVector.lengthSq() > 1e-6) {
|
|
201
|
+
this.tmpQuaternion.set( this.rotationVector.x * rotMult, this.rotationVector.y * rotMult, this.rotationVector.z * rotMult, 1 ).normalize();
|
|
202
|
+
this.object.quaternion.multiply( this.tmpQuaternion );
|
|
203
|
+
this.object.matrix.makeRotationFromQuaternion( this.object.quaternion );
|
|
204
|
+
changed = true;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (changed) {
|
|
208
|
+
this.object.matrixWorldNeedsUpdate = true;
|
|
209
|
+
var changeEvent = { type: 'change' };
|
|
210
|
+
changeEvent.data = { lastPosition: lastPosition.toArray(), position: this.object.position.toArray(), distance: lastPosition.distanceTo( this.object.position ) };
|
|
211
|
+
this.dispatchEvent( changeEvent );
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
this.updateMovementVector = function() {
|
|
217
|
+
|
|
218
|
+
var forward = ( this.moveState.forward || ( this.autoForward && !this.moveState.back ) ) ? 1 : 0;
|
|
219
|
+
|
|
220
|
+
this.moveVector.x = ( -this.moveState.left + this.moveState.right );
|
|
221
|
+
this.moveVector.y = ( -this.moveState.down + this.moveState.up );
|
|
222
|
+
this.moveVector.z = ( -forward + this.moveState.back );
|
|
223
|
+
|
|
224
|
+
//console.log( 'move:', [ this.moveVector.x, this.moveVector.y, this.moveVector.z ] );
|
|
225
|
+
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
this.updateRotationVector = function() {
|
|
229
|
+
|
|
230
|
+
this.rotationVector.x = ( -this.moveState.pitchDown + this.moveState.pitchUp );
|
|
231
|
+
this.rotationVector.y = ( -this.moveState.yawRight + this.moveState.yawLeft );
|
|
232
|
+
this.rotationVector.z = ( -this.moveState.rollRight + this.moveState.rollLeft );
|
|
233
|
+
|
|
234
|
+
//console.log( 'rotate:', [ this.rotationVector.x, this.rotationVector.y, this.rotationVector.z ] );
|
|
235
|
+
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
this.getContainerDimensions = function() {
|
|
239
|
+
|
|
240
|
+
if ( this.domElement != document ) {
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
size : [ this.domElement.offsetWidth, this.domElement.offsetHeight ],
|
|
244
|
+
offset : [ this.domElement.offsetLeft, this.domElement.offsetTop ]
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
} else {
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
size : [ window.innerWidth, window.innerHeight ],
|
|
251
|
+
offset : [ 0, 0 ]
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
function bind( scope, fn ) {
|
|
259
|
+
|
|
260
|
+
return function () {
|
|
261
|
+
|
|
262
|
+
fn.apply( scope, arguments );
|
|
263
|
+
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
};
|
|
267
|
+
this.enable = function() {
|
|
268
|
+
if (!this.enabled) {
|
|
269
|
+
this.bindings = {
|
|
270
|
+
'mousedown': bind(this, this.mousedown),
|
|
271
|
+
'mousemove': bind(this, this.mousemove),
|
|
272
|
+
'mouseup': bind(this, this.mouseup),
|
|
273
|
+
'keydown': bind(this, this.keydown),
|
|
274
|
+
'keyup': bind(this, this.keyup),
|
|
275
|
+
};
|
|
276
|
+
for (var k in this.bindings) {
|
|
277
|
+
this.domElement.addEventListener( k, this.bindings[k], false );
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
this.enabled = true;
|
|
281
|
+
}
|
|
282
|
+
this.disable = function() {
|
|
283
|
+
if (this.enabled) {
|
|
284
|
+
for (var k in this.bindings) {
|
|
285
|
+
this.domElement.removeEventListener( k, this.bindings[k], false );
|
|
286
|
+
}
|
|
287
|
+
this.enabled = false;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
this.updateMovementVector();
|
|
292
|
+
this.updateRotationVector();
|
|
293
|
+
|
|
294
|
+
};
|
|
295
|
+
THREE.FlyControls.prototype = Object.create( THREE.EventDispatcher.prototype );
|