This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { TextureLoader, Box3, Vector3, Group } from "three";
|
||||
import { Box3, Vector3, Group } from "three";
|
||||
import { GameEngine } from "./GameEngine";
|
||||
|
||||
function assignParams(mesh, params){
|
||||
['scale', 'rotation', 'position'].forEach(p=>params[p] && mesh[p].fromArray(params[p]));
|
||||
@@ -15,14 +16,17 @@ function assignMaterial(mesh, params){
|
||||
//let mp = params.material.metalness ? new MeshStandardMaterial(params.material) : new MeshBasicMaterial(params.material)
|
||||
Object.assign(mesh.material, params.material)
|
||||
if (params.dm){
|
||||
var dm = new TextureLoader().setPath(params.path).load(params.dm);
|
||||
mesh.material.map = dm;
|
||||
GameEngine.loadTexture(params.dm, params.path, undefined, [mesh.material, 'map'])
|
||||
// var dm = new TextureLoader().setPath(params.path).load(params.dm);
|
||||
// mesh.material.map = dm;
|
||||
}
|
||||
if (params.nm){
|
||||
mesh.material.normalMap = new TextureLoader().setPath(params.path).load(params.nm);
|
||||
GameEngine.loadTexture(params.nm, params.path, undefined, [mesh.material, 'normalMap'])
|
||||
//mesh.material.normalMap = new TextureLoader().setPath(params.path).load(params.nm);
|
||||
}
|
||||
if (params.em) {
|
||||
mesh.material.emissiveMap = new TextureLoader().setPath(params.path).load(params.em);
|
||||
GameEngine.loadTexture(params.em, params.path, undefined, [mesh.material, 'emissiveMap'])
|
||||
//mesh.material.emissiveMap = new TextureLoader().setPath(params.path).load(params.em);
|
||||
}
|
||||
//mesh.material = mp;
|
||||
mesh.material.needsUpdate = true;
|
||||
|
||||
Reference in New Issue
Block a user