| | |
| | | import {OBJLoader} from './lib/OBJLoader.js'; |
| | | import {StoreShelf} from './object/StoreShelf.js'; |
| | | import {StoreCrn} from './object/StoreCrn.js'; |
| | | import { Sky } from './object/Sky.js'; |
| | | |
| | | var APP = { |
| | | |
| | |
| | | this.renderer = new THREE.WebGLRenderer(); |
| | | |
| | | // this.renderer.outputEncoding = THREE.sRGBEncoding; |
| | | // this.renderer.toneMapping = THREE.ACESFilmicToneMapping; |
| | | // this.renderer.toneMappingExposure = 0.5; |
| | | |
| | | // this.renderer.outputEncoding = THREE.sRGBEncoding; |
| | | // this.renderer.shadowMap.enabled = true; |
| | | // this.renderer.toneMapping = THREE.ReinhardToneMapping; |
| | | // |
| | |
| | | this.renderer.setSize( window.innerWidth, window.innerHeight ); |
| | | this.dom = document.getElementById("container"); |
| | | this.dom.appendChild( this.renderer.domElement ); |
| | | |
| | | |
| | | } |
| | | this.initLight = function () { |
| | | |
| | |
| | | // this.dom.appendChild( this.stats.dom ); |
| | | } |
| | | this.initBackground = function () { |
| | | const cubeTextureLoader = new THREE.CubeTextureLoader(); |
| | | cubeTextureLoader.setPath( '../static/img/skybox/' ); |
| | | this.scene.background = cubeTextureLoader.load([ |
| | | "px.jpg", "nx.jpg", |
| | | "py.jpg", "ny.jpg", |
| | | "pz.jpg", "nz.jpg" |
| | | ]); |
| | | // this.scene.background = new THREE.Color( 0xf0f0f0 ); |
| | | // const cubeTextureLoader = new THREE.CubeTextureLoader(); |
| | | // cubeTextureLoader.setPath( '../static/img/skybox/' ); |
| | | // this.scene.background = cubeTextureLoader.load([ |
| | | // "px.jpg", "nx.jpg", |
| | | // "py.jpg", "ny.jpg", |
| | | // "pz.jpg", "nz.jpg" |
| | | // ]); |
| | | this.scene.background = new THREE.Color( 0xf0f0f0 ); |
| | | |
| | | // 太阳 |
| | | // let sky = new Sky(); |
| | | // sky.scale.setScalar( 450000 ); |
| | | // this.addObject( sky ); |
| | | // let sun = new THREE.Vector3(); |
| | | // const effectController = { |
| | | // turbidity: 10, |
| | | // rayleigh: 3, |
| | | // mieCoefficient: 0.005, |
| | | // mieDirectionalG: 0.7, |
| | | // elevation: 2, |
| | | // azimuth: 180, |
| | | // exposure: this.renderer.toneMappingExposure |
| | | // }; |
| | | // const uniforms = sky.material.uniforms; |
| | | // uniforms[ 'turbidity' ].value = effectController.turbidity; |
| | | // uniforms[ 'rayleigh' ].value = effectController.rayleigh; |
| | | // uniforms[ 'mieCoefficient' ].value = effectController.mieCoefficient; |
| | | // uniforms[ 'mieDirectionalG' ].value = effectController.mieDirectionalG; |
| | | // const phi = THREE.MathUtils.degToRad( 90 - effectController.elevation ); |
| | | // const theta = THREE.MathUtils.degToRad( effectController.azimuth ); |
| | | // sun.setFromSphericalCoords( 1, phi, theta ); |
| | | // uniforms[ 'sunPosition' ].value.copy( sun ); |
| | | } |
| | | this.initReSize = function(object){ |
| | | window.addEventListener('resize', function () { |