small change to formatting/fixed problem with mesh removal removing shared materials.
This commit is contained in:
parent
e85adc1386
commit
cdaff97614
@ -10,6 +10,7 @@ export function grabAndClone(diagramManager: DiagramManager, mesh: AbstractMesh,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
diagramObject.baseTransform.setParent(parent);
|
diagramObject.baseTransform.setParent(parent);
|
||||||
|
diagramManager.addObject(diagramObject);
|
||||||
return diagramObject;
|
return diagramObject;
|
||||||
} else {
|
} else {
|
||||||
const entity = {
|
const entity = {
|
||||||
@ -20,8 +21,12 @@ export function grabAndClone(diagramManager: DiagramManager, mesh: AbstractMesh,
|
|||||||
scale: vectoxys(mesh.scaling)
|
scale: vectoxys(mesh.scaling)
|
||||||
|
|
||||||
}
|
}
|
||||||
const obj = new DiagramObject(parent.getScene(), {diagramEntity: entity});
|
const obj = new DiagramObject(parent.getScene(), {
|
||||||
|
diagramEntity: entity,
|
||||||
|
actionManager: diagramManager.actionManager
|
||||||
|
});
|
||||||
obj.baseTransform.setParent(parent);
|
obj.baseTransform.setParent(parent);
|
||||||
|
diagramManager.addObject(obj);
|
||||||
return obj;
|
return obj;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {AbstractMesh, ActionManager, Observable, Scene} from "@babylonjs/core";
|
import {AbstractActionManager, AbstractMesh, ActionManager, Observable, Scene} from "@babylonjs/core";
|
||||||
import {DiagramEntity, DiagramEvent, DiagramEventType} from "./types/diagramEntity";
|
import {DiagramEntity, DiagramEvent, DiagramEventType} from "./types/diagramEntity";
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import {Controllers} from "../controllers/controllers";
|
import {Controllers} from "../controllers/controllers";
|
||||||
@ -54,6 +54,10 @@ export class DiagramManager {
|
|||||||
this.logger.debug("DiagramManager constructed");
|
this.logger.debug("DiagramManager constructed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get actionManager(): AbstractActionManager {
|
||||||
|
return this._diagramEntityActionManager;
|
||||||
|
}
|
||||||
|
|
||||||
public get diagramMenuManager(): DiagramMenuManager {
|
public get diagramMenuManager(): DiagramMenuManager {
|
||||||
return this._diagramMenuManager;
|
return this._diagramMenuManager;
|
||||||
}
|
}
|
||||||
@ -66,6 +70,7 @@ export class DiagramManager {
|
|||||||
return this._diagramObjects.has(mesh?.id)
|
return this._diagramObjects.has(mesh?.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public get controllers(): Controllers {
|
public get controllers(): Controllers {
|
||||||
return this._controllers;
|
return this._controllers;
|
||||||
}
|
}
|
||||||
@ -75,9 +80,13 @@ export class DiagramManager {
|
|||||||
if (!diagramObject) {
|
if (!diagramObject) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return diagramObject.clone();
|
const obj = diagramObject.clone();
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addObject(diagramObject: DiagramObject) {
|
||||||
|
this._diagramObjects.set(diagramObject.diagramEntity.id, diagramObject);
|
||||||
|
}
|
||||||
public get config(): AppConfig {
|
public get config(): AppConfig {
|
||||||
return this._config;
|
return this._config;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,10 +148,12 @@ export class DiagramObject {
|
|||||||
public dispose() {
|
public dispose() {
|
||||||
this._scene.onAfterRenderObservable.remove(this._sceneObserver);
|
this._scene.onAfterRenderObservable.remove(this._sceneObserver);
|
||||||
this._sceneObserver = null;
|
this._sceneObserver = null;
|
||||||
this._mesh?.dispose(false, true);
|
this._mesh.setParent(null);
|
||||||
|
this._mesh?.dispose(true, false);
|
||||||
this._mesh = null;
|
this._mesh = null;
|
||||||
this._label?.dispose();
|
this._label?.dispose();
|
||||||
this._label = null;
|
this._label = null;
|
||||||
|
this._baseTransform.dispose();
|
||||||
this._diagramEntity = null;
|
this._diagramEntity = null;
|
||||||
this._scene = null;
|
this._scene = null;
|
||||||
}
|
}
|
||||||
@ -160,6 +162,7 @@ export class DiagramObject {
|
|||||||
this._baseTransform.position = Vector3.Center(fromMesh.getAbsolutePosition().clone(), toMesh.getAbsolutePosition().clone());
|
this._baseTransform.position = Vector3.Center(fromMesh.getAbsolutePosition().clone(), toMesh.getAbsolutePosition().clone());
|
||||||
this._baseTransform.lookAt(toMesh.getAbsolutePosition());
|
this._baseTransform.lookAt(toMesh.getAbsolutePosition());
|
||||||
this._mesh.scaling.y = Vector3.Distance(fromMesh.getAbsolutePosition(), toMesh.getAbsolutePosition());
|
this._mesh.scaling.y = Vector3.Distance(fromMesh.getAbsolutePosition(), toMesh.getAbsolutePosition());
|
||||||
|
this._mesh.material = fromMesh.material;
|
||||||
if (!this._mesh.parent) {
|
if (!this._mesh.parent) {
|
||||||
this._mesh.parent = this._baseTransform;
|
this._mesh.parent = this._baseTransform;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ export async function groundMeshObserver(ground: AbstractMesh,
|
|||||||
disableNearInteraction: true,
|
disableNearInteraction: true,
|
||||||
outputCanvasOptions: {
|
outputCanvasOptions: {
|
||||||
canvasOptions: {
|
canvasOptions: {
|
||||||
|
|
||||||
framebufferScaleFactor: 1
|
framebufferScaleFactor: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -34,10 +34,12 @@ export class VrApp {
|
|||||||
if (webGpu) {
|
if (webGpu) {
|
||||||
engine = new WebGPUEngine(canvas);
|
engine = new WebGPUEngine(canvas);
|
||||||
await (engine as WebGPUEngine).initAsync();
|
await (engine as WebGPUEngine).initAsync();
|
||||||
|
console.log("WebGPU enabled");
|
||||||
} else {
|
} else {
|
||||||
engine = new Engine(canvas, true);
|
engine = new Engine(canvas, true);
|
||||||
}
|
}
|
||||||
engine.setHardwareScalingLevel(1 / window.devicePixelRatio);
|
engine.setHardwareScalingLevel(1 / window.devicePixelRatio);
|
||||||
|
console.log(engine.getCaps().multiview);
|
||||||
window.onresize = () => {
|
window.onresize = () => {
|
||||||
engine.resize();
|
engine.resize();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user