env tests
This commit is contained in:
+31
-19
@@ -45,16 +45,21 @@ class GameEngine {
|
||||
// let light = new THREE.AmbientLight( 0x404040, 300 ); // soft white light
|
||||
// scene.add( this.light );
|
||||
|
||||
var hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444 );
|
||||
hemiLight.position.set(0, 33, 0);
|
||||
scene.add( hemiLight );
|
||||
|
||||
const dirLight = new THREE.DirectionalLight(0xffffff, 4);
|
||||
dirLight.color.setHSL(0.1, 1, 0.95);
|
||||
dirLight.position.set(-12, 33, 37);
|
||||
//dirLight.position.multiplyScalar( 20 );
|
||||
dirLight.position.set(12, 33, -37);
|
||||
// dirLight.position.multiplyScalar( 0.20 );
|
||||
// hemiLight.position.multiplyScalar( 0.20 );
|
||||
scene.add(dirLight);
|
||||
|
||||
dirLight.castShadow = true;
|
||||
|
||||
dirLight.shadow.mapSize.width = 2048;
|
||||
dirLight.shadow.mapSize.height = 2048;
|
||||
dirLight.shadow.mapSize.width = 1024;
|
||||
dirLight.shadow.mapSize.height = 1024;
|
||||
|
||||
const d = 50;
|
||||
|
||||
@@ -73,14 +78,14 @@ class GameEngine {
|
||||
powerPreference: "high-performance",
|
||||
});
|
||||
renderer.setPixelRatio(window.devicePixelRatio);
|
||||
// renderer.toneMapping = THREE.CineonToneMapping;
|
||||
// renderer.toneMappingExposure = 1.2;
|
||||
// renderer.shadowMap.enabled = true;
|
||||
// renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
|
||||
renderer.toneMapping = THREE.CineonToneMapping;
|
||||
renderer.toneMappingExposure = 1.0;
|
||||
renderer.shadowMap.enabled = true;
|
||||
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
|
||||
// renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
||||
// renderer.toneMappingExposure = 1;
|
||||
renderer.shadowMap.enabled = true;
|
||||
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
||||
// renderer.shadowMap.enabled = true;
|
||||
// renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
||||
renderer.setSize(this.w, this.h);
|
||||
renderer.setViewport(0, 0, this.w, this.h);
|
||||
renderer.autoClear = true;
|
||||
@@ -235,8 +240,8 @@ class GameEngine {
|
||||
this.scene.add(pivot)
|
||||
pivot.add(yaw)
|
||||
yaw.add(pitch)
|
||||
pitch.add(this.perspectiveCamera);
|
||||
pitch.add(this.orthographicCamera);
|
||||
this.scene.add(this.perspectiveCamera);
|
||||
this.scene.add(this.orthographicCamera);
|
||||
this.cameraPivot = pivot;
|
||||
this.cameraYaw = yaw;
|
||||
}
|
||||
@@ -252,8 +257,8 @@ class GameEngine {
|
||||
{
|
||||
friction: 0,
|
||||
restitution: 0.3,
|
||||
contactEquationStiffness: 1e8,
|
||||
contactEquationRelaxation: 3,
|
||||
contactEquationStiffness: 1e10,
|
||||
contactEquationRelaxation: 30,
|
||||
}
|
||||
)
|
||||
world.addContactMaterial(slippery_ground_cm)
|
||||
@@ -388,11 +393,18 @@ class GameEngine {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.loader.load(url, o => {
|
||||
o.scene.traverse(object => {
|
||||
// if (object.name == 'environment'){
|
||||
// console.log('env recomputing')
|
||||
// object.material.shading = THREE.SmoothShading;
|
||||
// object.geometry.computeVertexNormals(true);
|
||||
// }
|
||||
if (object.name == 'environment' || object.material){
|
||||
console.log('env recomputing')
|
||||
object.material.shading = THREE.SmoothShading;
|
||||
object.geometry.computeVertexNormals(true);
|
||||
//object.material.metalness = 0;
|
||||
//if (object.material.map) object.material.map.colorSpace = THREE.SRGBColorSpace;
|
||||
}
|
||||
if ( object instanceof THREE.Mesh ) {
|
||||
//object.material.envMap = this.scene.environment;
|
||||
if (object.material.map) object.material.map.colorSpace = THREE.SRGBColorSpace;
|
||||
//object.material.metalness = 0;
|
||||
}
|
||||
object.frustumCulled = false;
|
||||
object.castShadow = true;
|
||||
object.receiveShadow = true;
|
||||
|
||||
Reference in New Issue
Block a user