janusweb 1.5.42 → 1.5.43
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/CHANGELOG +23 -0
- package/css/janusweb.css +7 -2
- package/media/assets/webui/apps/buttons/buttons.js +17 -3
- package/media/assets/webui/apps/comms/comms.js +1 -1
- package/media/assets/webui/apps/comms/voip.css +12 -3
- package/media/assets/webui/apps/comms/voip.js +16 -6
- package/media/assets/webui/apps/editor/editor.css +1 -0
- package/media/assets/webui/apps/editor/editor.js +19 -12
- package/media/assets/webui/apps/locomotion/teleporter.js +3 -2
- package/media/assets/webui/apps/xrmenu/images/audio-settings.png +0 -0
- package/media/assets/webui/apps/xrmenu/xrmenu-assets.json +2 -1
- package/media/assets/webui/apps/xrmenu/xrmenu.js +109 -27
- package/media/assets/webui/themes/default.css +42 -0
- package/package.json +2 -2
- package/scripts/client.js +1 -1
- package/scripts/elements/outliner.js +7 -1
- package/scripts/external/JanusClientConnection.js +14 -8
- package/scripts/image.js +1 -1
- package/scripts/janusbase.js +37 -15
- package/scripts/janusghost.js +8 -6
- package/scripts/januslight.js +46 -4
- package/scripts/janusparticle.js +116 -13
- package/scripts/janusplayer.js +59 -12
- package/scripts/janusweb.js +1 -1
- package/scripts/janusxrplayer.js +104 -14
- package/scripts/object.js +63 -30
- package/scripts/parts.js +1 -1
- package/scripts/portal.js +13 -9
- package/scripts/remoteplayer.js +3 -2
- package/scripts/room.js +86 -22
- package/scripts/text.js +7 -2
- package/scripts/websurface.js +3 -3
|
@@ -59,7 +59,13 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
59
59
|
this.outlinematerial.side = THREE.BackSide;
|
|
60
60
|
//this.outlinematerial.blending = THREE.AdditiveBlending;
|
|
61
61
|
|
|
62
|
-
if (this.target)
|
|
62
|
+
if (this.target) {
|
|
63
|
+
this.updateTarget();
|
|
64
|
+
} else {
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
this.select(this.children[0]);
|
|
67
|
+
}, 50);
|
|
68
|
+
}
|
|
63
69
|
},
|
|
64
70
|
select(object) {
|
|
65
71
|
this.selected = object;
|
|
@@ -329,9 +329,7 @@ JanusClientConnection.prototype.connect = function() {
|
|
|
329
329
|
this.status = 2;
|
|
330
330
|
this._useridSuffix = '';
|
|
331
331
|
this.sendLogon();
|
|
332
|
-
|
|
333
|
-
this.send(this.msgQueue.shift());
|
|
334
|
-
}
|
|
332
|
+
this.sendQueuedCommands()
|
|
335
333
|
this.dispatchEvent({type: 'connect'});
|
|
336
334
|
}.bind(this);
|
|
337
335
|
|
|
@@ -362,6 +360,15 @@ JanusClientConnection.prototype.disconnect = function() {
|
|
|
362
360
|
this.dispatchEvent({type: 'disconnecting'});
|
|
363
361
|
this._websocket.close();
|
|
364
362
|
}
|
|
363
|
+
JanusClientConnection.prototype.sendQueuedCommands = function() {
|
|
364
|
+
if (this._websocket.readyState > 0) {
|
|
365
|
+
while (this.msgQueue.length > 0) {
|
|
366
|
+
this.send(this.msgQueue.shift());
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
setTimeout(() => this.sendQueuedCommands(), 100);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
365
372
|
|
|
366
373
|
JanusClientConnection.prototype.sendLogon = function() {
|
|
367
374
|
var msgData = {
|
|
@@ -385,13 +392,12 @@ JanusClientConnection.prototype.setUserId = function(userId) {
|
|
|
385
392
|
};
|
|
386
393
|
|
|
387
394
|
JanusClientConnection.prototype.send = function(msg) {
|
|
388
|
-
|
|
389
|
-
this.msgQueue.push(msg);
|
|
390
|
-
} else if (this._websocket.readyState == 1) {
|
|
395
|
+
try {
|
|
391
396
|
this._websocket.send(JSON.stringify(msg) + '\r\n');
|
|
392
|
-
}
|
|
393
|
-
|
|
397
|
+
} catch (e) {
|
|
398
|
+
this.msgQueue.push(msg);
|
|
394
399
|
}
|
|
400
|
+
//this.reconnect();
|
|
395
401
|
};
|
|
396
402
|
|
|
397
403
|
JanusClientConnection.prototype.onMessage = function(msg) {
|
package/scripts/image.js
CHANGED
|
@@ -37,7 +37,7 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
37
37
|
this.createGeometry = function() {
|
|
38
38
|
var aspect = this.getAspect(),
|
|
39
39
|
thickness = 0.1; //Math.max(this.scale.x, this.scale.z) / (10 * this.scale.z);
|
|
40
|
-
var box = new THREE.
|
|
40
|
+
var box = new THREE.BoxGeometry(2, 2 * aspect, thickness);
|
|
41
41
|
box.applyMatrix4(new THREE.Matrix4().makeTranslation(0, 0, thickness / this.scale.z));
|
|
42
42
|
|
|
43
43
|
// Flip the back face for images
|
package/scripts/janusbase.js
CHANGED
|
@@ -231,7 +231,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
this.createForces = function() {
|
|
234
|
-
if (this.collidable
|
|
234
|
+
if (this.collidable || this.collision_trigger) {
|
|
235
235
|
elation.events.add(this.objects.dynamics, 'physics_collide', elation.bind(this, this.handleCollision));
|
|
236
236
|
}
|
|
237
237
|
this.updateRotationSpeed();
|
|
@@ -597,13 +597,16 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
597
597
|
sbs3d: args.sbs3d,
|
|
598
598
|
ou3d: args.ou3d,
|
|
599
599
|
eac360: args.eac360,
|
|
600
|
+
vr180: args.vr180,
|
|
600
601
|
hasalpha: args.hasalpha,
|
|
601
602
|
auto_play: args.auto_play,
|
|
602
603
|
type: args.type,
|
|
603
604
|
format: args.format,
|
|
604
605
|
hls: args.hls,
|
|
605
606
|
preload: args.preload,
|
|
606
|
-
baseurl: this.baseurl
|
|
607
|
+
baseurl: this.baseurl,
|
|
608
|
+
proxy: args.proxy,
|
|
609
|
+
extratracks: args.extratracks,
|
|
607
610
|
});
|
|
608
611
|
} else if (args.video) {
|
|
609
612
|
assetlist.push({
|
|
@@ -613,12 +616,15 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
613
616
|
loop: args.loop,
|
|
614
617
|
sbs3d: args.sbs3d,
|
|
615
618
|
ou3d: args.ou3d,
|
|
619
|
+
vr180: args.vr180,
|
|
616
620
|
hasalpha: args.hasalpha,
|
|
617
621
|
auto_play: args.auto_play,
|
|
618
622
|
type: args.type,
|
|
619
623
|
format: args.format,
|
|
620
624
|
hls: args.hls,
|
|
621
|
-
baseurl: this.baseurl
|
|
625
|
+
baseurl: this.baseurl,
|
|
626
|
+
proxy: args.proxy,
|
|
627
|
+
extratracks: args.extratracks,
|
|
622
628
|
});
|
|
623
629
|
}
|
|
624
630
|
} else if (type == 'sound') {
|
|
@@ -796,7 +802,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
796
802
|
}
|
|
797
803
|
parent.worldToLocal(camera.getWorldPosition(playerpos)).sub(this.position);
|
|
798
804
|
dir.copy(playerpos).normalize();
|
|
799
|
-
if (billboard == 'y') {
|
|
805
|
+
if (billboard == 'y' || billboard === true || billboard == 'true') {
|
|
800
806
|
this.rotation.radians.set(0, Math.atan2(dir.x, dir.z), 0);
|
|
801
807
|
this.frameupdates['rotation'] = true;
|
|
802
808
|
}
|
|
@@ -818,10 +824,12 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
818
824
|
this.refresh();
|
|
819
825
|
}
|
|
820
826
|
|
|
827
|
+
/*
|
|
821
828
|
let pos = this.position;
|
|
822
829
|
if (isNaN(pos.x)) pos.x = 0;
|
|
823
830
|
if (isNaN(pos.y)) pos.y = 0;
|
|
824
831
|
if (isNaN(pos.z)) pos.z = 0;
|
|
832
|
+
*/
|
|
825
833
|
|
|
826
834
|
if (this.properties.color === this.defaultcolor && (this.properties.color.r != 1 || this.properties.color.g != 1 || this.properties.color.b != 1)) {
|
|
827
835
|
this.updateColor();
|
|
@@ -830,7 +838,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
830
838
|
this.resetFrameUpdates();
|
|
831
839
|
this.dispatchEvent({type: 'update', data: ev.data, bubbles: false});
|
|
832
840
|
var proxy = this.getProxyObject();
|
|
833
|
-
if (typeof proxy.update == 'function'
|
|
841
|
+
if (this.created && typeof proxy.update == 'function') {
|
|
834
842
|
proxy.update(ev.data);
|
|
835
843
|
}
|
|
836
844
|
}
|
|
@@ -979,13 +987,13 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
979
987
|
if (other) {
|
|
980
988
|
if (other.getProxyObject) {
|
|
981
989
|
var proxy = other.getProxyObject();
|
|
982
|
-
//console.log('I collided', proxy, this);
|
|
990
|
+
//console.log('I collided', this.collision_trigger, other.collision_trigger, proxy, this);
|
|
983
991
|
|
|
984
|
-
if (this.collision_trigger || proxy.collision_trigger) {
|
|
992
|
+
if (this.collision_trigger || proxy.collision_trigger || other.collision_trigger) {
|
|
985
993
|
this.dispatchEvent({type: 'trigger', data: { collision: ev.data, other: proxy }});
|
|
986
994
|
ev.preventDefault();
|
|
987
995
|
ev.stopPropagation();
|
|
988
|
-
} else if (this.collidable) {
|
|
996
|
+
} else if (this.collidable && other.collidable) {
|
|
989
997
|
this.dispatchEvent({type: 'collision', data: { collision: ev.data, other: proxy }});
|
|
990
998
|
} else {
|
|
991
999
|
ev.preventDefault();
|
|
@@ -1031,7 +1039,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
1031
1039
|
}
|
|
1032
1040
|
this.updateAnimation = function() {
|
|
1033
1041
|
// Triggered whenever this.anim_id changes
|
|
1034
|
-
if (this.anim_id) {
|
|
1042
|
+
if (this.anim_id || !this.activeanimation) {
|
|
1035
1043
|
this.setAnimation(this.anim_id);
|
|
1036
1044
|
} else if (this.activeanimation) {
|
|
1037
1045
|
this.stopAnimation();
|
|
@@ -1052,7 +1060,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
1052
1060
|
if (!this.fadetimers[clipname]) {
|
|
1053
1061
|
// FIXME - for some reason, THREE.AnimationAction.fadeIn() / fadeOut() / etc are just causing the animations to stop, so we'll handle fading ourselves
|
|
1054
1062
|
this.fadetimers[clipname] = setInterval(() => {
|
|
1055
|
-
oldaction.weight *= .
|
|
1063
|
+
oldaction.weight *= .9;
|
|
1056
1064
|
if (oldaction.weight <= .001) {
|
|
1057
1065
|
oldaction.weight = 0;
|
|
1058
1066
|
oldaction.stop();
|
|
@@ -1088,10 +1096,12 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
1088
1096
|
if (!event.target) {
|
|
1089
1097
|
event.target = target || event.element;
|
|
1090
1098
|
}
|
|
1099
|
+
/*
|
|
1091
1100
|
var handlerfn = 'on' + event.type;
|
|
1092
1101
|
if (handlerfn in this) {
|
|
1093
1102
|
this.executeCallback(this[handlerfn], event);
|
|
1094
1103
|
}
|
|
1104
|
+
*/
|
|
1095
1105
|
// Bubble event up to parents, unless the event was thrown with bubbling disabled or an event handler called stopPropagation()
|
|
1096
1106
|
let firedev = elation.events.fire(event);
|
|
1097
1107
|
let returnValue = true;
|
|
@@ -1172,7 +1182,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
1172
1182
|
this.raycast = (function() {
|
|
1173
1183
|
var _pos = new THREE.Vector3(),
|
|
1174
1184
|
_dir = new THREE.Vector3(0,0,-1);
|
|
1175
|
-
return function(dir, offset, classname, maxdist) {
|
|
1185
|
+
return function(dir, offset, classname, maxdist, colliderroot=null) {
|
|
1176
1186
|
if (!this.room) return [];
|
|
1177
1187
|
if (dir) {
|
|
1178
1188
|
_dir.copy(dir);
|
|
@@ -1185,7 +1195,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
1185
1195
|
}
|
|
1186
1196
|
this.localToWorld(_pos);
|
|
1187
1197
|
this.objects.dynamics.localToWorldDir(_dir);
|
|
1188
|
-
return this.room.raycast(_dir, _pos, classname, maxdist);
|
|
1198
|
+
return this.room.raycast(_dir, _pos, classname, maxdist, colliderroot);
|
|
1189
1199
|
};
|
|
1190
1200
|
})();
|
|
1191
1201
|
this.getElementsByTagName = function(tagname, elements) {
|
|
@@ -1282,9 +1292,9 @@ console.log('its null', k, this[k], prop);
|
|
|
1282
1292
|
// Special handling for 'rotation' and 'color'
|
|
1283
1293
|
if (realkey == 'rotation') {
|
|
1284
1294
|
/*
|
|
1285
|
-
props['rotation'][0] *= THREE.
|
|
1286
|
-
props['rotation'][1] *= THREE.
|
|
1287
|
-
props['rotation'][2] *= THREE.
|
|
1295
|
+
props['rotation'][0] *= THREE.MathUtils.RAD2DEG;
|
|
1296
|
+
props['rotation'][1] *= THREE.MathUtils.RAD2DEG;
|
|
1297
|
+
props['rotation'][2] *= THREE.MathUtils.RAD2DEG;
|
|
1288
1298
|
*/
|
|
1289
1299
|
} else if (realkey == 'color') {
|
|
1290
1300
|
if (!this.colorIsDefault) {
|
|
@@ -1402,5 +1412,17 @@ console.log('clone', props);
|
|
|
1402
1412
|
}
|
|
1403
1413
|
return false;
|
|
1404
1414
|
}
|
|
1415
|
+
this.physics_collide = function(ev) {
|
|
1416
|
+
let obj1 = ev.data.bodies[0].object, obj2 = ev.data.bodies[1].object,
|
|
1417
|
+
other = (obj1 == this ? obj2 : obj1);
|
|
1418
|
+
|
|
1419
|
+
let events = elation.events.fire({type: 'collide', element: this, data: {
|
|
1420
|
+
other: (typeof other.getProxyObject == 'function' ? other.getProxyObject() : other),
|
|
1421
|
+
collision: ev.data
|
|
1422
|
+
} });
|
|
1423
|
+
if (elation.events.wasDefaultPrevented(events)) {
|
|
1424
|
+
ev.preventDefault();
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1405
1427
|
}, elation.engine.things.generic);
|
|
1406
1428
|
});
|
package/scripts/janusghost.js
CHANGED
|
@@ -33,8 +33,8 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
33
33
|
diffuseColor.rgb *= vColor;
|
|
34
34
|
#endif
|
|
35
35
|
float dist = length(vViewPosition);
|
|
36
|
-
float mindist = .
|
|
37
|
-
float maxdist = .
|
|
36
|
+
float mindist = .2;
|
|
37
|
+
float maxdist = .4;
|
|
38
38
|
if (dist < maxdist) {
|
|
39
39
|
diffuseColor.a = clamp(((dist - mindist) / (maxdist - mindist)), 0., 1.);
|
|
40
40
|
}
|
|
@@ -131,13 +131,11 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
131
131
|
this.ghostassets = assets;
|
|
132
132
|
this.assetpack = elation.engine.assets.loadJSON(assets.assetlist);
|
|
133
133
|
} else {
|
|
134
|
-
|
|
135
|
-
this.assetpack.loadJSON(assets.assetlist);
|
|
134
|
+
this.assetpack.loadJSON(assets.assetlist, true);
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
let animnames = []; //'idle', 'walk', 'walk_left', 'walk_right', 'walk_back', 'run', 'jump', 'fly', 'speak', 'type', 'portal'];
|
|
139
138
|
let animassets = assets.assetlist.filter(asset => animnames.indexOf(asset.name) != -1);
|
|
140
|
-
console.log('some ghost animations', animassets, assets);
|
|
141
139
|
|
|
142
140
|
if (!this.animationmixer) {
|
|
143
141
|
// Set up our animation mixer with a simple bone mapper for our head. We'll add more animations to this ass other assets load
|
|
@@ -341,7 +339,7 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
341
339
|
if (this.body.animationmixer) {
|
|
342
340
|
this.cloneAnimations(animasset);
|
|
343
341
|
}
|
|
344
|
-
|
|
342
|
+
this.body.setAnimation('idle');
|
|
345
343
|
}
|
|
346
344
|
});
|
|
347
345
|
animasset.load();
|
|
@@ -664,9 +662,13 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
664
662
|
}
|
|
665
663
|
if (ghostdef.head_id) {
|
|
666
664
|
this.setHead(ghostdef.head_id, headpos, ghostdef.scale);
|
|
665
|
+
} else if (this.head) {
|
|
666
|
+
this.setHead(false);
|
|
667
667
|
}
|
|
668
668
|
if (ghostdef.body_id) {
|
|
669
669
|
this.setBody(ghostdef.body_id, ghostdef.scale, ghostdef.pos);
|
|
670
|
+
} else if (this.body) {
|
|
671
|
+
this.setBody(false);
|
|
670
672
|
}
|
|
671
673
|
if (ghostdef._children) {
|
|
672
674
|
for (var type in ghostdef._children) {
|
package/scripts/januslight.js
CHANGED
|
@@ -20,6 +20,7 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
20
20
|
light_helper: { type: 'boolean', default: false, set: this.updateLightHelper },
|
|
21
21
|
light_style: { type: 'string', default: '' },
|
|
22
22
|
light_style_fps: { type: 'float', default: 10 },
|
|
23
|
+
color_temperature: { type: 'float', set: this.updateLight },
|
|
23
24
|
collision_id: { type: 'string', default: 'sphere', set: this.updateCollider },
|
|
24
25
|
collision_trigger: { type: 'boolean', default: true, set: this.updateCollider },
|
|
25
26
|
});
|
|
@@ -73,14 +74,14 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
73
74
|
this.getPlaceholderGeometry = function() {
|
|
74
75
|
let placeholdergeo = null;
|
|
75
76
|
if (this.light_cone_angle == 0) {
|
|
76
|
-
placeholdergeo = new THREE.
|
|
77
|
+
placeholdergeo = new THREE.SphereGeometry(.1);
|
|
77
78
|
} else if (this.light_cone_angle == 1) {
|
|
78
|
-
placeholdergeo = new THREE.
|
|
79
|
+
placeholdergeo = new THREE.SphereGeometry(.1);
|
|
79
80
|
} else {
|
|
80
81
|
let angle = Math.acos(this.light_cone_angle),
|
|
81
82
|
height = this.light_shadow_near,
|
|
82
83
|
radius = Math.tan(angle) * height;
|
|
83
|
-
placeholdergeo = new THREE.
|
|
84
|
+
placeholdergeo = new THREE.ConeGeometry(radius, height);
|
|
84
85
|
placeholdergeo.applyMatrix4(new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(-Math.PI/2, 0, 0)).setPosition(0, 0, height / 2));
|
|
85
86
|
}
|
|
86
87
|
return placeholdergeo;
|
|
@@ -139,7 +140,11 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
139
140
|
this.light.intensity = .1;
|
|
140
141
|
this.light.penumbra = this.light_penumbra;
|
|
141
142
|
this.light.decay = this.light_decay;
|
|
142
|
-
|
|
143
|
+
if (this.color_temperature) {
|
|
144
|
+
this.light.color.copy(this.temperatureToRGB(this.color_temperature));
|
|
145
|
+
} else {
|
|
146
|
+
this.light.color.copy(this.color);
|
|
147
|
+
}
|
|
143
148
|
this.light.color.multiplyScalar(this.light_intensity * avgscale * avgscale);
|
|
144
149
|
this.light.distance = this.light_range * avgscale;
|
|
145
150
|
if (this.light_cone_angle > 0 && this.light_cone_angle < 1) {
|
|
@@ -199,6 +204,42 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
199
204
|
this.light.shadow.camera.top = d;
|
|
200
205
|
this.light.shadow.camera.bottom = -d;
|
|
201
206
|
}
|
|
207
|
+
this.temperatureToRGB = function(t) {
|
|
208
|
+
// From view-source:https://web.archive.org/web/20161108193229/https://tommitytom.co.uk/colourtemp/
|
|
209
|
+
let r = 0, g = 0, b = 0,
|
|
210
|
+
temp = Math.floor(t / 100 + 0.5),
|
|
211
|
+
rgb = null;
|
|
212
|
+
|
|
213
|
+
if (temp <= 66) {
|
|
214
|
+
r = 255;
|
|
215
|
+
} else {
|
|
216
|
+
r = temp - 60;
|
|
217
|
+
r = 329.698727446 * Math.pow(r, -0.1332047592);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (temp <= 66) {
|
|
221
|
+
g = temp;
|
|
222
|
+
g = 99.4708025861 * Math.log(g) - 161.1195681661;
|
|
223
|
+
} else {
|
|
224
|
+
g = temp - 60;
|
|
225
|
+
g = 288.1221695283 * Math.pow(g, -0.0755148492);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (temp >= 66) {
|
|
229
|
+
b = 255;
|
|
230
|
+
} else if (temp <= 19) {
|
|
231
|
+
b = 0;
|
|
232
|
+
} else {
|
|
233
|
+
b = temp - 10;
|
|
234
|
+
b = 138.5177312231 * Math.log(b) - 305.0447927307;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
r = THREE.MathUtils.clamp(r, 0, 255) / 255;
|
|
238
|
+
g = THREE.MathUtils.clamp(g, 0, 255) / 255;
|
|
239
|
+
b = THREE.MathUtils.clamp(b, 0, 255) / 255;
|
|
240
|
+
|
|
241
|
+
return {r, g, b};
|
|
242
|
+
}
|
|
202
243
|
this.getProxyObject = function(classdef) {
|
|
203
244
|
if (!this._proxyobject) {
|
|
204
245
|
this._proxyobject = elation.engine.things.janusobject.extendclass.getProxyObject.call(this, classdef);
|
|
@@ -215,6 +256,7 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
215
256
|
light_shadow_far: [ 'property', 'light_shadow_far'],
|
|
216
257
|
light_shadow_bias: [ 'property', 'light_shadow_bias'],
|
|
217
258
|
light_shadow_radius: [ 'property', 'light_shadow_radius'],
|
|
259
|
+
color_temperature: [ 'property', 'color_temperature'],
|
|
218
260
|
};
|
|
219
261
|
}
|
|
220
262
|
return this._proxyobject;
|
package/scripts/janusparticle.js
CHANGED
|
@@ -285,7 +285,7 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
285
285
|
this.emitted = 0;
|
|
286
286
|
}
|
|
287
287
|
this.updateParticles = function(ev) {
|
|
288
|
-
if (!this.loaded || !this.started || !this.parent) return;
|
|
288
|
+
if (!this.loaded || !this.started || !this.parent || !this.visible) return;
|
|
289
289
|
var now = performance.now(),
|
|
290
290
|
elapsed = now - this.lasttime,
|
|
291
291
|
endtime = now + this.duration * 1000,
|
|
@@ -553,9 +553,10 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
553
553
|
|
|
554
554
|
point.active = 1;
|
|
555
555
|
|
|
556
|
-
var
|
|
557
|
-
|
|
558
|
-
|
|
556
|
+
var geo = this.geometry,
|
|
557
|
+
pos = geo.attributes.position.array,
|
|
558
|
+
color = geo.attributes.customColor.array,
|
|
559
|
+
size = geo.attributes.size.array;
|
|
559
560
|
|
|
560
561
|
if (newpos) {
|
|
561
562
|
point.pos.copy(newpos);
|
|
@@ -564,8 +565,14 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
564
565
|
pos[offset + 1] = newpos.y;
|
|
565
566
|
pos[offset + 2] = newpos.z;
|
|
566
567
|
|
|
567
|
-
|
|
568
|
-
this.updateBoundingSphere(newpos);
|
|
568
|
+
geo.attributes.position.needsUpdate = true;
|
|
569
|
+
//this.updateBoundingSphere(newpos);
|
|
570
|
+
if (!this.updateBoundingSphereTimer) {
|
|
571
|
+
this.updateBoundingSphereTimer = setTimeout(() => {
|
|
572
|
+
this.updateBoundingSphere(newpos);
|
|
573
|
+
this.updateBoundingSphereTimer = false;
|
|
574
|
+
}, 0);
|
|
575
|
+
}
|
|
569
576
|
}
|
|
570
577
|
|
|
571
578
|
if (newvel) {
|
|
@@ -582,23 +589,119 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
582
589
|
color[pointnum*4 ] = newcol.x;
|
|
583
590
|
color[pointnum*4 + 1] = newcol.y;
|
|
584
591
|
color[pointnum*4 + 2] = newcol.z;
|
|
585
|
-
color[pointnum*4 + 3] = elation.utils.any(point.opacity, this.opacity, 1);
|
|
592
|
+
color[pointnum*4 + 3] = elation.utils.any(point.opacity, this.properties.opacity, 1);
|
|
586
593
|
|
|
587
|
-
|
|
594
|
+
geo.attributes.customColor.needsUpdate = true;
|
|
588
595
|
}
|
|
589
596
|
if (newsize) {
|
|
590
597
|
point.size = newsize;
|
|
591
598
|
size[pointnum] = newsize;
|
|
592
599
|
|
|
593
|
-
|
|
600
|
+
geo.attributes.size.needsUpdate = true;
|
|
594
601
|
}
|
|
595
602
|
point.opacity = newopacity;
|
|
596
603
|
|
|
597
|
-
if (pointnum >= this.count) {
|
|
598
|
-
this.
|
|
599
|
-
|
|
600
|
-
|
|
604
|
+
if (pointnum >= this.properties.count) {
|
|
605
|
+
if (!this.updateParticleTimer) {
|
|
606
|
+
this.updateParticleTimer = setTimeout(() => {
|
|
607
|
+
this.count = this.particles.length;
|
|
608
|
+
this.createParticles(false);
|
|
609
|
+
this.updateParticleTimer = false;
|
|
610
|
+
}, 0);
|
|
611
|
+
}
|
|
601
612
|
}
|
|
602
613
|
}
|
|
614
|
+
this.setPoints = (function() {
|
|
615
|
+
let furthest = new THREE.Vector3();
|
|
616
|
+
return function(points) {
|
|
617
|
+
var geo = this.geometry,
|
|
618
|
+
pos = geo.attributes.position.array,
|
|
619
|
+
color = geo.attributes.customColor.array,
|
|
620
|
+
size = geo.attributes.size.array;
|
|
621
|
+
furthestDistSq = 0,
|
|
622
|
+
particles = this.particles;
|
|
623
|
+
for (let i = 0; i < points.length; i++) {
|
|
624
|
+
let point = particles[i],
|
|
625
|
+
newpoint = points[i],
|
|
626
|
+
offset = i * 3;
|
|
627
|
+
|
|
628
|
+
if (!point) {
|
|
629
|
+
point = this.createPoint();
|
|
630
|
+
point.active = 1;
|
|
631
|
+
particles[i] = point;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
point.active = 1;
|
|
635
|
+
|
|
636
|
+
if ('pos' in newpoint) {
|
|
637
|
+
//point.pos.copy(newpoint.pos);
|
|
638
|
+
let p1 = point.pos,
|
|
639
|
+
p2 = newpoint.pos;
|
|
640
|
+
pos[offset ] = p1.x = p2.x;
|
|
641
|
+
pos[offset + 1] = p1.y = p2.y;
|
|
642
|
+
pos[offset + 2] = p1.z = p2.z;
|
|
643
|
+
|
|
644
|
+
/*
|
|
645
|
+
point.pos.copy(newpoint.pos);
|
|
646
|
+
pos[offset ] = point.pos.x;
|
|
647
|
+
pos[offset + 1] = point.pos.y;
|
|
648
|
+
pos[offset + 2] = point.pos.z;
|
|
649
|
+
*/
|
|
650
|
+
|
|
651
|
+
//this.updateBoundingSphere(newpos);
|
|
652
|
+
let distSq = p2.x * p2.x + p2.y * p2.y + p2.z * p2.z;
|
|
653
|
+
if (distSq > furthestDistSq) {
|
|
654
|
+
furthest.x = newpoint.pos.x;
|
|
655
|
+
furthest.y = newpoint.pos.y;
|
|
656
|
+
furthest.z = newpoint.pos.z;
|
|
657
|
+
furthestDistSq = distSq;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if ('vel' in newpoint) {
|
|
662
|
+
//point.vel.copy(newpoint.vel);
|
|
663
|
+
point.vel.x = newpoint.vel.x;
|
|
664
|
+
point.vel.y = newpoint.vel.y;
|
|
665
|
+
point.vel.z = newpoint.vel.z;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
if ('accel' in newpoint) {
|
|
669
|
+
//point.accel.copy(newpoint.accel);
|
|
670
|
+
point.accel.x = newpoint.accel.x;
|
|
671
|
+
point.accel.y = newpoint.accel.y;
|
|
672
|
+
point.accel.z = newpoint.accel.z;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if ('opacity' in newpoint) {
|
|
676
|
+
point.opacity = newpoint.opacity;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
if ('col' in newpoint) {
|
|
681
|
+
point.color.setRGB(newpoint.col.x, newpoint.col.y, newpoint.col.z);
|
|
682
|
+
|
|
683
|
+
color[i*4 ] = newpoint.col.x;
|
|
684
|
+
color[i*4 + 1] = newpoint.col.y;
|
|
685
|
+
color[i*4 + 2] = newpoint.col.z;
|
|
686
|
+
color[i*4 + 3] = elation.utils.any(point.opacity, this.properties.opacity, 1);
|
|
687
|
+
|
|
688
|
+
geo.attributes.customColor.needsUpdate = true;
|
|
689
|
+
}
|
|
690
|
+
if ('size' in newpoint) {
|
|
691
|
+
point.size = newpoint.size;
|
|
692
|
+
size[i] = newpoint.size;
|
|
693
|
+
|
|
694
|
+
geo.attributes.size.needsUpdate = true;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
geo.attributes.position.needsUpdate = true;
|
|
698
|
+
this.updateBoundingSphere(furthest);
|
|
699
|
+
if (points.length >= this.properties.count) {
|
|
700
|
+
this.count = particles.length;
|
|
701
|
+
this.createParticles(false);
|
|
702
|
+
this.updateParticleTimer = false;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
})();
|
|
603
706
|
}, elation.engine.things.janusbase);
|
|
604
707
|
});
|