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.
Files changed (91) hide show
  1. package/css/systems/render.css +5 -1
  2. package/package.json +1 -1
  3. package/scripts/assets.js +103 -20
  4. package/scripts/assetworker.js +18 -1
  5. package/scripts/external/holoplay.js +1494 -0
  6. package/scripts/external/octree.js +0 -0
  7. package/scripts/external/three/CSS3DRenderer.js +46 -43
  8. package/scripts/external/three/CubemapToEquirectangular.js +1 -1
  9. package/scripts/external/three/three-extras.js +1553 -392
  10. package/scripts/external/three/three-icosa.js +2575 -0
  11. package/scripts/external/three/three-loaders.js +925 -133
  12. package/scripts/external/three/three-postprocessing.js +3 -3
  13. package/scripts/external/three/three-r116dev.js +50930 -0
  14. package/scripts/external/three/three-spotlighttextures.js +50953 -0
  15. package/scripts/external/three/three-vrm.js +2 -2
  16. package/scripts/external/three/three-working.js +35968 -0
  17. package/scripts/external/three/three.js +38532 -24087
  18. package/scripts/external/three-mesh-bvh.js +5370 -0
  19. package/scripts/external/three-old/BVHLoader.js +406 -0
  20. package/scripts/external/three-old/ColladaLoader.js +5519 -0
  21. package/scripts/external/three-old/ColladaLoader2.js +1694 -0
  22. package/scripts/external/three-old/CubemapToEquirectangular.js +188 -0
  23. package/scripts/external/three-old/DDSLoader.js +269 -0
  24. package/scripts/external/three-old/FBXLoader-mine.js +5063 -0
  25. package/scripts/external/three-old/FBXLoader.js +5112 -0
  26. package/scripts/external/three-old/FlyControls.js +295 -0
  27. package/scripts/external/three-old/GLTF2Loader.js +2950 -0
  28. package/scripts/external/three-old/GLTFLoader.js +2213 -0
  29. package/scripts/external/three-old/JSONLoader.js +435 -0
  30. package/scripts/external/three-old/MTLLoader.js +533 -0
  31. package/scripts/external/three-old/OBJLoader-experimental.js +874 -0
  32. package/scripts/external/three-old/OBJLoader-working.js +727 -0
  33. package/scripts/external/three-old/OBJLoader.js +723 -0
  34. package/scripts/external/three-old/OBJMTLLoader.js +440 -0
  35. package/scripts/external/three-old/OrbitControls.js +592 -0
  36. package/scripts/external/three-old/PLYLoader.js +517 -0
  37. package/scripts/external/three-old/TransformControls.js +1100 -0
  38. package/scripts/external/three-old/VRMLLoader.js +1021 -0
  39. package/scripts/external/three-old/glTFLoader-combined.js +2513 -0
  40. package/scripts/external/three-old/nodethree.js +44018 -0
  41. package/scripts/external/three-old/render/BleachBypassShader.js +64 -0
  42. package/scripts/external/three-old/render/BloomPass.js +116 -0
  43. package/scripts/external/three-old/render/CSS3DRenderer.js +310 -0
  44. package/scripts/external/three-old/render/ClearPass.js +44 -0
  45. package/scripts/external/three-old/render/ConvolutionShader.js +101 -0
  46. package/scripts/external/three-old/render/CopyShader.js +46 -0
  47. package/scripts/external/three-old/render/EffectComposer.js +211 -0
  48. package/scripts/external/three-old/render/FXAAShader.js +88 -0
  49. package/scripts/external/three-old/render/FilmPass.js +60 -0
  50. package/scripts/external/three-old/render/FilmShader.js +104 -0
  51. package/scripts/external/three-old/render/ManualMSAARenderPass.js +168 -0
  52. package/scripts/external/three-old/render/MaskPass.js +97 -0
  53. package/scripts/external/three-old/render/OculusRenderPass.js +84 -0
  54. package/scripts/external/three-old/render/OculusRiftEffect.js +240 -0
  55. package/scripts/external/three-old/render/PortalRenderPass.js +166 -0
  56. package/scripts/external/three-old/render/RecordingPass.js +208 -0
  57. package/scripts/external/three-old/render/RenderPass.js +57 -0
  58. package/scripts/external/three-old/render/SSAOShader.js +259 -0
  59. package/scripts/external/three-old/render/SepiaShader.js +54 -0
  60. package/scripts/external/three-old/render/ShaderPass.js +66 -0
  61. package/scripts/external/three-old/render/VREffect.js +482 -0
  62. package/scripts/external/three-old/shimthree.js +23 -0
  63. package/scripts/external/three-old/stats.js +6 -0
  64. package/scripts/external/three-old/three-88dev.js +45004 -0
  65. package/scripts/external/three-old/three-backgroundoptimization.js +44432 -0
  66. package/scripts/external/three-old/three-updates.js +44735 -0
  67. package/scripts/external/three-old/three-working.js +44719 -0
  68. package/scripts/external/three-old/three.js +44431 -0
  69. package/scripts/external/three-old/threex.rendererstats.js +66 -0
  70. package/scripts/external/three-old/tween.js +13 -0
  71. package/scripts/external/webvr-polyfill-new.js +3497 -0
  72. package/scripts/external/webvr-polyfill-newest.js +3491 -0
  73. package/scripts/external/webvr-polyfill-old.js +6337 -0
  74. package/scripts/geometries.js +2 -2
  75. package/scripts/math.js +6 -6
  76. package/scripts/systems/admin.js +1 -1
  77. package/scripts/systems/controls.js +6 -4
  78. package/scripts/systems/physics.js +10 -10
  79. package/scripts/systems/render.js +58 -20
  80. package/scripts/systems/render2.js +38 -0
  81. package/scripts/things/camera.js +6 -1
  82. package/scripts/things/generic-trackedvectors.js +1875 -0
  83. package/scripts/things/generic.js +3 -4
  84. package/scripts/things/label2d.js +1 -1
  85. package/scripts/things/leapmotion.js +6 -6
  86. package/scripts/things/menu.js +1 -1
  87. package/scripts/things/player-bak.js +638 -0
  88. package/scripts/things/player.js +28 -10
  89. package/scripts/things/skysphere.js +1 -1
  90. package/scripts/things/terrain.js +1 -1
  91. 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 );