From 69c9034d73055c4416ec45290c099b76a2e4dbc9 Mon Sep 17 00:00:00 2001 From: STEINNI Date: Fri, 26 Sep 2025 21:14:57 +0000 Subject: [PATCH] 3d grid + cleaner 2D 3D Mode --- .../dashboard/DashboardsController.js | 4 +-- .../Threetobus/threetobus.module.js | 27 +++++++++++-------- app/views/dashboards/MainDashboardView.js | 6 ++--- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/controllers/dashboard/DashboardsController.js b/app/controllers/dashboard/DashboardsController.js index 65d6ebd..1301fae 100644 --- a/app/controllers/dashboard/DashboardsController.js +++ b/app/controllers/dashboard/DashboardsController.js @@ -29,7 +29,7 @@ class DashboardsController extends EICController { }, { models: models, - camName: 'persp1' + mode: '3D' } ) this.loadWindow( @@ -47,7 +47,7 @@ class DashboardsController extends EICController { }, { models: models, - camName: 'cam2Dtop' + mode: '2D' } ) } diff --git a/app/thirdparty/Threetobus/threetobus.module.js b/app/thirdparty/Threetobus/threetobus.module.js index cce5196..766831d 100644 --- a/app/thirdparty/Threetobus/threetobus.module.js +++ b/app/thirdparty/Threetobus/threetobus.module.js @@ -12,6 +12,10 @@ export class Threetobus{ // Scene this.scene = new THREE.Scene() + this.grid = new THREE.GridHelper(20, 20, 0x444444, 0x888888) + //this.grid.rotation.x = Math.PI / 2 // Default is on the XZ plane → rotate to XY + this.scene.add(this.grid) + // Cameras this.cameras.persp1 = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000) this.cameras.persp1.position.set(3, 3, 5) @@ -41,17 +45,18 @@ export class Threetobus{ } - startRendering(){ - //controls - this.controls = new OrbitControls(this.camera, this.renderer.domElement) - //this.renderer.render(this.scene, this.camera) - - window.addEventListener('resize', () => { - this.camera.aspect = window.innerWidth / window.innerHeight - this.camera.updateProjectionMatrix() - renderer.setSize(window.innerWidth, window.innerHeight) - }) - + startRendering(mode){ + if(mode=='2D'){ + this.changeCamera('cam2Dtop') + } else if(mode=='3D') { + this.changeCamera('persp1') + this.controls = new OrbitControls(this.camera, this.renderer.domElement) + window.addEventListener('resize', () => { + this.camera.aspect = window.innerWidth / window.innerHeight + this.camera.updateProjectionMatrix() + renderer.setSize(window.innerWidth, window.innerHeight) + }) + } this.render() } diff --git a/app/views/dashboards/MainDashboardView.js b/app/views/dashboards/MainDashboardView.js index 6a182eb..35dbd84 100644 --- a/app/views/dashboards/MainDashboardView.js +++ b/app/views/dashboards/MainDashboardView.js @@ -35,8 +35,9 @@ class MainDashboardView extends EICDomContent { constructor() { super() Object.assign(this, app.helpers.activeAttributes) + //this.tileMarkup = app.Assets.Store.html['/app/assets/html/mailing/tile.html'] } - + DOMContentFocused(options) { // Avoid 2nd refesh on DomContentLoaded if(this.wasBlured){ @@ -55,8 +56,7 @@ class MainDashboardView extends EICDomContent { this.ttb = new app.LoadedModules.Threetobus(this.outputs.paper43) this.ttb.initScene() - this.ttb.changeCamera(options.camName) - this.ttb.startRendering() + this.ttb.startRendering(options.mode) const m1 = this.ttb.buildFromJSON(this.agentTypes.molecule1) m1.name = 'toto'