From 4c0b2fff9f28409c90ac290bca8803bcbf245c93 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期五, 17 十二月 2021 16:26:28 +0800 Subject: [PATCH] # --- static/js/app.js | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 39 insertions(+), 8 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index af80b15..1763d19 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -4,6 +4,7 @@ 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 = { @@ -72,6 +73,10 @@ 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; // @@ -79,6 +84,8 @@ this.renderer.setSize( window.innerWidth, window.innerHeight ); this.dom = document.getElementById("container"); this.dom.appendChild( this.renderer.domElement ); + + } this.initLight = function () { @@ -130,14 +137,38 @@ // 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 () { -- Gitblit v1.9.1