From 3018c6f5bd436faa32653b7dddfd09aea04fa07b Mon Sep 17 00:00:00 2001 From: Paul Graffam Date: Wed, 23 Jan 2019 17:26:49 -0500 Subject: [PATCH] Reformat parameters --- src/js/app/model/model.js | 49 +++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/js/app/model/model.js b/src/js/app/model/model.js index d9c89f9..24ed02c 100644 --- a/src/js/app/model/model.js +++ b/src/js/app/model/model.js @@ -18,32 +18,37 @@ export default class Model { load() { // Load model with ObjectLoader - this.loader.load(Config.model.path, obj => { - obj.traverse(child => { - if(child instanceof THREE.Mesh) { - // Create material for mesh and set its map to texture by name from preloaded textures - const material = new Material(0xffffff).standard; - material.map = this.textures.UV; - child.material = material; + this.loader.load( + Config.model.path, + obj => { + obj.traverse(child => { + if(child instanceof THREE.Mesh) { + // Create material for mesh and set its map to texture by name from preloaded textures + const material = new Material(0xffffff).standard; + material.map = this.textures.UV; + child.material = material; - // Set to cast and receive shadow if enabled - if(Config.shadow.enabled) { - child.receiveShadow = true; - child.castShadow = true; + // Set to cast and receive shadow if enabled + if(Config.shadow.enabled) { + child.receiveShadow = true; + child.castShadow = true; + } } + }); + + // Add mesh helper if Dev + if(Config.isDev && Config.mesh.enableHelper) { + new MeshHelper(this.scene, obj); } - }); - // Add mesh helper if Dev - if(Config.isDev && Config.mesh.enableHelper) { - new MeshHelper(this.scene, obj); - } + // Set prop to obj so it can be accessed from outside the class + this.obj = obj; - // Set prop to obj so it can be accessed from outside the class - this.obj = obj; - - obj.scale.multiplyScalar(Config.model.scale); - this.scene.add(obj); - }, Helpers.logProgress(), Helpers.logError()); + obj.scale.multiplyScalar(Config.model.scale); + this.scene.add(obj); + }, + Helpers.logProgress(), + Helpers.logError() + ); } }