diff --git a/src/diagram/diagramObject.ts b/src/diagram/diagramObject.ts index 2bd5634..562aa35 100644 --- a/src/diagram/diagramObject.ts +++ b/src/diagram/diagramObject.ts @@ -182,10 +182,8 @@ export class DiagramObject { color: oldEntity.color, text: oldEntity.text }; - - clone.fromDiagramEntity(newEntity); this._logger.debug('DiagramObject clone called', clone, this._diagramEntity, newEntity); - return clone; + return clone.fromDiagramEntity(newEntity); } public fromDiagramEntity(entity: DiagramEntity): DiagramObject { @@ -311,18 +309,13 @@ export class DiagramObject { } private updateConnection() { - if (this._toMesh.absolutePosition.length() == this._toPosition && this._fromMesh.absolutePosition.length() == this._fromPosition) { return; } - const curve: GreasedLineMesh = ((this._mesh as unknown) as GreasedLineMesh); const ray = new Ray(this._fromMesh.getAbsolutePosition(), Vector3.Normalize(this._toMesh.getAbsolutePosition().subtract(this._fromMesh.getAbsolutePosition()))); - //const rayHelper = new RayHelper(ray); - //rayHelper.show(this._scene, new Color3(1, 0, 0)); const hit = this._scene.multiPickWithRay(ray, (mesh) => { if (mesh.id === this._to || mesh.id === this._from) { - //mesh.updateFacetData(); return true; } else { return false; @@ -349,6 +342,5 @@ export class DiagramObject { curve.setParent(this._baseTransform); curve.setEnabled(true); console.log('done'); - } } \ No newline at end of file diff --git a/src/diagram/functions/buildMeshFromDiagramEntity.ts b/src/diagram/functions/buildMeshFromDiagramEntity.ts index 3b92207..228e772 100644 --- a/src/diagram/functions/buildMeshFromDiagramEntity.ts +++ b/src/diagram/functions/buildMeshFromDiagramEntity.ts @@ -70,6 +70,7 @@ function createNewInstanceIfNecessary(entity: DiagramEntity, scene: Scene): Abst (newMesh as GreasedLineMesh).intersectionThreshold = 2; const material = (newMesh.material as StandardMaterial); material.emissiveTexture = AnimatedLineTexture.Texture(); + material.opacityTexture = AnimatedLineTexture.Texture(); material.disableLighting = true; newMesh.setEnabled(false); break; diff --git a/src/util/animatedLineTexture.ts b/src/util/animatedLineTexture.ts index 760bcce..01bfc24 100644 --- a/src/util/animatedLineTexture.ts +++ b/src/util/animatedLineTexture.ts @@ -1,13 +1,13 @@ -import {Engine, RawTexture} from "@babylonjs/core"; +import {Texture} from "@babylonjs/core"; import {DefaultScene} from "../defaultScene"; export class AnimatedLineTexture { private static _textureColors = new Uint8Array([10, 10, 10, 10, 10, 10, 25, 25, 25, 10, 10, 255]) - private static _texture: RawTexture; + private static _texture: Texture; public static Texture() { if (!AnimatedLineTexture._texture) { - this._texture = new RawTexture( + /*this._texture = new RawTexture( this._textureColors, this._textureColors.length / 3, 1, @@ -16,12 +16,13 @@ export class AnimatedLineTexture { false, true, Engine.TEXTURE_NEAREST_NEAREST - ) - this._texture.wrapU = RawTexture.WRAP_ADDRESSMODE + )*/ + this._texture = new Texture('/assets/textures/arrow.png', DefaultScene.Scene); + //this._texture.wrapU = RawTexture.WRAP_ADDRESSMODE this._texture.name = 'blue-white-texture'; this._texture.uScale = 30; DefaultScene.Scene.onBeforeRenderObservable.add(() => { - this._texture.uOffset -= 0.05 * DefaultScene.Scene.getAnimationRatio() + this._texture.uOffset -= 0.01 * DefaultScene.Scene.getAnimationRatio() }); }