3d grid + cleaner 2D 3D Mode
This commit is contained in:
+16
-11
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user