refactoring
This commit is contained in:
@@ -16,6 +16,11 @@ class Clickable {
|
||||
delete object._clickable;
|
||||
};
|
||||
|
||||
this.removeAll = function(){
|
||||
objects.forEach(o=>delete o._clickable)
|
||||
objects.splice(0, objects.length);
|
||||
}
|
||||
|
||||
this.update = function (mouse, camera, event) {
|
||||
raycaster.setFromCamera(mouse, camera);
|
||||
let forExecute = [];
|
||||
|
||||
@@ -560,6 +560,15 @@ class GameEngine extends THREE.EventDispatcher{
|
||||
}
|
||||
this.stats?.update()
|
||||
}
|
||||
|
||||
clearScene(){
|
||||
// this.hero?.destroy();
|
||||
// this.dashboard?.reset();
|
||||
// this.activeObjects.clear();
|
||||
// this.physics.clear();
|
||||
// this.clickable.removeAll();
|
||||
// this.motionQueue.clearAll();
|
||||
}
|
||||
}
|
||||
|
||||
export { GameEngine }
|
||||
@@ -7,19 +7,19 @@ function assignParams(mesh, params){
|
||||
});
|
||||
}
|
||||
|
||||
function assignMaterial(mesh, params, context){
|
||||
function assignMaterial(mesh, params){
|
||||
if (params.name && params.material){
|
||||
//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(context.path).load(params.dm);
|
||||
var dm = new TextureLoader().setPath(params.path).load(params.dm);
|
||||
mesh.material.map = dm;
|
||||
}
|
||||
if (params.nm){
|
||||
mesh.material.normalMap = new TextureLoader().setPath(context.path).load(params.nm);
|
||||
mesh.material.normalMap = new TextureLoader().setPath(params.path).load(params.nm);
|
||||
}
|
||||
if (params.em) {
|
||||
mesh.material.emissiveMap = new TextureLoader().setPath(context.path).load(params.em);
|
||||
mesh.material.emissiveMap = new TextureLoader().setPath(params.path).load(params.em);
|
||||
}
|
||||
//mesh.material = mp;
|
||||
mesh.material.needsUpdate = true;
|
||||
|
||||
@@ -4,7 +4,6 @@ class MotionEngine {
|
||||
constructor() {
|
||||
const aq = [];
|
||||
const clock = new Clock();
|
||||
|
||||
this.animationQueue = aq;
|
||||
|
||||
function calcValues(target, values, initial, k = 1, mode = 'offset') {
|
||||
@@ -42,6 +41,11 @@ class MotionEngine {
|
||||
}
|
||||
};
|
||||
|
||||
this.clearAll = function(){
|
||||
aq.splice(0, aq.length);
|
||||
return;
|
||||
}
|
||||
|
||||
this.remove = function (a) {
|
||||
let idx = aq.indexOf(a);
|
||||
if (idx > -1) {
|
||||
|
||||
Reference in New Issue
Block a user