@colijnit/configurator 261.20.2 → 261.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,11 +5,12 @@ import { CommonModule } from '@angular/common';
|
|
|
5
5
|
import { BehaviorSubject, Subject, ReplaySubject, combineLatest, from } from 'rxjs';
|
|
6
6
|
import { StringUtils } from '@colijnit/ioneconnector/build/utils/string-utils';
|
|
7
7
|
import * as THREE from 'three';
|
|
8
|
-
import { Group, BufferGeometry, Float32BufferAttribute, Line, LineBasicMaterial,
|
|
8
|
+
import { Box3, Vector3, Vector2, Object3D, Mesh, Euler, Quaternion, Group, BufferGeometry, Float32BufferAttribute, Line, LineBasicMaterial, CylinderGeometry, MeshBasicMaterial, EquirectangularReflectionMapping, Material as Material$1, Texture as Texture$1, Source, LinearSRGBColorSpace, SRGBColorSpace, Color, MaterialLoader, Camera, EventDispatcher, PerspectiveCamera, PlaneGeometry, DoubleSide, MeshStandardMaterial, RingGeometry, Matrix4, MathUtils, Raycaster, DataTexture, RGFormat, UnsignedByteType, LinearFilter, Shape, SphereGeometry, PCFSoftShadowMap, Scene, ShadowMaterial, LightProbe, DirectionalLight, MeshPhongMaterial, WebGLRenderer, NoToneMapping, TextureLoader, RGBAFormat, AmbientLight, NearestFilter, MeshPhysicalMaterial, BackSide, FrontSide, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, CustomToneMapping, NeutralToneMapping, BasicShadowMap, PCFShadowMap, VSMShadowMap, Light, SpotLight, HemisphereLight, PointLight } from 'three';
|
|
9
|
+
import { Selection } from '@colijnit/configuratorapi/build/model/selection';
|
|
10
|
+
import { HdecoPositioning } from '@colijnit/configuratorapi/build/enum/hdeco-positioning.enum';
|
|
9
11
|
import { Options } from '@colijnit/ioneconnector/build/model/options';
|
|
10
12
|
import { Article } from '@colijnit/configuratorapi/build/model/article';
|
|
11
13
|
import { BusinessObjectFactory } from '@colijnit/ioneconnector/build/service/business-object-factory';
|
|
12
|
-
import { Selection } from '@colijnit/configuratorapi/build/model/selection';
|
|
13
14
|
import { SelectorWithOptions } from '@colijnit/configuratorapi/build/model/selector-with-options';
|
|
14
15
|
import { AnswerPrice } from '@colijnit/configuratorapi/build/model/answer-price';
|
|
15
16
|
import { ImageContent } from '@colijnit/mainapi/build/model/image-content.bo';
|
|
@@ -37,7 +38,6 @@ import * as TWEEN from '@tweenjs/tween.js';
|
|
|
37
38
|
import { WebGLPathTracer } from 'three-gpu-pathtracer';
|
|
38
39
|
import { ParallelMeshBVHWorker } from 'three-mesh-bvh/src/workers/ParallelMeshBVHWorker.js';
|
|
39
40
|
import { computeBoundsTree, disposeBoundsTree, acceleratedRaycast } from 'three-mesh-bvh';
|
|
40
|
-
import { HdecoPositioning } from '@colijnit/configuratorapi/build/enum/hdeco-positioning.enum';
|
|
41
41
|
import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry.js';
|
|
42
42
|
import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js';
|
|
43
43
|
import { XRControllerModelFactory } from 'three/examples/jsm/webxr/XRControllerModelFactory.js';
|
|
@@ -525,6 +525,216 @@ var ConfigurationTemplate;
|
|
|
525
525
|
ConfigurationTemplate["showFullConfiguration"] = "showFullConfiguration";
|
|
526
526
|
})(ConfigurationTemplate || (ConfigurationTemplate = {}));
|
|
527
527
|
|
|
528
|
+
class Scene3DUtil {
|
|
529
|
+
static updatePivot(obj) {
|
|
530
|
+
const boundingBox = new Box3().setFromObject(obj);
|
|
531
|
+
const bbCenterPivot = new Vector3();
|
|
532
|
+
boundingBox.getCenter(bbCenterPivot);
|
|
533
|
+
const delta = new Vector3().sub(bbCenterPivot).setY(Math.abs(Math.min(boundingBox.min.y, 0)));
|
|
534
|
+
obj.children.forEach((child) => {
|
|
535
|
+
child.position.add(delta);
|
|
536
|
+
});
|
|
537
|
+
obj.updateWorldMatrix(false, true);
|
|
538
|
+
}
|
|
539
|
+
static TrySelectorConnection(scene, parent, part1, part2, isFirstElement, createAddableFn) {
|
|
540
|
+
let addable;
|
|
541
|
+
if (createAddableFn) {
|
|
542
|
+
addable = part2;
|
|
543
|
+
part2 = createAddableFn(addable);
|
|
544
|
+
}
|
|
545
|
+
if (part1 && part2) {
|
|
546
|
+
let con1;
|
|
547
|
+
let con2;
|
|
548
|
+
// if part2 is an addable and decoConnection is present, then no need to iterate through connectors
|
|
549
|
+
if (addable && addable instanceof Selection && addable.decoConnection && addable.hdecoPositioning === HdecoPositioning.Variable) {
|
|
550
|
+
con1 = part1.children.find(c => c.name === addable.decoConnection);
|
|
551
|
+
if (!con1) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
for (let ii = 0; ii < part2.children.length; ii++) {
|
|
555
|
+
con2 = part2.children[ii];
|
|
556
|
+
// if these connectors can connect connect them
|
|
557
|
+
if (!con1.userData.connected && !con2.userData.connected && this.CanSelectorConnect(part1.children, con1, con2, isFirstElement)) {
|
|
558
|
+
// if (!con1['connected'] && !con2['connected'] && this.CanSelectorConnect(part1.children, con1, con2, isFirstElement)) {
|
|
559
|
+
// if addable, continue this loop with a new addable
|
|
560
|
+
if (addable) {
|
|
561
|
+
const newPart2 = createAddableFn(addable, part2, part1);
|
|
562
|
+
// reference of part2 changed, so refresh con2
|
|
563
|
+
this.SelectorConnect(scene, parent, con1, newPart2.children[ii]);
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
return this.SelectorConnect(scene, parent, con1, con2);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
for (let i = 0; i < part1.children.length; i++) {
|
|
573
|
+
for (let ii = 0; ii < part2.children.length; ii++) {
|
|
574
|
+
con1 = part1.children[i];
|
|
575
|
+
con2 = part2.children[ii];
|
|
576
|
+
let con1Connected = false;
|
|
577
|
+
if (con1 && con1.userData) {
|
|
578
|
+
con1Connected = con1.userData.connected;
|
|
579
|
+
}
|
|
580
|
+
let con2Connected = false;
|
|
581
|
+
if (con2 && con2.userData) {
|
|
582
|
+
con2Connected = con2.userData.connected;
|
|
583
|
+
}
|
|
584
|
+
// if these connectors can connect connect them
|
|
585
|
+
if (!con1Connected && !con2Connected && this.CanSelectorConnect(part1.children, con1, con2, isFirstElement)) {
|
|
586
|
+
// if addable, continue this loop with a new addable
|
|
587
|
+
if (addable) {
|
|
588
|
+
const newPart2 = createAddableFn(addable, part2, part1);
|
|
589
|
+
// reference of part2 changed, so refresh con2
|
|
590
|
+
this.SelectorConnect(scene, parent, con1, newPart2.children[ii]);
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
return this.SelectorConnect(scene, parent, con1, con2);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return false;
|
|
601
|
+
}
|
|
602
|
+
// public static TrySelectorConnection(scene: Scene, parent: Object3D,
|
|
603
|
+
// part1: any, part2: any, createAddableFn?: Function): boolean {
|
|
604
|
+
// let addable: any;
|
|
605
|
+
// if (createAddableFn) {
|
|
606
|
+
// addable = part2;
|
|
607
|
+
// part2 = createAddableFn(addable);
|
|
608
|
+
// }
|
|
609
|
+
// for (let i = 0; i < part1.children.length; i++) {
|
|
610
|
+
// for (let ii = 0; ii < part2.children.length; ii++) {
|
|
611
|
+
// const con1: Object3D = part1.children[i];
|
|
612
|
+
// const con2: Object3D = part2.children[ii];
|
|
613
|
+
// // if these connectors can connect connect them
|
|
614
|
+
// if (!con1['connected'] && !con2['connected'] && this.CanSelectorConnect(con1, con2)) {
|
|
615
|
+
// // if addable, continue this loop with a new addable
|
|
616
|
+
// if (addable) {
|
|
617
|
+
// const newPart2: Object3D = createAddableFn(addable, part2, part1);
|
|
618
|
+
// // reference of part2 changed, so refresh con2
|
|
619
|
+
// this.SelectorConnect(scene, parent, con1, newPart2.children[ii]);
|
|
620
|
+
// } else {
|
|
621
|
+
// return this.SelectorConnect(scene, parent, con1, con2);
|
|
622
|
+
// }
|
|
623
|
+
// }
|
|
624
|
+
// }
|
|
625
|
+
// }
|
|
626
|
+
// return false;
|
|
627
|
+
// }
|
|
628
|
+
static Convert3DPointToScreenPoint(point, camera, width, height) {
|
|
629
|
+
if (!point) {
|
|
630
|
+
return new Vector2();
|
|
631
|
+
}
|
|
632
|
+
const vector = point.clone().project(camera);
|
|
633
|
+
vector.x = (vector.x + 1) / 2 * width;
|
|
634
|
+
vector.y = -(vector.y - 1) / 2 * height;
|
|
635
|
+
return new Vector2(vector.x, vector.y);
|
|
636
|
+
}
|
|
637
|
+
static CanSelectorConnect(consPart1, con1, con2, startWithMale) {
|
|
638
|
+
const con1Name = (con1 instanceof Object3D || con1 instanceof Mesh) ? con1.name : con1.connector;
|
|
639
|
+
const con2Name = (con2 instanceof Object3D || con2 instanceof Mesh) ? con2.name : con2.connector;
|
|
640
|
+
const sameParent = (con1 instanceof Object3D || con1 instanceof Mesh) &&
|
|
641
|
+
(con2 instanceof Object3D || con2 instanceof Mesh) ? con1.parent === con2.parent : false;
|
|
642
|
+
if (!con1Name || !con2Name) {
|
|
643
|
+
return false;
|
|
644
|
+
}
|
|
645
|
+
const parts1 = con1Name.toUpperCase().split('_'), parts2 = con2Name.toUpperCase().split('_');
|
|
646
|
+
if (parts1.length >= 3 && parts2.length >= 3 && !sameParent) {
|
|
647
|
+
const connectable = parts1[0] === 'C' && parts2[0] === 'C' &&
|
|
648
|
+
parts1[1] === parts2[1] && parts1[2] !== parts2[2];
|
|
649
|
+
return connectable;
|
|
650
|
+
}
|
|
651
|
+
return false;
|
|
652
|
+
}
|
|
653
|
+
// public static CanSelectorConnect(con1: Object3D | any, con2: Object3D | any): boolean {
|
|
654
|
+
// const con1Name: string = con1 instanceof Object3D ? con1.name : con1.connector;
|
|
655
|
+
// const con2Name: string = con2 instanceof Object3D ? con2.name : con2.connector;
|
|
656
|
+
// const sameParent: boolean = con1 instanceof Object3D && con2 instanceof Object3D ? con1.parent === con2.parent : false;
|
|
657
|
+
// const parts1: string[] = con1Name.toUpperCase().split('_'),
|
|
658
|
+
// parts2: string[] = con2Name.toUpperCase().split('_');
|
|
659
|
+
// if (parts1.length >= 3 && parts2.length >= 3 && !sameParent) {
|
|
660
|
+
// const connectable: boolean = parts1[0] === 'C' && parts2[0] === 'C' &&
|
|
661
|
+
// parts1[1] === parts2[1] && parts1[2] !== parts2[2];
|
|
662
|
+
// return connectable;
|
|
663
|
+
// }
|
|
664
|
+
// return false;
|
|
665
|
+
// }
|
|
666
|
+
static SelectorConnect(scene, parent, con1, con2) {
|
|
667
|
+
if (!scene || !parent) {
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
con1['connectedTo'] = con2 && con2.parent ? con2.parent.name : '';
|
|
671
|
+
con2['connectedTo'] = con1 && con1.parent ? con1.parent.name : '';
|
|
672
|
+
con1.userData.connectedTo = con2 && con2.parent ? con2.parent.name : '';
|
|
673
|
+
con1.userData.connected = false;
|
|
674
|
+
con2.userData.connectedTo = con1 && con1.parent ? con1.parent.name : '';
|
|
675
|
+
con2.userData.connected = false;
|
|
676
|
+
const motherRotation = new Euler(0, 0, 0);
|
|
677
|
+
const motherPosition = new Vector3(0, 0, 0);
|
|
678
|
+
parent.updateMatrixWorld();
|
|
679
|
+
motherRotation.copy(parent.rotation);
|
|
680
|
+
parent.getWorldPosition(motherPosition);
|
|
681
|
+
parent.rotation.set(0, 0, 0);
|
|
682
|
+
parent.position.set(0, 0, 0);
|
|
683
|
+
scene.updateMatrixWorld(true);
|
|
684
|
+
const con1Quat = new Quaternion();
|
|
685
|
+
if (con1) {
|
|
686
|
+
con1.getWorldQuaternion(con1Quat);
|
|
687
|
+
}
|
|
688
|
+
const con2Quat = new Quaternion();
|
|
689
|
+
if (con2) {
|
|
690
|
+
con2.getWorldQuaternion(con2Quat);
|
|
691
|
+
}
|
|
692
|
+
const con1QuatParent = new Quaternion();
|
|
693
|
+
if (con1 && con1.parent) {
|
|
694
|
+
con1.parent.getWorldQuaternion(con1QuatParent);
|
|
695
|
+
}
|
|
696
|
+
const con2QuatParent = new Quaternion();
|
|
697
|
+
if (con2 && con2.parent) {
|
|
698
|
+
con2.parent.getWorldQuaternion(con2QuatParent);
|
|
699
|
+
}
|
|
700
|
+
const rotation = new Quaternion().multiplyQuaternions(con1Quat.invert(), con2Quat).multiply(new Quaternion().multiplyQuaternions(con1QuatParent, con1QuatParent));
|
|
701
|
+
if (con2 && con2.parent) {
|
|
702
|
+
con2.parent.quaternion.copy(rotation);
|
|
703
|
+
}
|
|
704
|
+
// Update because the matrix has been tempered with
|
|
705
|
+
scene.updateMatrixWorld(true);
|
|
706
|
+
// Move the connectors towards eachother
|
|
707
|
+
const con1Pos = new Vector3();
|
|
708
|
+
if (con1) {
|
|
709
|
+
con1.getWorldPosition(con1Pos);
|
|
710
|
+
}
|
|
711
|
+
const con2Pos = new Vector3();
|
|
712
|
+
if (con2) {
|
|
713
|
+
con2.getWorldPosition(con2Pos);
|
|
714
|
+
}
|
|
715
|
+
const move = con1Pos.sub(con2Pos);
|
|
716
|
+
if (con2 && con2.parent) {
|
|
717
|
+
con2.parent.position.x += move.x;
|
|
718
|
+
con2.parent.position.y += move.y;
|
|
719
|
+
con2.parent.position.z += move.z;
|
|
720
|
+
}
|
|
721
|
+
// reset parent's objects rotation and position
|
|
722
|
+
parent.rotation.copy(motherRotation);
|
|
723
|
+
parent.position.copy(motherPosition);
|
|
724
|
+
scene.updateMatrixWorld(true);
|
|
725
|
+
// Set the connected flag
|
|
726
|
+
if (con1) {
|
|
727
|
+
// con1['connected'] = true;
|
|
728
|
+
con1.userData.connected = true;
|
|
729
|
+
}
|
|
730
|
+
if (con2) {
|
|
731
|
+
// con2['connected'] = true;
|
|
732
|
+
con2.userData.connected = true;
|
|
733
|
+
}
|
|
734
|
+
return true;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
528
738
|
var ResultType;
|
|
529
739
|
(function (ResultType) {
|
|
530
740
|
ResultType["Unknown"] = "Unknown";
|
|
@@ -3672,216 +3882,6 @@ class RelativePositionUtils {
|
|
|
3672
3882
|
}
|
|
3673
3883
|
}
|
|
3674
3884
|
|
|
3675
|
-
class Scene3DUtil {
|
|
3676
|
-
static updatePivot(obj) {
|
|
3677
|
-
const boundingBox = new Box3().setFromObject(obj);
|
|
3678
|
-
const bbCenterPivot = new Vector3();
|
|
3679
|
-
boundingBox.getCenter(bbCenterPivot);
|
|
3680
|
-
const delta = new Vector3().sub(bbCenterPivot).setY(Math.abs(Math.min(boundingBox.min.y, 0)));
|
|
3681
|
-
obj.children.forEach((child) => {
|
|
3682
|
-
child.position.add(delta);
|
|
3683
|
-
});
|
|
3684
|
-
obj.updateWorldMatrix(false, true);
|
|
3685
|
-
}
|
|
3686
|
-
static TrySelectorConnection(scene, parent, part1, part2, isFirstElement, createAddableFn) {
|
|
3687
|
-
let addable;
|
|
3688
|
-
if (createAddableFn) {
|
|
3689
|
-
addable = part2;
|
|
3690
|
-
part2 = createAddableFn(addable);
|
|
3691
|
-
}
|
|
3692
|
-
if (part1 && part2) {
|
|
3693
|
-
let con1;
|
|
3694
|
-
let con2;
|
|
3695
|
-
// if part2 is an addable and decoConnection is present, then no need to iterate through connectors
|
|
3696
|
-
if (addable && addable instanceof Selection && addable.decoConnection && addable.hdecoPositioning === HdecoPositioning.Variable) {
|
|
3697
|
-
con1 = part1.children.find(c => c.name === addable.decoConnection);
|
|
3698
|
-
if (!con1) {
|
|
3699
|
-
return false;
|
|
3700
|
-
}
|
|
3701
|
-
for (let ii = 0; ii < part2.children.length; ii++) {
|
|
3702
|
-
con2 = part2.children[ii];
|
|
3703
|
-
// if these connectors can connect connect them
|
|
3704
|
-
if (!con1.userData.connected && !con2.userData.connected && this.CanSelectorConnect(part1.children, con1, con2, isFirstElement)) {
|
|
3705
|
-
// if (!con1['connected'] && !con2['connected'] && this.CanSelectorConnect(part1.children, con1, con2, isFirstElement)) {
|
|
3706
|
-
// if addable, continue this loop with a new addable
|
|
3707
|
-
if (addable) {
|
|
3708
|
-
const newPart2 = createAddableFn(addable, part2, part1);
|
|
3709
|
-
// reference of part2 changed, so refresh con2
|
|
3710
|
-
this.SelectorConnect(scene, parent, con1, newPart2.children[ii]);
|
|
3711
|
-
}
|
|
3712
|
-
else {
|
|
3713
|
-
return this.SelectorConnect(scene, parent, con1, con2);
|
|
3714
|
-
}
|
|
3715
|
-
}
|
|
3716
|
-
}
|
|
3717
|
-
}
|
|
3718
|
-
else {
|
|
3719
|
-
for (let i = 0; i < part1.children.length; i++) {
|
|
3720
|
-
for (let ii = 0; ii < part2.children.length; ii++) {
|
|
3721
|
-
con1 = part1.children[i];
|
|
3722
|
-
con2 = part2.children[ii];
|
|
3723
|
-
let con1Connected = false;
|
|
3724
|
-
if (con1 && con1.userData) {
|
|
3725
|
-
con1Connected = con1.userData.connected;
|
|
3726
|
-
}
|
|
3727
|
-
let con2Connected = false;
|
|
3728
|
-
if (con2 && con2.userData) {
|
|
3729
|
-
con2Connected = con2.userData.connected;
|
|
3730
|
-
}
|
|
3731
|
-
// if these connectors can connect connect them
|
|
3732
|
-
if (!con1Connected && !con2Connected && this.CanSelectorConnect(part1.children, con1, con2, isFirstElement)) {
|
|
3733
|
-
// if addable, continue this loop with a new addable
|
|
3734
|
-
if (addable) {
|
|
3735
|
-
const newPart2 = createAddableFn(addable, part2, part1);
|
|
3736
|
-
// reference of part2 changed, so refresh con2
|
|
3737
|
-
this.SelectorConnect(scene, parent, con1, newPart2.children[ii]);
|
|
3738
|
-
}
|
|
3739
|
-
else {
|
|
3740
|
-
return this.SelectorConnect(scene, parent, con1, con2);
|
|
3741
|
-
}
|
|
3742
|
-
}
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3745
|
-
}
|
|
3746
|
-
}
|
|
3747
|
-
return false;
|
|
3748
|
-
}
|
|
3749
|
-
// public static TrySelectorConnection(scene: Scene, parent: Object3D,
|
|
3750
|
-
// part1: any, part2: any, createAddableFn?: Function): boolean {
|
|
3751
|
-
// let addable: any;
|
|
3752
|
-
// if (createAddableFn) {
|
|
3753
|
-
// addable = part2;
|
|
3754
|
-
// part2 = createAddableFn(addable);
|
|
3755
|
-
// }
|
|
3756
|
-
// for (let i = 0; i < part1.children.length; i++) {
|
|
3757
|
-
// for (let ii = 0; ii < part2.children.length; ii++) {
|
|
3758
|
-
// const con1: Object3D = part1.children[i];
|
|
3759
|
-
// const con2: Object3D = part2.children[ii];
|
|
3760
|
-
// // if these connectors can connect connect them
|
|
3761
|
-
// if (!con1['connected'] && !con2['connected'] && this.CanSelectorConnect(con1, con2)) {
|
|
3762
|
-
// // if addable, continue this loop with a new addable
|
|
3763
|
-
// if (addable) {
|
|
3764
|
-
// const newPart2: Object3D = createAddableFn(addable, part2, part1);
|
|
3765
|
-
// // reference of part2 changed, so refresh con2
|
|
3766
|
-
// this.SelectorConnect(scene, parent, con1, newPart2.children[ii]);
|
|
3767
|
-
// } else {
|
|
3768
|
-
// return this.SelectorConnect(scene, parent, con1, con2);
|
|
3769
|
-
// }
|
|
3770
|
-
// }
|
|
3771
|
-
// }
|
|
3772
|
-
// }
|
|
3773
|
-
// return false;
|
|
3774
|
-
// }
|
|
3775
|
-
static Convert3DPointToScreenPoint(point, camera, width, height) {
|
|
3776
|
-
if (!point) {
|
|
3777
|
-
return new Vector2();
|
|
3778
|
-
}
|
|
3779
|
-
const vector = point.clone().project(camera);
|
|
3780
|
-
vector.x = (vector.x + 1) / 2 * width;
|
|
3781
|
-
vector.y = -(vector.y - 1) / 2 * height;
|
|
3782
|
-
return new Vector2(vector.x, vector.y);
|
|
3783
|
-
}
|
|
3784
|
-
static CanSelectorConnect(consPart1, con1, con2, startWithMale) {
|
|
3785
|
-
const con1Name = (con1 instanceof Object3D || con1 instanceof Mesh) ? con1.name : con1.connector;
|
|
3786
|
-
const con2Name = (con2 instanceof Object3D || con2 instanceof Mesh) ? con2.name : con2.connector;
|
|
3787
|
-
const sameParent = (con1 instanceof Object3D || con1 instanceof Mesh) &&
|
|
3788
|
-
(con2 instanceof Object3D || con2 instanceof Mesh) ? con1.parent === con2.parent : false;
|
|
3789
|
-
if (!con1Name || !con2Name) {
|
|
3790
|
-
return false;
|
|
3791
|
-
}
|
|
3792
|
-
const parts1 = con1Name.toUpperCase().split('_'), parts2 = con2Name.toUpperCase().split('_');
|
|
3793
|
-
if (parts1.length >= 3 && parts2.length >= 3 && !sameParent) {
|
|
3794
|
-
const connectable = parts1[0] === 'C' && parts2[0] === 'C' &&
|
|
3795
|
-
parts1[1] === parts2[1] && parts1[2] !== parts2[2];
|
|
3796
|
-
return connectable;
|
|
3797
|
-
}
|
|
3798
|
-
return false;
|
|
3799
|
-
}
|
|
3800
|
-
// public static CanSelectorConnect(con1: Object3D | any, con2: Object3D | any): boolean {
|
|
3801
|
-
// const con1Name: string = con1 instanceof Object3D ? con1.name : con1.connector;
|
|
3802
|
-
// const con2Name: string = con2 instanceof Object3D ? con2.name : con2.connector;
|
|
3803
|
-
// const sameParent: boolean = con1 instanceof Object3D && con2 instanceof Object3D ? con1.parent === con2.parent : false;
|
|
3804
|
-
// const parts1: string[] = con1Name.toUpperCase().split('_'),
|
|
3805
|
-
// parts2: string[] = con2Name.toUpperCase().split('_');
|
|
3806
|
-
// if (parts1.length >= 3 && parts2.length >= 3 && !sameParent) {
|
|
3807
|
-
// const connectable: boolean = parts1[0] === 'C' && parts2[0] === 'C' &&
|
|
3808
|
-
// parts1[1] === parts2[1] && parts1[2] !== parts2[2];
|
|
3809
|
-
// return connectable;
|
|
3810
|
-
// }
|
|
3811
|
-
// return false;
|
|
3812
|
-
// }
|
|
3813
|
-
static SelectorConnect(scene, parent, con1, con2) {
|
|
3814
|
-
if (!scene || !parent) {
|
|
3815
|
-
return false;
|
|
3816
|
-
}
|
|
3817
|
-
con1['connectedTo'] = con2 && con2.parent ? con2.parent.name : '';
|
|
3818
|
-
con2['connectedTo'] = con1 && con1.parent ? con1.parent.name : '';
|
|
3819
|
-
con1.userData.connectedTo = con2 && con2.parent ? con2.parent.name : '';
|
|
3820
|
-
con1.userData.connected = false;
|
|
3821
|
-
con2.userData.connectedTo = con1 && con1.parent ? con1.parent.name : '';
|
|
3822
|
-
con2.userData.connected = false;
|
|
3823
|
-
const motherRotation = new Euler(0, 0, 0);
|
|
3824
|
-
const motherPosition = new Vector3(0, 0, 0);
|
|
3825
|
-
parent.updateMatrixWorld();
|
|
3826
|
-
motherRotation.copy(parent.rotation);
|
|
3827
|
-
parent.getWorldPosition(motherPosition);
|
|
3828
|
-
parent.rotation.set(0, 0, 0);
|
|
3829
|
-
parent.position.set(0, 0, 0);
|
|
3830
|
-
scene.updateMatrixWorld(true);
|
|
3831
|
-
const con1Quat = new Quaternion();
|
|
3832
|
-
if (con1) {
|
|
3833
|
-
con1.getWorldQuaternion(con1Quat);
|
|
3834
|
-
}
|
|
3835
|
-
const con2Quat = new Quaternion();
|
|
3836
|
-
if (con2) {
|
|
3837
|
-
con2.getWorldQuaternion(con2Quat);
|
|
3838
|
-
}
|
|
3839
|
-
const con1QuatParent = new Quaternion();
|
|
3840
|
-
if (con1 && con1.parent) {
|
|
3841
|
-
con1.parent.getWorldQuaternion(con1QuatParent);
|
|
3842
|
-
}
|
|
3843
|
-
const con2QuatParent = new Quaternion();
|
|
3844
|
-
if (con2 && con2.parent) {
|
|
3845
|
-
con2.parent.getWorldQuaternion(con2QuatParent);
|
|
3846
|
-
}
|
|
3847
|
-
const rotation = new Quaternion().multiplyQuaternions(con1Quat.invert(), con2Quat).multiply(new Quaternion().multiplyQuaternions(con1QuatParent, con1QuatParent));
|
|
3848
|
-
if (con2 && con2.parent) {
|
|
3849
|
-
con2.parent.quaternion.copy(rotation);
|
|
3850
|
-
}
|
|
3851
|
-
// Update because the matrix has been tempered with
|
|
3852
|
-
scene.updateMatrixWorld(true);
|
|
3853
|
-
// Move the connectors towards eachother
|
|
3854
|
-
const con1Pos = new Vector3();
|
|
3855
|
-
if (con1) {
|
|
3856
|
-
con1.getWorldPosition(con1Pos);
|
|
3857
|
-
}
|
|
3858
|
-
const con2Pos = new Vector3();
|
|
3859
|
-
if (con2) {
|
|
3860
|
-
con2.getWorldPosition(con2Pos);
|
|
3861
|
-
}
|
|
3862
|
-
const move = con1Pos.sub(con2Pos);
|
|
3863
|
-
if (con2 && con2.parent) {
|
|
3864
|
-
con2.parent.position.x += move.x;
|
|
3865
|
-
con2.parent.position.y += move.y;
|
|
3866
|
-
con2.parent.position.z += move.z;
|
|
3867
|
-
}
|
|
3868
|
-
// reset parent's objects rotation and position
|
|
3869
|
-
parent.rotation.copy(motherRotation);
|
|
3870
|
-
parent.position.copy(motherPosition);
|
|
3871
|
-
scene.updateMatrixWorld(true);
|
|
3872
|
-
// Set the connected flag
|
|
3873
|
-
if (con1) {
|
|
3874
|
-
// con1['connected'] = true;
|
|
3875
|
-
con1.userData.connected = true;
|
|
3876
|
-
}
|
|
3877
|
-
if (con2) {
|
|
3878
|
-
// con2['connected'] = true;
|
|
3879
|
-
con2.userData.connected = true;
|
|
3880
|
-
}
|
|
3881
|
-
return true;
|
|
3882
|
-
}
|
|
3883
|
-
}
|
|
3884
|
-
|
|
3885
3885
|
/**
|
|
3886
3886
|
This file is a modified version of THREE.OrbitControls
|
|
3887
3887
|
Contributors:
|
|
@@ -12046,14 +12046,13 @@ class ConfiguringService {
|
|
|
12046
12046
|
}
|
|
12047
12047
|
addBuildToScene(buildResult) {
|
|
12048
12048
|
if (buildResult && buildResult.object) {
|
|
12049
|
+
Scene3DUtil.updatePivot(buildResult.object);
|
|
12049
12050
|
this._itemService.addItem(buildResult.object);
|
|
12050
12051
|
}
|
|
12051
12052
|
}
|
|
12052
12053
|
async handleLoadSceneContent() {
|
|
12053
12054
|
try {
|
|
12054
|
-
// this._loaderProcessUpdate(++this.currentStep);
|
|
12055
12055
|
await this._lightPresetService.prepareLoadLightPreset(true);
|
|
12056
|
-
// this._loaderProcessUpdate(++this.currentStep);
|
|
12057
12056
|
this._cameraService.camera.position.set(0, 1, 4);
|
|
12058
12057
|
this._cameraService.camera.lookAt(new Vector3());
|
|
12059
12058
|
if (this.settingsService.settings.options.cameraPositionFixed) {
|
|
@@ -12064,17 +12063,6 @@ class ConfiguringService {
|
|
|
12064
12063
|
}
|
|
12065
12064
|
this._sceneEventService.rotateNoDrag = true;
|
|
12066
12065
|
this._sceneService.needsRender = true;
|
|
12067
|
-
// this._loaderProcessUpdate(++this.currentStep);
|
|
12068
|
-
// if (this.settingsService.settings.options.showDownloadButton) {
|
|
12069
|
-
// this._createDownloadButton();
|
|
12070
|
-
// }
|
|
12071
|
-
// if (this.settingsService.settings.options.showMeasurementsButton) {
|
|
12072
|
-
// this._createMeasurementsButton();
|
|
12073
|
-
// }
|
|
12074
|
-
// if (this.settingsService.settings.options.development) {
|
|
12075
|
-
// this._createCameraSettingsButton();
|
|
12076
|
-
// }
|
|
12077
|
-
// this._loaderProcessUpdate(++this.currentStep);
|
|
12078
12066
|
}
|
|
12079
12067
|
catch (e) {
|
|
12080
12068
|
console.error('Error during preparation:', e.message);
|