Last active
June 27, 2022 20:21
-
-
Save dosterz97/fbfffb2131dc31a5ab7808ffb988ec99 to your computer and use it in GitHub Desktop.
Camera, Controls, and Scene
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async componentDidMount() { | |
const mainView = this.mainViewRef.current this.renderer = new THREE.WebGLRenderer({ antialias: true }) | |
this.renderer.setSize(window.innerWidth, window.innerHeight - navigationBarHeight) | |
this.renderer.outputEncoding = THREE.sRGBEncoding | |
this.renderer.toneMapping = THREE.ACESFilmicToneMapping mainView.appendChild(this.renderer.domElement) this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / (window.innerHeight - navigationBarHeight), 0.1, 1000) | |
this.camera.position.set(0, 0, 3) | |
this.controls = new OrbitControls(this.camera, this.renderer.domElement)// We will use the lighting from the background instead of creating our own | |
const background = await this.loadBackground(backgroundUrl, this.renderer) | |
this.scene = new THREE.Scene() | |
this.scene.environment = background | |
this.scene.background = background | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment