3d grid + cleaner 2D 3D Mode

This commit is contained in:
STEINNI
2025-09-26 21:14:57 +00:00
parent dd860b45a9
commit 69c9034d73
3 changed files with 21 additions and 16 deletions
@@ -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'
}
)
}
+16 -11
View File
@@ -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()
}
+3 -3
View File
@@ -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'