chnaged preview to match current connection style.
This commit is contained in:
parent
17206abca7
commit
71da2dd6a2
@ -1,11 +1,14 @@
|
|||||||
import {
|
import {
|
||||||
AbstractMesh,
|
AbstractMesh,
|
||||||
LinesMesh,
|
CreateGreasedLine,
|
||||||
|
GreasedLineMesh,
|
||||||
|
GreasedLineMeshColorMode,
|
||||||
MeshBuilder,
|
MeshBuilder,
|
||||||
Observable,
|
Observable,
|
||||||
Observer,
|
Observer,
|
||||||
Ray,
|
Ray,
|
||||||
Scene,
|
Scene,
|
||||||
|
StandardMaterial,
|
||||||
TransformNode,
|
TransformNode,
|
||||||
Vector3,
|
Vector3,
|
||||||
WebXRInputSource
|
WebXRInputSource
|
||||||
@ -13,12 +16,13 @@ import {
|
|||||||
import {DefaultScene} from "../defaultScene";
|
import {DefaultScene} from "../defaultScene";
|
||||||
import {DiagramEvent, DiagramEventType, DiagramTemplates} from "../diagram/types/diagramEntity";
|
import {DiagramEvent, DiagramEventType, DiagramTemplates} from "../diagram/types/diagramEntity";
|
||||||
import {DiagramEventObserverMask} from "../diagram/types/diagramEventObserverMask";
|
import {DiagramEventObserverMask} from "../diagram/types/diagramEventObserverMask";
|
||||||
|
import {AnimatedLineTexture} from "../util/animatedLineTexture";
|
||||||
|
|
||||||
export class ConnectionPreview {
|
export class ConnectionPreview {
|
||||||
private _fromPoint: Vector3;
|
private _fromPoint: Vector3;
|
||||||
private _fromId: string;
|
private _fromId: string;
|
||||||
private _renderObserver: Observer<Scene>;
|
private _renderObserver: Observer<Scene>;
|
||||||
private _line: LinesMesh;
|
private _line: GreasedLineMesh;
|
||||||
private _parent: TransformNode;
|
private _parent: TransformNode;
|
||||||
private _transform: TransformNode;
|
private _transform: TransformNode;
|
||||||
private _options: any;
|
private _options: any;
|
||||||
@ -62,11 +66,23 @@ export class ConnectionPreview {
|
|||||||
useAlphaForLines: false,
|
useAlphaForLines: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this._line = MeshBuilder.CreateLines("connectionPreview", this._options, this._scene);
|
this._line = CreateGreasedLine("connectionPreview", this._options, {
|
||||||
this._options.instance = this._line;
|
width: .02,
|
||||||
|
colorMode: GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY
|
||||||
|
}, this._scene) as GreasedLineMesh;
|
||||||
|
const material = (this._line.material as StandardMaterial);
|
||||||
|
material.emissiveTexture = AnimatedLineTexture.Texture();
|
||||||
|
material.opacityTexture = AnimatedLineTexture.Texture();
|
||||||
|
material.disableLighting = true;
|
||||||
|
//this._options.instance = this._line;
|
||||||
|
|
||||||
this._renderObserver = this._scene.onBeforeRenderObservable.add(() => {
|
this._renderObserver = this._scene.onBeforeRenderObservable.add(() => {
|
||||||
this._options.points[1] = this._transform.absolutePosition;
|
this._options.points[1] = this._transform.absolutePosition;
|
||||||
this._line = MeshBuilder.CreateLines("connectionPreview", this._options);
|
const pts = this._options.points.flatMap((p: Vector3) => {
|
||||||
|
return p.asArray()
|
||||||
|
});
|
||||||
|
console.log(pts);
|
||||||
|
this._line.setPoints([pts]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user