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
package/scripts/geometries.js
CHANGED
|
@@ -99,14 +99,14 @@ elation.require([], function() {
|
|
|
99
99
|
phiLength = params.phiLength || Math.PI * 2,
|
|
100
100
|
thetaStart = params.thetaStart || 0,
|
|
101
101
|
thetaLength = params.thetaLength || Math.PI;
|
|
102
|
-
var geo = new THREE.
|
|
102
|
+
var geo = new THREE.SphereGeometry(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength);
|
|
103
103
|
return geo;
|
|
104
104
|
},
|
|
105
105
|
'box': function(params) {
|
|
106
106
|
var size = params.size || new THREE.Vector3(1,1,1),
|
|
107
107
|
offset = params.offset;
|
|
108
108
|
|
|
109
|
-
var geo = new THREE.
|
|
109
|
+
var geo = new THREE.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
|
|
110
110
|
|
|
111
111
|
if (offset) {
|
|
112
112
|
geo.applyMatrix4(new THREE.Matrix4().makeTranslation(offset.x, offset.y, offset.z));
|
package/scripts/math.js
CHANGED
|
@@ -15,20 +15,20 @@ Object.defineProperties(EulerDegrees.prototype, {
|
|
|
15
15
|
x: {
|
|
16
16
|
enumerable: true,
|
|
17
17
|
configurable: true,
|
|
18
|
-
set: function(x) { this.radians.x = x * THREE.
|
|
19
|
-
get: function() { return this.radians.x * THREE.
|
|
18
|
+
set: function(x) { this.radians.x = x * THREE.MathUtils.DEG2RAD; },
|
|
19
|
+
get: function() { return this.radians.x * THREE.MathUtils.RAD2DEG; }
|
|
20
20
|
},
|
|
21
21
|
y: {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
configurable: true,
|
|
24
|
-
set: function(y) { this.radians.y = y * THREE.
|
|
25
|
-
get: function() { return this.radians.y * THREE.
|
|
24
|
+
set: function(y) { this.radians.y = y * THREE.MathUtils.DEG2RAD; },
|
|
25
|
+
get: function() { return this.radians.y * THREE.MathUtils.RAD2DEG; }
|
|
26
26
|
},
|
|
27
27
|
z: {
|
|
28
28
|
enumerable: true,
|
|
29
29
|
configurable: true,
|
|
30
|
-
set: function(z) { this.radians.z = z * THREE.
|
|
31
|
-
get: function() { return this.radians.z * THREE.
|
|
30
|
+
set: function(z) { this.radians.z = z * THREE.MathUtils.DEG2RAD; },
|
|
31
|
+
get: function() { return this.radians.z * THREE.MathUtils.RAD2DEG; }
|
|
32
32
|
},
|
|
33
33
|
order: {
|
|
34
34
|
enumerable: true,
|
package/scripts/systems/admin.js
CHANGED
|
@@ -842,7 +842,7 @@ elation.require([
|
|
|
842
842
|
if (properties[k] instanceof THREE.Vector2) {
|
|
843
843
|
root[k]['value'] = properties[k].x.toFixed(4) + ' ' + properties[k].y.toFixed(4);
|
|
844
844
|
} else if (properties[k] instanceof THREE.Vector3 || properties[k] instanceof THREE.Euler) {
|
|
845
|
-
root[k]['value'] = (properties[k].x * THREE.
|
|
845
|
+
root[k]['value'] = (properties[k].x * THREE.MathUtils.RAD2DEG).toFixed(2) + ' ' + (properties[k].y * THREE.MathUtils.RAD2DEG).toFixed(2) + ' ' + (properties[k].z * THREE.MathUtils.RAD2DEG).toFixed(2);
|
|
846
846
|
} else if (properties[k] instanceof THREE.Vector4 || properties[k] instanceof THREE.Quaternion) {
|
|
847
847
|
root[k]['value'] = properties[k].x.toFixed(4) + ' ' + properties[k].y.toFixed(4) + ' ' + properties[k].z.toFixed(4) + ' ' + properties[k].w.toFixed(4);
|
|
848
848
|
} else if (properties[k] instanceof THREE.Texture) {
|
|
@@ -448,18 +448,18 @@ elation.require(['ui.window', 'ui.panel', 'ui.toggle', 'ui.slider', 'ui.label',
|
|
|
448
448
|
if (this.state[bindname_x] != values[0]) {
|
|
449
449
|
this.changes.push(bindname_x);
|
|
450
450
|
this.state[bindname_x] = values[0];
|
|
451
|
-
this.state[bindname_x + '_full'] = THREE.
|
|
451
|
+
this.state[bindname_x + '_full'] = THREE.MathUtils.mapLinear(gamepad.axes[a], -1, 1, 0, 1);
|
|
452
452
|
this.changes.push(bindname_any_x);
|
|
453
453
|
this.state[bindname_any_x] = values[0];
|
|
454
|
-
this.state[bindname_any_x + '_full'] = THREE.
|
|
454
|
+
this.state[bindname_any_x + '_full'] = THREE.MathUtils.mapLinear(gamepad.axes[a], -1, 1, 0, 1);
|
|
455
455
|
}
|
|
456
456
|
if (this.state[bindname_y] != values[1]) {
|
|
457
457
|
this.changes.push(bindname_y);
|
|
458
458
|
this.state[bindname_y] = values[1];
|
|
459
|
-
this.state[bindname_y + '_full'] = THREE.
|
|
459
|
+
this.state[bindname_y + '_full'] = THREE.MathUtils.mapLinear(gamepad.axes[a+1], -1, 1, 0, 1);
|
|
460
460
|
this.changes.push(bindname_any_y);
|
|
461
461
|
this.state[bindname_any_y] = values[1];
|
|
462
|
-
this.state[bindname_any_y + '_full'] = THREE.
|
|
462
|
+
this.state[bindname_any_y + '_full'] = THREE.MathUtils.mapLinear(gamepad.axes[a+1], -1, 1, 0, 1);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
for (var b = 0; b < gamepad.buttons.length; b++) {
|
|
@@ -845,6 +845,7 @@ elation.require(['ui.window', 'ui.panel', 'ui.toggle', 'ui.slider', 'ui.label',
|
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
this.touchstart = function(ev) {
|
|
848
|
+
return;
|
|
848
849
|
var newev = {
|
|
849
850
|
button: 0,
|
|
850
851
|
type: 'mousedown',
|
|
@@ -862,6 +863,7 @@ elation.require(['ui.window', 'ui.panel', 'ui.toggle', 'ui.slider', 'ui.label',
|
|
|
862
863
|
//ev.preventDefault();
|
|
863
864
|
}
|
|
864
865
|
this.touchmove = function(ev) {
|
|
866
|
+
return;
|
|
865
867
|
//if (ev.touches.length == 1) {
|
|
866
868
|
var newev = {
|
|
867
869
|
type: 'mousemove',
|
|
@@ -6,8 +6,8 @@ elation.require(["physics.cyclone"], function() {
|
|
|
6
6
|
this.debugwindows = {};
|
|
7
7
|
this.debugvis = {};
|
|
8
8
|
this.debugthings = {};
|
|
9
|
-
this.async =
|
|
10
|
-
this.asyncframerate =
|
|
9
|
+
this.async = true;
|
|
10
|
+
this.asyncframerate = 120;
|
|
11
11
|
|
|
12
12
|
this.system_attach = function(ev) {
|
|
13
13
|
console.log('INIT: physics');
|
|
@@ -20,7 +20,7 @@ elation.require(["physics.cyclone"], function() {
|
|
|
20
20
|
}
|
|
21
21
|
this.engine_start = function(ev) {
|
|
22
22
|
//console.log("PHYSICS: starting");
|
|
23
|
-
this.system.start();
|
|
23
|
+
this.system.start({subprocessor: 'cpu', processorargs: { path: 'https://baicoianu.com/~bai/janusweb/build/1.5.32/media/lib/physx/'}});
|
|
24
24
|
this.lasttime = new Date().getTime();
|
|
25
25
|
if (this.interval) {
|
|
26
26
|
clearInterval(this.interval);
|
|
@@ -390,7 +390,7 @@ elation.require(["physics.cyclone"], function() {
|
|
|
390
390
|
}
|
|
391
391
|
*/
|
|
392
392
|
//var boxgeo = new THREE.BoxGeometry(bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y, bbox.max.z - bbox.min.z);
|
|
393
|
-
let boxgeo = new THREE.
|
|
393
|
+
let boxgeo = new THREE.BoxGeometry(bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y, bbox.max.z - bbox.min.z, 10, 10, 10);
|
|
394
394
|
var boxmat = new THREE.LineBasicMaterial({color: 0x0000ff, transparent: true, depthWrite: false, depthTest: false, opacity: .2, blending: THREE.AdditiveBlending});
|
|
395
395
|
var outline = new THREE.LineSegments(boxgeo, boxmat, THREE.LinePieces);
|
|
396
396
|
|
|
@@ -416,7 +416,7 @@ elation.require(["physics.cyclone"], function() {
|
|
|
416
416
|
return outline;
|
|
417
417
|
}
|
|
418
418
|
this.createBoundingSphere = function(collider) {
|
|
419
|
-
var spheregeo = new THREE.
|
|
419
|
+
var spheregeo = new THREE.SphereGeometry(collider.radius, 18, 9);
|
|
420
420
|
//var spheregeo = new THREE.IcosahedronGeometry(collider.radius, 2);
|
|
421
421
|
var spheremat = new THREE.MeshBasicMaterial({color: 0x00ffff, transparent: true, opacity: .2, depthWrite: false, polygonOffset: true, polygonOffsetFactor: -1, polygonOffsetUnits: 1, wireframe: false, blending: THREE.AdditiveBlending});
|
|
422
422
|
var spherewiremat = new THREE.MeshBasicMaterial({color: 0xff0000, transparent: true, opacity: .1, depthWrite: false, depthTest: false, wireframe: true, blending: THREE.AdditiveBlending});
|
|
@@ -426,7 +426,7 @@ elation.require(["physics.cyclone"], function() {
|
|
|
426
426
|
return outline;
|
|
427
427
|
}
|
|
428
428
|
this.createBoundingPlane = function(collider) {
|
|
429
|
-
var plane = new THREE.
|
|
429
|
+
var plane = new THREE.PlaneGeometry(1000, 1000);
|
|
430
430
|
var planemat = new THREE.MeshBasicMaterial({color: 0x00ffff, transparent: true, opacity: .04, depthWrite: false, polygonOffset: true, polygonOffsetFactor: -5, polygonOffsetUnits: 1, wireframe: false, blending: THREE.AdditiveBlending });
|
|
431
431
|
// FIXME - this only really works for horizontal planes
|
|
432
432
|
var mat = new THREE.Matrix4().makeRotationFromQuaternion(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1,0,0), -Math.PI/2));
|
|
@@ -435,7 +435,7 @@ elation.require(["physics.cyclone"], function() {
|
|
|
435
435
|
return mesh;
|
|
436
436
|
}
|
|
437
437
|
this.createBoundingCylinder = function(collider) {
|
|
438
|
-
var cyl = new THREE.
|
|
438
|
+
var cyl = new THREE.CylinderGeometry(collider.radius, collider.radius, collider.height, 32, 1);
|
|
439
439
|
//var cylmat = new THREE.MeshBasicMaterial({color: 0x00ffff, transparent: true, opacity: .1, depthWrite: false, depthTest: false, wireframe: true, blending: THREE.AdditiveBlending});
|
|
440
440
|
var cylmat = new THREE.MeshBasicMaterial({color: 0xff0000, transparent: true, opacity: .1, depthWrite: false, depthTest: false, wireframe: true, blending: THREE.AdditiveBlending});
|
|
441
441
|
var mesh = new THREE.Mesh(cyl, cylmat);
|
|
@@ -487,7 +487,7 @@ console.log('my offset', collider.offset, collider);
|
|
|
487
487
|
tex.minFilter = tex.maxFilter = THREE.LinearFilter;
|
|
488
488
|
tex.needsUpdate = true;
|
|
489
489
|
|
|
490
|
-
var cg = new THREE.Mesh(new THREE.
|
|
490
|
+
var cg = new THREE.Mesh(new THREE.SphereGeometry(.05), new THREE.MeshPhongMaterial({emissive: 0x666600, map: tex, transparent: true, depthWrite: false, depthTest: false, opacity: 1}));
|
|
491
491
|
return cg;
|
|
492
492
|
}
|
|
493
493
|
/*
|
|
@@ -557,7 +557,7 @@ console.log('my offset', collider.offset, collider);
|
|
|
557
557
|
this.createObject3D = function() {
|
|
558
558
|
this.materials = [];
|
|
559
559
|
var collision = this.properties.collision;
|
|
560
|
-
var planegeo = new THREE.
|
|
560
|
+
var planegeo = new THREE.PlaneGeometry(1, 1);
|
|
561
561
|
var planemat = new THREE.MeshBasicMaterial({
|
|
562
562
|
map: this.texture,
|
|
563
563
|
wireframe: false,
|
|
@@ -813,7 +813,7 @@ console.log('ffff', collision.impulses[i], len);
|
|
|
813
813
|
var bbox = this.properties.boundingbox;
|
|
814
814
|
var size = [bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y, bbox.max.z - bbox.min.z];
|
|
815
815
|
var offset = [(bbox.max.x + bbox.min.x) / 2, (bbox.max.y - bbox.min.y) / 2, (bbox.max.z + bbox.min.z) / 2];
|
|
816
|
-
var insidegeo = new THREE.
|
|
816
|
+
var insidegeo = new THREE.BoxGeometry(size[0], size[1], size[2]);
|
|
817
817
|
insidegeo.applyMatrix(new THREE.Matrix4().makeTranslation(offset[0], size[1]/2 + offset[1], offset[2]));
|
|
818
818
|
var insidemat_side = new THREE.MeshPhongMaterial({emissive: 0x006666, color: 0x00ffff, opacity: 0.8, transparent: true, depthWrite: false, depthTest: false});
|
|
819
819
|
var insidemat_top = new THREE.MeshPhongMaterial({emissive: 0x006666, color: 0x00ffff, opacity: 0.5, transparent: true, depthWrite: false, depthTest: false});
|
|
@@ -11,6 +11,7 @@ elation.require([
|
|
|
11
11
|
"engine.external.three.three-extras",
|
|
12
12
|
"engine.external.three.CSS3DRenderer",
|
|
13
13
|
"engine.external.three.CubemapToEquirectangular",
|
|
14
|
+
"engine.external.holoplay",
|
|
14
15
|
|
|
15
16
|
"engine.external.webxr-polyfill",
|
|
16
17
|
|
|
@@ -53,7 +54,9 @@ elation.require([
|
|
|
53
54
|
alpha: true,
|
|
54
55
|
preserveDrawingBuffer: true,
|
|
55
56
|
enableWebXR: false,
|
|
56
|
-
stencil: false
|
|
57
|
+
stencil: false,
|
|
58
|
+
powerPreference: 'high-performance',
|
|
59
|
+
//precision: 'lowp',
|
|
57
60
|
};
|
|
58
61
|
if (webglmode == 'webgl2') {
|
|
59
62
|
rendererargs.canvas = document.createElement( 'canvas' );
|
|
@@ -61,6 +64,13 @@ elation.require([
|
|
|
61
64
|
}
|
|
62
65
|
this.renderer = new THREE.WebGLRenderer(rendererargs);
|
|
63
66
|
this.cssrenderer = new THREE.CSS3DRenderer();
|
|
67
|
+
/*
|
|
68
|
+
this.holorenderer = new HoloPlay.Renderer(rendererargs);
|
|
69
|
+
this.holorenderer.quiltResolution = 3360;
|
|
70
|
+
this.holorenderer.tileCount.set(8, 6);
|
|
71
|
+
document.body.appendChild(this.holorenderer.domElement);
|
|
72
|
+
*/
|
|
73
|
+
|
|
64
74
|
//this.renderer.autoClear = true;
|
|
65
75
|
this.renderer.setClearColor(0x000000, 1);
|
|
66
76
|
this.renderer.shadowMap.enabled = true;
|
|
@@ -68,17 +78,19 @@ elation.require([
|
|
|
68
78
|
this.renderer.xr.enabled = false;
|
|
69
79
|
//this.renderer.xr.manageCameraPosition = true;
|
|
70
80
|
this.lastframetime = performance.now();
|
|
81
|
+
|
|
71
82
|
this.renderer.setAnimationLoop((time, frame) => {
|
|
72
83
|
this.render(time - this.lastframetime, frame);
|
|
73
84
|
this.lastframetime = time;
|
|
74
85
|
});
|
|
86
|
+
|
|
75
87
|
//this.renderer.setAnimationLoop((ev) => { this.render(); });
|
|
76
88
|
|
|
77
89
|
//this.renderer.gammaInput = true;
|
|
78
90
|
//this.renderer.gammaOutput = false;
|
|
79
91
|
//this.renderer.outputEncoding = THREE.LinearEncoding;
|
|
80
92
|
//this.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
81
|
-
this.renderer.outputEncoding = THREE.
|
|
93
|
+
this.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
82
94
|
this.renderer.gammaFactor = 1.3;
|
|
83
95
|
|
|
84
96
|
/*
|
|
@@ -87,7 +99,7 @@ elation.require([
|
|
|
87
99
|
this.renderer.toneMappingWhitePoint = 1;
|
|
88
100
|
*/
|
|
89
101
|
|
|
90
|
-
this.renderer.debug.checkShaderErrors =
|
|
102
|
+
this.renderer.debug.checkShaderErrors = true;
|
|
91
103
|
|
|
92
104
|
this.lastframetime = 0;
|
|
93
105
|
|
|
@@ -98,6 +110,7 @@ elation.require([
|
|
|
98
110
|
|
|
99
111
|
// Hide the canvas from accessibility API
|
|
100
112
|
this.renderer.domElement.setAttribute('aria-hidden', true);
|
|
113
|
+
|
|
101
114
|
}
|
|
102
115
|
this.setclearcolor = function(color, opacity) {
|
|
103
116
|
if (typeof color == 'undefined') color = 0xffffff;
|
|
@@ -138,7 +151,7 @@ elation.require([
|
|
|
138
151
|
}
|
|
139
152
|
this.textureSampleMipmapLevel = (function() {
|
|
140
153
|
let scene = new THREE.Scene();
|
|
141
|
-
let plane = new THREE.
|
|
154
|
+
let plane = new THREE.PlaneGeometry(2, 2);
|
|
142
155
|
let material = new THREE.MeshBasicMaterial({color: 0xffffff});
|
|
143
156
|
let mesh = new THREE.Mesh(plane, material);
|
|
144
157
|
mesh.position.set(0,0,-1);
|
|
@@ -177,7 +190,7 @@ elation.require([
|
|
|
177
190
|
})();
|
|
178
191
|
this.textureHasAlpha = (function() {
|
|
179
192
|
let scene = new THREE.Scene();
|
|
180
|
-
let plane = new THREE.
|
|
193
|
+
let plane = new THREE.PlaneGeometry(2, 2);
|
|
181
194
|
let material = new THREE.MeshBasicMaterial({color: 0xff0000});
|
|
182
195
|
let mesh = new THREE.Mesh(plane, material);
|
|
183
196
|
mesh.position.set(0,0,-1);
|
|
@@ -344,7 +357,7 @@ elation.require([
|
|
|
344
357
|
//console.log(this.engine.systems.world.scene['world-3d']);
|
|
345
358
|
|
|
346
359
|
// Depth shader, used for SSAO, god rays, etc
|
|
347
|
-
if (!this.depthTarget) {
|
|
360
|
+
if (false && !this.depthTarget) {
|
|
348
361
|
var depthShader = THREE.ShaderLib[ "depth" ];
|
|
349
362
|
var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms );
|
|
350
363
|
|
|
@@ -371,7 +384,7 @@ elation.require([
|
|
|
371
384
|
this.rendertarget.depthTexture.type = THREE.UnsignedInt248Type;
|
|
372
385
|
this.rendertarget.depthTexture.format = THREE.DepthStencilFormat;
|
|
373
386
|
//this.composer = this.createRenderPath(['clear', /*'portals', 'masktest',*/ this.rendermode, 'fxaa'/*, 'msaa'*/, 'bloom', 'maskclear', 'recording'], this.rendertarget);
|
|
374
|
-
this.composer = this.createRenderPath(['clear', this.rendermode,/* 'tonemapping',*/ 'unrealbloom',
|
|
387
|
+
this.composer = this.createRenderPath(['clear', this.rendermode,/* 'tonemapping',*/ 'unrealbloom', 'fxaa', 'gamma'], this.rendertarget);
|
|
375
388
|
//this.composer = this.createRenderPath(['clear', this.rendermode, 'fxaa'/*, 'msaa'*/, 'bloom', 'maskclear'], this.rendertarget);
|
|
376
389
|
//this.effects['msaa'].enabled = false;
|
|
377
390
|
//this.composer = this.createRenderPath([this.rendermode, 'ssao', 'recording']);
|
|
@@ -423,7 +436,7 @@ elation.require([
|
|
|
423
436
|
}
|
|
424
437
|
})
|
|
425
438
|
});
|
|
426
|
-
this.engine.systems.controls.addBindings('view', {'keyboard_f7': 'picking_debug'});
|
|
439
|
+
//this.engine.systems.controls.addBindings('view', {'keyboard_f7': 'picking_debug'});
|
|
427
440
|
this.engine.systems.controls.addBindings('view', {'gamepad_any_button_0': 'picking_select'});
|
|
428
441
|
this.engine.systems.controls.activateContext('view');
|
|
429
442
|
}
|
|
@@ -543,6 +556,14 @@ elation.require([
|
|
|
543
556
|
break;
|
|
544
557
|
case 'unrealbloom':
|
|
545
558
|
pass = new THREE.UnrealBloomPass(this.size, 0, 0, 0);
|
|
559
|
+
|
|
560
|
+
pass.renderTargetsHorizontal.forEach(element => {
|
|
561
|
+
element.texture.type = THREE.FloatType;
|
|
562
|
+
});
|
|
563
|
+
pass.renderTargetsVertical.forEach(element => {
|
|
564
|
+
element.texture.type = THREE.FloatType;
|
|
565
|
+
});
|
|
566
|
+
|
|
546
567
|
break;
|
|
547
568
|
case 'fxaa':
|
|
548
569
|
pass = new THREE.ShaderPass( THREE.FXAAShader );
|
|
@@ -658,7 +679,7 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
658
679
|
this.xrscenetexture.magFilter = THREE.NearestFilter;
|
|
659
680
|
|
|
660
681
|
// Set up the plane to render only one eye, centered in the middle of the screen
|
|
661
|
-
this.xrsceneplane = new THREE.Mesh(new THREE.
|
|
682
|
+
this.xrsceneplane = new THREE.Mesh(new THREE.PlaneGeometry(w, h), new THREE.MeshBasicMaterial({map: this.xrscenetexture, side: THREE.DoubleSide, color: 0xffffff}));
|
|
662
683
|
this.xrsceneplane.position.set(w / 4, 0, -10);
|
|
663
684
|
//this.xrsceneplane.rotation.set(Math.PI/4, 0, 0);
|
|
664
685
|
this.xrscene.add(this.xrsceneplane);
|
|
@@ -688,7 +709,7 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
688
709
|
this.enabled = false;
|
|
689
710
|
elation.html.removeclass(this, 'webxr_session_active');
|
|
690
711
|
this.xrsession = false;
|
|
691
|
-
this.rendersystem.renderer.outputEncoding = THREE.
|
|
712
|
+
this.rendersystem.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
692
713
|
setTimeout(() => {
|
|
693
714
|
elation.events.fire({type: 'resize', element: window, data: true });
|
|
694
715
|
}, 100);
|
|
@@ -772,12 +793,10 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
772
793
|
this.updatePickingTarget();
|
|
773
794
|
//}
|
|
774
795
|
}
|
|
775
|
-
|
|
776
|
-
this.scene.overrideMaterial = this.depthMaterial;
|
|
796
|
+
//this.scene.overrideMaterial = this.depthMaterial;
|
|
777
797
|
//this.rendersystem.renderer.render(this.scene, this.actualcamera, this.depthTarget, true);
|
|
778
798
|
|
|
779
|
-
this.scene.overrideMaterial = null;
|
|
780
|
-
*/
|
|
799
|
+
//this.scene.overrideMaterial = null;
|
|
781
800
|
//this.rendersystem.renderer.render(this.scene, this.actualcamera);
|
|
782
801
|
|
|
783
802
|
this.effects[this.rendermode].camera = this.actualcamera;
|
|
@@ -821,7 +840,7 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
821
840
|
renderer.setRenderTarget( renderer.getRenderTarget() );
|
|
822
841
|
|
|
823
842
|
let oldOutputEncoding = renderer.outputEncoding;
|
|
824
|
-
renderer.outputEncoding = THREE.
|
|
843
|
+
renderer.outputEncoding = THREE.sRGBEncoding;
|
|
825
844
|
renderer.setViewport(0, 0, layer.framebufferWidth, layer.framebufferHeight);
|
|
826
845
|
renderer.render(this.xrscene, this.xrscenecam);
|
|
827
846
|
renderer.xr.enabled = true;
|
|
@@ -848,6 +867,12 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
848
867
|
//this.rendersystem.renderer.state.bindXRFramebuffer(null);
|
|
849
868
|
//this.rendersystem.renderer.setRenderTarget( renderer.getRenderTarget() );
|
|
850
869
|
this.rendersystem.renderer.render(this.scene, this.camera);
|
|
870
|
+
//this.holocamera.position.setFromMatrixPosition(this.camera.matrixWorld);
|
|
871
|
+
//this.holocamera.quaternion.setFromRotationMatrix(this.camera.matrixWorld);
|
|
872
|
+
|
|
873
|
+
//this.holocamera.position.set(0, 10, 10).applyMatrix4(this.camera.matrixWorld);
|
|
874
|
+
//this.holocamera.target.set(0, 0, 0).applyMatrix4(this.camera.matrixWorld);
|
|
875
|
+
//this.rendersystem.holorenderer.render(this.scene, this.holocamera);
|
|
851
876
|
}
|
|
852
877
|
}
|
|
853
878
|
|
|
@@ -905,6 +930,15 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
905
930
|
camera = camera.objects['3d'];
|
|
906
931
|
}
|
|
907
932
|
this.camera = camera;
|
|
933
|
+
/*
|
|
934
|
+
this.holocamera = new HoloPlay.Camera();
|
|
935
|
+
this.holocamera.fov = 90;
|
|
936
|
+
console.log('my holocamera', this.holocamera, this.holocamera.fov);
|
|
937
|
+
//camera.add(this.holocamera);
|
|
938
|
+
this.holocamera.position.set(0,0,0);
|
|
939
|
+
this.holocamera.target.set(0,0,1);
|
|
940
|
+
this.holocamera.quaternion.set(0,0,0,1);
|
|
941
|
+
*/
|
|
908
942
|
this.setscene(this.getscene(camera));
|
|
909
943
|
this.updateCameras();
|
|
910
944
|
if (this.size[0] > 0 && this.size[1] > 0) {
|
|
@@ -946,7 +980,7 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
946
980
|
var frustum = new THREE.Frustum();
|
|
947
981
|
var frustmat = new THREE.Matrix4().makePerspective( this.camera.fov, this.camera.aspect, 0.00001, 9e99).multiply(this.camera.matrixWorldInverse);
|
|
948
982
|
//frustum.setFromMatrix( new THREE.Matrix4().multiplyMatrices( this.camera.projectionMatrix, this.camera.matrixWorldInverse ) );
|
|
949
|
-
frustum.
|
|
983
|
+
frustum.setFromProjectionMatrix(frustmat);
|
|
950
984
|
var within = [], nearnode = null, farnode = null;
|
|
951
985
|
|
|
952
986
|
this.scene.traverse(elation.bind(this, function(node) {
|
|
@@ -974,9 +1008,10 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
974
1008
|
if (within.length > 0) {
|
|
975
1009
|
var vpos = new THREE.Vector3();
|
|
976
1010
|
for (var n = 0; n < within.length; n++) {
|
|
977
|
-
if (within[n].geometry instanceof THREE.
|
|
978
|
-
|
|
979
|
-
|
|
1011
|
+
if (within[n].geometry instanceof THREE.BufferGeometry) {
|
|
1012
|
+
let positions = within[n].geometry.attributes.position;
|
|
1013
|
+
for (var i = 0; i < positions.count; i++) {
|
|
1014
|
+
vpos.set(positions[i * 3], positions[i * 3 + 1], positions[i * 3 + 2]);
|
|
980
1015
|
within[n].localToWorld(vpos);
|
|
981
1016
|
if (true) { //frustum.containsPoint(vpos)) {
|
|
982
1017
|
var dsq = vpos.distanceToSquared(campos);
|
|
@@ -1081,6 +1116,9 @@ console.log('toggle render mode: ' + this.rendermode + ' => ' + mode, passidx, l
|
|
|
1081
1116
|
if (this.pickingcomposer) {
|
|
1082
1117
|
this.pickingcomposer.setSize(scaledwidth, scaledheight);
|
|
1083
1118
|
}
|
|
1119
|
+
if (this.depthTarget) {
|
|
1120
|
+
this.depthTarget.setSize(scaledwidth, scaledheight);
|
|
1121
|
+
}
|
|
1084
1122
|
if (this.effects['SSAO']) {
|
|
1085
1123
|
this.effects['SSAO'].uniforms[ 'size' ].value.set( width, height);
|
|
1086
1124
|
this.effects['SSAO'].uniforms[ 'tDepth' ].value = this.depthTarget;
|
|
@@ -1957,7 +1995,7 @@ console.log('dun it', msaafilter);
|
|
|
1957
1995
|
while (intersects.length > 0) {
|
|
1958
1996
|
hit = intersects.shift();
|
|
1959
1997
|
let thing = this.view.getParentThing(hit.object);
|
|
1960
|
-
if (thing.pickable && !(hit.object instanceof THREE.EdgesHelper)) {
|
|
1998
|
+
if (thing.pickable) { // && !(hit.object instanceof THREE.EdgesHelper)) {
|
|
1961
1999
|
if (hit !== this.lasthit) {
|
|
1962
2000
|
this.lasthit = hit; // FIXME - hack for demo
|
|
1963
2001
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
elation.require([], () => {
|
|
2
|
+
elation.extend("engine.systems.render2", function(args) {
|
|
3
|
+
elation.implement(this, elation.engine.systems.system);
|
|
4
|
+
this.views = {};
|
|
5
|
+
this.forcerefresh = false;
|
|
6
|
+
|
|
7
|
+
this.view_init = function(viewname, viewargs) {
|
|
8
|
+
var newview = new elation.engine.systems.render2.view(viewargs);
|
|
9
|
+
return this.view_add(viewname, newview);
|
|
10
|
+
}
|
|
11
|
+
this.view_add = function(viewname, view) {
|
|
12
|
+
this.views[viewname] = view;
|
|
13
|
+
elation.events.fire({type: 'render_view_add', element: this, data: this.views[viewname]});
|
|
14
|
+
return this.views[viewname];
|
|
15
|
+
}
|
|
16
|
+
this.view_remove = function(viewname) {
|
|
17
|
+
if (viewname in this.views) {
|
|
18
|
+
this.views[viewname].destroy();
|
|
19
|
+
delete this.views[viewname];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
this.system_attach = function(ev) {
|
|
24
|
+
console.log('INIT: render2');
|
|
25
|
+
}
|
|
26
|
+
this.engine_stop = function(ev) {
|
|
27
|
+
console.log('SHUTDOWN: render2');
|
|
28
|
+
for (var k in this.views) {
|
|
29
|
+
this.views[k].destroy();
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
this.engine_frame = function(ev) {
|
|
33
|
+
this.lastframetime += ev.data.delta;
|
|
34
|
+
//this.render();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
package/scripts/things/camera.js
CHANGED
|
@@ -2,7 +2,7 @@ elation.require(['engine.things.generic'], function() {
|
|
|
2
2
|
elation.component.add('engine.things.camera', function() {
|
|
3
3
|
this.postinit = function() {
|
|
4
4
|
this.defineProperties({
|
|
5
|
-
fov: { type: 'float', default: 75 },
|
|
5
|
+
fov: { type: 'float', default: 75, set: this.updateFOV },
|
|
6
6
|
near: { type: 'float', default: .01 },
|
|
7
7
|
far: { type: 'float', default: 1000 },
|
|
8
8
|
aspect: { type: 'float', default: 4/3 },
|
|
@@ -23,5 +23,10 @@ elation.require(['engine.things.generic'], function() {
|
|
|
23
23
|
*/
|
|
24
24
|
//scene.add(camhelper);
|
|
25
25
|
}
|
|
26
|
+
this.updateFOV = function() {
|
|
27
|
+
if (this.camera) {
|
|
28
|
+
this.camera.fov = this.fov;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
26
31
|
}, elation.engine.things.generic);
|
|
27
32
|
});
|