door_models 5.2.0 → 5.2.2
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.
- package/dist/index.cjs.js +170 -50
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +170 -50
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -100,8 +100,10 @@ const ConfiguratorContext = /*#__PURE__*/React.createContext(undefined);
|
|
|
100
100
|
const ConfiguratorProvider = _ref => {
|
|
101
101
|
let {
|
|
102
102
|
children,
|
|
103
|
-
initialIs2D = false
|
|
103
|
+
initialIs2D = false,
|
|
104
|
+
initialMaterials = {}
|
|
104
105
|
} = _ref;
|
|
106
|
+
const [materials, setMaterials] = React.useState(initialMaterials);
|
|
105
107
|
const [is2D, setIs2D] = React.useState(initialIs2D);
|
|
106
108
|
const [isPlaneVisible, setIsPlaneVisible] = React.useState(false);
|
|
107
109
|
const [isFrameVisible, setIsFrameVisible] = React.useState(true);
|
|
@@ -188,22 +190,30 @@ const ConfiguratorProvider = _ref => {
|
|
|
188
190
|
material: "infill_material",
|
|
189
191
|
depth: 20
|
|
190
192
|
});
|
|
193
|
+
const defaultOptions = ["D_PRF_COLOR", "D_FR_SRF_DECOR", "D_FR_SRF_DECOR_S2"];
|
|
194
|
+
function getFirstValidValue(values, isValid) {
|
|
195
|
+
for (const val of values) {
|
|
196
|
+
if (isValid(val)) return val;
|
|
197
|
+
}
|
|
198
|
+
return "";
|
|
199
|
+
}
|
|
200
|
+
const hasValue = val => val !== null && val !== undefined && val !== "";
|
|
191
201
|
const [frameType, setFrameType] = React.useState("AF20_40");
|
|
192
202
|
const [bodyType, setBodyType] = React.useState("40");
|
|
193
203
|
const [exteriorFanlightType, setExteriorFanlightType] = React.useState("WPFL");
|
|
194
|
-
const [testDoorMaterial, setTestDoorMaterial] = React.useState("
|
|
195
|
-
const [testFrameMaterial, setTestFrameMaterial] = React.useState(
|
|
196
|
-
const [testGasketMaterial, setTestGasketMaterial] = React.useState("
|
|
197
|
-
const [testInteriorFanlightMaterial, setTestInteriorFanlightMaterial] = React.useState("
|
|
198
|
-
const [testExteriorFanlightMaterial, setTestExteriorFanlightMaterial] = React.useState("
|
|
199
|
-
const [testOcculusInfillMaterial, setTestOcculusInfillMaterial] = React.useState("
|
|
200
|
-
const [testGlassInfillMaterial, setTestGlassInfillMaterial] = React.useState("
|
|
201
|
-
const [testDoorStopMaterial, setTestDoorStopMaterial] = React.useState(
|
|
202
|
-
const [testHingeMaterial, setTestHingeMaterial] = React.useState("
|
|
203
|
-
const [testFrontCoverPanelMaterial, setTestFrontCoverPanelMaterial] = React.useState(
|
|
204
|
-
const [testBackCoverPanelMaterial, setTestBackCoverPanelMaterial] = React.useState(
|
|
205
|
-
const [testFrontDoorPlaneMaterial, setTestFrontDoorPlaneMaterial] = React.useState("
|
|
206
|
-
const [testBackDoorPlaneMaterial, setTestBackDoorPlaneMaterial] = React.useState("
|
|
204
|
+
const [testDoorMaterial, setTestDoorMaterial] = React.useState("");
|
|
205
|
+
const [testFrameMaterial, setTestFrameMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
206
|
+
const [testGasketMaterial, setTestGasketMaterial] = React.useState("D_GASKET");
|
|
207
|
+
const [testInteriorFanlightMaterial, setTestInteriorFanlightMaterial] = React.useState("D_SRF_DECOR");
|
|
208
|
+
const [testExteriorFanlightMaterial, setTestExteriorFanlightMaterial] = React.useState("");
|
|
209
|
+
const [testOcculusInfillMaterial, setTestOcculusInfillMaterial] = React.useState("");
|
|
210
|
+
const [testGlassInfillMaterial, setTestGlassInfillMaterial] = React.useState("D_FR_COLOR");
|
|
211
|
+
const [testDoorStopMaterial, setTestDoorStopMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
212
|
+
const [testHingeMaterial, setTestHingeMaterial] = React.useState("");
|
|
213
|
+
const [testFrontCoverPanelMaterial, setTestFrontCoverPanelMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
214
|
+
const [testBackCoverPanelMaterial, setTestBackCoverPanelMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
215
|
+
const [testFrontDoorPlaneMaterial, setTestFrontDoorPlaneMaterial] = React.useState("D_SRF_DECOR_2");
|
|
216
|
+
const [testBackDoorPlaneMaterial, setTestBackDoorPlaneMaterial] = React.useState("D_SRF_DECOR");
|
|
207
217
|
const doorHeight = 0;
|
|
208
218
|
const [newPivotPosition, setNewPivotPosition] = React.useState(0);
|
|
209
219
|
const [parseMessage, setParseMessage] = React.useState({
|
|
@@ -213,6 +223,11 @@ const ConfiguratorProvider = _ref => {
|
|
|
213
223
|
React.useEffect(() => {
|
|
214
224
|
setIs2D(initialIs2D);
|
|
215
225
|
}, [initialIs2D]);
|
|
226
|
+
React.useEffect(() => {
|
|
227
|
+
if (initialMaterials) {
|
|
228
|
+
setMaterials(initialMaterials);
|
|
229
|
+
}
|
|
230
|
+
}, [initialMaterials]);
|
|
216
231
|
const handleParseCpid = React.useCallback(cpidToParse => {
|
|
217
232
|
const showMessage = function (text) {
|
|
218
233
|
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "error";
|
|
@@ -675,6 +690,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
675
690
|
}, [totalWidth, doorFrame.sidesThk, isDoubleDoor]);
|
|
676
691
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorContext.Provider, {
|
|
677
692
|
value: {
|
|
693
|
+
materials,
|
|
678
694
|
is2D,
|
|
679
695
|
setIs2D,
|
|
680
696
|
isPlaneVisible,
|
|
@@ -761,20 +777,79 @@ const useConfigurator = () => {
|
|
|
761
777
|
return context;
|
|
762
778
|
};
|
|
763
779
|
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
780
|
+
const isUrl = string => {
|
|
781
|
+
try {
|
|
782
|
+
new URL(string);
|
|
783
|
+
return true;
|
|
784
|
+
} catch (_) {
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
const createMaterialFromProp = value => {
|
|
789
|
+
if (!value) return null;
|
|
790
|
+
if (value.startsWith("#")) {
|
|
791
|
+
return new THREE__namespace.MeshStandardMaterial({
|
|
792
|
+
color: value,
|
|
793
|
+
roughness: 0.8
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
if (isUrl(value)) {
|
|
797
|
+
const texture = textureLoader.load(value);
|
|
798
|
+
texture.wrapS = THREE__namespace.RepeatWrapping;
|
|
799
|
+
texture.wrapT = THREE__namespace.RepeatWrapping;
|
|
800
|
+
return new THREE__namespace.MeshStandardMaterial({
|
|
801
|
+
map: texture,
|
|
802
|
+
roughness: 0.8
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
return null;
|
|
806
|
+
};
|
|
807
|
+
const textureLoader = new THREE__namespace.TextureLoader();
|
|
808
|
+
const bodyInt = textureLoader.load("http://192.168.30.92:3009/api/proxy?path=IVIS/E_TEX00.JPG");
|
|
809
|
+
const bodyExt = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
810
|
+
const frameAlu = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
811
|
+
const frameWoodenInt = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
812
|
+
textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
813
|
+
const wdg = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
814
|
+
const gasket = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
815
|
+
bodyInt.wrapS = THREE__namespace.RepeatWrapping;
|
|
816
|
+
bodyInt.wrapT = THREE__namespace.RepeatWrapping;
|
|
817
|
+
bodyExt.wrapS = THREE__namespace.RepeatWrapping;
|
|
818
|
+
bodyExt.wrapT = THREE__namespace.RepeatWrapping;
|
|
772
819
|
const availableMaterials = {
|
|
820
|
+
D_SRF_DECOR_2: new THREE__namespace.MeshStandardMaterial({
|
|
821
|
+
map: bodyInt,
|
|
822
|
+
roughness: 0.8
|
|
823
|
+
}),
|
|
824
|
+
D_SRF_DECOR: new THREE__namespace.MeshStandardMaterial({
|
|
825
|
+
map: bodyExt,
|
|
826
|
+
roughness: 0.8
|
|
827
|
+
}),
|
|
828
|
+
D_PRF_COLOR: new THREE__namespace.MeshStandardMaterial({
|
|
829
|
+
map: frameAlu,
|
|
830
|
+
roughness: 0.8
|
|
831
|
+
}),
|
|
832
|
+
D_FR_SRF_DECOR: new THREE__namespace.MeshStandardMaterial({
|
|
833
|
+
map: frameWoodenInt,
|
|
834
|
+
roughness: 0.8
|
|
835
|
+
}),
|
|
836
|
+
D_FR_SRF_DECOR_S2: new THREE__namespace.MeshStandardMaterial({
|
|
837
|
+
map: frameWoodenInt,
|
|
838
|
+
roughness: 0.8
|
|
839
|
+
}),
|
|
840
|
+
D_FR_COLOR: new THREE__namespace.MeshStandardMaterial({
|
|
841
|
+
map: wdg,
|
|
842
|
+
roughness: 0.8
|
|
843
|
+
}),
|
|
844
|
+
D_GASKET: new THREE__namespace.MeshStandardMaterial({
|
|
845
|
+
map: gasket,
|
|
846
|
+
roughness: 0.8
|
|
847
|
+
}),
|
|
773
848
|
black: new THREE__namespace.MeshStandardMaterial({
|
|
774
849
|
color: "#000000"
|
|
775
850
|
}),
|
|
776
851
|
metal: new THREE__namespace.MeshStandardMaterial({
|
|
777
|
-
color: "#
|
|
852
|
+
color: "#aaaaaa",
|
|
778
853
|
metalness: 1.0,
|
|
779
854
|
roughness: 0.4
|
|
780
855
|
}),
|
|
@@ -840,8 +915,15 @@ const availableMaterials = {
|
|
|
840
915
|
roughness: 0.1
|
|
841
916
|
})
|
|
842
917
|
};
|
|
918
|
+
const placeholderMaterial = new THREE__namespace.MeshStandardMaterial({
|
|
919
|
+
color: "#cccccc",
|
|
920
|
+
roughness: 0.8
|
|
921
|
+
});
|
|
922
|
+
const placeholderMaterialforFrames = new THREE__namespace.MeshStandardMaterial({
|
|
923
|
+
color: "#000",
|
|
924
|
+
roughness: 0.8
|
|
925
|
+
});
|
|
843
926
|
|
|
844
|
-
// Custom hook for door handle calculations
|
|
845
927
|
function StandardHandle(_ref) {
|
|
846
928
|
let {
|
|
847
929
|
position,
|
|
@@ -1343,7 +1425,8 @@ function DoorModels(_ref7) {
|
|
|
1343
1425
|
glassDepth,
|
|
1344
1426
|
cpid,
|
|
1345
1427
|
handleParseCpid,
|
|
1346
|
-
isDoubleDoor
|
|
1428
|
+
isDoubleDoor,
|
|
1429
|
+
materials
|
|
1347
1430
|
} = useConfigurator();
|
|
1348
1431
|
React.useEffect(() => {
|
|
1349
1432
|
if (doorName) {
|
|
@@ -1385,29 +1468,38 @@ function DoorModels(_ref7) {
|
|
|
1385
1468
|
const {
|
|
1386
1469
|
material: backDoorPlaneMaterialName
|
|
1387
1470
|
} = backDoorPlane;
|
|
1388
|
-
|
|
1471
|
+
const pers = React.useMemo(() => {
|
|
1472
|
+
const dynamicMaterials = {};
|
|
1473
|
+
for (const key in materials) {
|
|
1474
|
+
if (Object.prototype.hasOwnProperty.call(materials, key)) {
|
|
1475
|
+
const value = materials[key];
|
|
1476
|
+
dynamicMaterials[key] = createMaterialFromProp(value);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
return dynamicMaterials;
|
|
1480
|
+
}, [materials]);
|
|
1389
1481
|
// --- Material Logic ---
|
|
1390
1482
|
React.useMemo(() => availableMaterials[testDoorMaterial] || availableMaterials[doorMaterialName] || placeholderMaterial, [testDoorMaterial, doorMaterialName]);
|
|
1391
|
-
const frameMaterial = React.useMemo(() => availableMaterials[testFrameMaterial] || availableMaterials[frameMaterialName] || placeholderMaterialforFrames, [testFrameMaterial, frameMaterialName]);
|
|
1392
|
-
const gasketMaterial = React.useMemo(() => availableMaterials[testGasketMaterial] || availableMaterials[gasketMaterialName] || new THREE__namespace.MeshStandardMaterial({
|
|
1483
|
+
const frameMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || availableMaterials[testFrameMaterial] || availableMaterials[frameMaterialName] || placeholderMaterialforFrames, [testFrameMaterial, frameMaterialName]);
|
|
1484
|
+
const gasketMaterial = React.useMemo(() => pers.D_GASKET || availableMaterials[testGasketMaterial] || availableMaterials[gasketMaterialName] || new THREE__namespace.MeshStandardMaterial({
|
|
1393
1485
|
color: "#111111"
|
|
1394
1486
|
}), [testGasketMaterial, gasketMaterialName]);
|
|
1395
1487
|
const doorStopMaterial = React.useMemo(() => {
|
|
1396
|
-
return availableMaterials[testDoorStopMaterial] || availableMaterials[doorStopMaterialName || ""] || frameMaterial;
|
|
1488
|
+
return pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || availableMaterials[testDoorStopMaterial] || availableMaterials[doorStopMaterialName || ""] || frameMaterial;
|
|
1397
1489
|
}, [testDoorStopMaterial, doorStopMaterialName, frameType, frameMaterial]);
|
|
1398
|
-
const interiorFanlightMaterial = React.useMemo(() => availableMaterials[testInteriorFanlightMaterial] || availableMaterials[interiorFanlightMaterialName] || placeholderMaterial, [testInteriorFanlightMaterial, interiorFanlightMaterialName]);
|
|
1490
|
+
const interiorFanlightMaterial = React.useMemo(() => pers.D_SRF_DECOR_2 || availableMaterials[testInteriorFanlightMaterial] || availableMaterials[interiorFanlightMaterialName] || placeholderMaterial, [testInteriorFanlightMaterial, interiorFanlightMaterialName]);
|
|
1399
1491
|
const exteriorFanlightMaterial = React.useMemo(() => availableMaterials[testExteriorFanlightMaterial] || availableMaterials[exteriorFanlightMaterialName] || placeholderMaterial, [testExteriorFanlightMaterial, exteriorFanlightMaterialName]);
|
|
1400
1492
|
React.useMemo(() => availableMaterials[testOcculusInfillMaterial] || availableMaterials[occulusInfillMaterialName] || placeholderMaterial, [testOcculusInfillMaterial, occulusInfillMaterialName]);
|
|
1401
|
-
const glassInfillMaterial = React.useMemo(() => availableMaterials[testGlassInfillMaterial] || availableMaterials[glassInfillMaterialName] || placeholderMaterial, [testGlassInfillMaterial, glassInfillMaterialName]);
|
|
1493
|
+
const glassInfillMaterial = React.useMemo(() => pers.D_FR_COLOR || availableMaterials[testGlassInfillMaterial] || availableMaterials[glassInfillMaterialName] || placeholderMaterial, [testGlassInfillMaterial, glassInfillMaterialName]);
|
|
1402
1494
|
React.useMemo(() => availableMaterials[testHingeMaterial] || availableMaterials[hingeMaterialName] || new THREE__namespace.MeshStandardMaterial({
|
|
1403
1495
|
color: "#d4d4d4",
|
|
1404
1496
|
metalness: 1.0,
|
|
1405
1497
|
roughness: 0.4
|
|
1406
1498
|
}), [testHingeMaterial, hingeMaterialName]);
|
|
1407
|
-
const frontCoverPanelMaterial = React.useMemo(() => availableMaterials[testFrontCoverPanelMaterial] || availableMaterials[frontCoverPanelMaterialName] || placeholderMaterial, [testFrontCoverPanelMaterial, frontCoverPanelMaterialName]);
|
|
1408
|
-
const backCoverPanelMaterial = React.useMemo(() => availableMaterials[testBackCoverPanelMaterial] || availableMaterials[backCoverPanelMaterialName] || placeholderMaterial, [testBackCoverPanelMaterial, backCoverPanelMaterialName]);
|
|
1409
|
-
React.useMemo(() => availableMaterials[testFrontDoorPlaneMaterial] || availableMaterials[frontDoorPlaneMaterialName] || placeholderMaterial, [testFrontDoorPlaneMaterial, frontDoorPlaneMaterialName]);
|
|
1410
|
-
React.useMemo(() => availableMaterials[testBackDoorPlaneMaterial] || availableMaterials[backDoorPlaneMaterialName] || placeholderMaterial, [testBackDoorPlaneMaterial, backDoorPlaneMaterialName]);
|
|
1499
|
+
const frontCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || availableMaterials[testFrontCoverPanelMaterial] || availableMaterials[frontCoverPanelMaterialName] || placeholderMaterial, [testFrontCoverPanelMaterial, frontCoverPanelMaterialName]);
|
|
1500
|
+
const backCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || availableMaterials[testBackCoverPanelMaterial] || availableMaterials[backCoverPanelMaterialName] || placeholderMaterial, [testBackCoverPanelMaterial, backCoverPanelMaterialName]);
|
|
1501
|
+
React.useMemo(() => pers.D_SRF_DECOR_2 || availableMaterials[testFrontDoorPlaneMaterial] || availableMaterials[frontDoorPlaneMaterialName] || placeholderMaterial, [testFrontDoorPlaneMaterial, frontDoorPlaneMaterialName]);
|
|
1502
|
+
React.useMemo(() => pers.D_SRF_DECOR || availableMaterials[testBackDoorPlaneMaterial] || availableMaterials[backDoorPlaneMaterialName] || placeholderMaterial, [testBackDoorPlaneMaterial, backDoorPlaneMaterialName]);
|
|
1411
1503
|
React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
1412
1504
|
color: "#1a1a1a",
|
|
1413
1505
|
roughness: 0.1
|
|
@@ -1438,11 +1530,6 @@ function DoorModels(_ref7) {
|
|
|
1438
1530
|
secondDoorStopOffset
|
|
1439
1531
|
} = doorFrame;
|
|
1440
1532
|
const initialDoorHeight = React.useRef(doorHeight);
|
|
1441
|
-
|
|
1442
|
-
// useEffect(() => {
|
|
1443
|
-
// initialDoorHeight.current = doorHeight;
|
|
1444
|
-
// }, [cpid]);
|
|
1445
|
-
|
|
1446
1533
|
const {
|
|
1447
1534
|
height: interiorFanlightHeightValue
|
|
1448
1535
|
} = interiorFanlight;
|
|
@@ -2059,16 +2146,15 @@ function DoorLeaf(_ref8) {
|
|
|
2059
2146
|
secondDoorStopOffset
|
|
2060
2147
|
} = doorFrame;
|
|
2061
2148
|
const initialDoorHeight = React.useRef(null);
|
|
2062
|
-
|
|
2063
|
-
// useEffect(() => {
|
|
2064
|
-
// initialDoorHeight.current = doorHeight;
|
|
2065
|
-
// }, [cpid]);
|
|
2066
|
-
|
|
2149
|
+
const initialDoorWidth = React.useRef(null);
|
|
2067
2150
|
React.useEffect(() => {
|
|
2068
2151
|
if (doorHeight > 0 && initialDoorHeight.current === null) {
|
|
2069
2152
|
initialDoorHeight.current = doorHeight;
|
|
2070
2153
|
}
|
|
2071
|
-
|
|
2154
|
+
if (doorWidth > 0 && initialDoorWidth.current === null) {
|
|
2155
|
+
initialDoorWidth.current = doorWidth;
|
|
2156
|
+
}
|
|
2157
|
+
}, [doorHeight, doorWidth]);
|
|
2072
2158
|
const {
|
|
2073
2159
|
height: interiorFanlightHeightValue
|
|
2074
2160
|
} = interiorFanlight;
|
|
@@ -2214,6 +2300,39 @@ function DoorLeaf(_ref8) {
|
|
|
2214
2300
|
}
|
|
2215
2301
|
return true;
|
|
2216
2302
|
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
2303
|
+
|
|
2304
|
+
// --- DYNAMIC TEXTURE MATERIALS ---
|
|
2305
|
+
const dynamicFrontDoorPlaneMaterial = React.useMemo(() => {
|
|
2306
|
+
const newMaterial = frontDoorPlaneMaterial.clone();
|
|
2307
|
+
if (newMaterial.map) {
|
|
2308
|
+
newMaterial.map = newMaterial.map.clone();
|
|
2309
|
+
newMaterial.map.needsUpdate = true;
|
|
2310
|
+
newMaterial.map.wrapS = THREE__namespace.RepeatWrapping;
|
|
2311
|
+
newMaterial.map.wrapT = THREE__namespace.RepeatWrapping;
|
|
2312
|
+
const initialHeightM = initialDoorHeight.current ? initialDoorHeight.current / 1000 : mainDoorHeightM;
|
|
2313
|
+
const initialWidthM = initialDoorWidth.current ? initialDoorWidth.current / 1000 : doorWidthM;
|
|
2314
|
+
const repeatY = initialHeightM > 0 ? mainDoorHeightM / initialHeightM : 1;
|
|
2315
|
+
const repeatX = initialWidthM > 0 ? doorWidthM / initialWidthM : 1;
|
|
2316
|
+
newMaterial.map.repeat.set(repeatX, repeatY * 2);
|
|
2317
|
+
console.log(repeatX, repeatY);
|
|
2318
|
+
}
|
|
2319
|
+
return newMaterial;
|
|
2320
|
+
}, [frontDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2321
|
+
const dynamicBackDoorPlaneMaterial = React.useMemo(() => {
|
|
2322
|
+
const newMaterial = backDoorPlaneMaterial.clone();
|
|
2323
|
+
if (newMaterial.map) {
|
|
2324
|
+
newMaterial.map = newMaterial.map.clone();
|
|
2325
|
+
newMaterial.map.needsUpdate = true;
|
|
2326
|
+
newMaterial.map.wrapS = THREE__namespace.RepeatWrapping;
|
|
2327
|
+
newMaterial.map.wrapT = THREE__namespace.RepeatWrapping;
|
|
2328
|
+
const initialHeightM = initialDoorHeight.current ? initialDoorHeight.current / 1000 : mainDoorHeightM;
|
|
2329
|
+
const initialWidthM = initialDoorWidth.current ? initialDoorWidth.current / 1000 : doorWidthM;
|
|
2330
|
+
const repeatY = initialHeightM > 0 ? mainDoorHeightM / initialHeightM : 1;
|
|
2331
|
+
const repeatX = initialWidthM > 0 ? doorWidthM / initialWidthM : 1;
|
|
2332
|
+
newMaterial.map.repeat.set(repeatX, repeatY * 2);
|
|
2333
|
+
}
|
|
2334
|
+
return newMaterial;
|
|
2335
|
+
}, [backDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2217
2336
|
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2218
2337
|
"position-x": xOffset,
|
|
2219
2338
|
children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
@@ -2342,7 +2461,7 @@ function DoorLeaf(_ref8) {
|
|
|
2342
2461
|
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
2343
2462
|
useGroups: true,
|
|
2344
2463
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
2345
|
-
material:
|
|
2464
|
+
material: dynamicFrontDoorPlaneMaterial,
|
|
2346
2465
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2347
2466
|
args: [doorWidthM, mainDoorHeightM, 0.001]
|
|
2348
2467
|
})
|
|
@@ -2359,7 +2478,7 @@ function DoorLeaf(_ref8) {
|
|
|
2359
2478
|
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
2360
2479
|
useGroups: true,
|
|
2361
2480
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
2362
|
-
material:
|
|
2481
|
+
material: dynamicBackDoorPlaneMaterial,
|
|
2363
2482
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2364
2483
|
args: [doorWidthM, mainDoorHeightM, 0.0001]
|
|
2365
2484
|
})
|
|
@@ -2392,11 +2511,12 @@ function DoorLeaf(_ref8) {
|
|
|
2392
2511
|
const DoorConfigurator = _ref => {
|
|
2393
2512
|
let {
|
|
2394
2513
|
doorName,
|
|
2395
|
-
|
|
2396
|
-
|
|
2514
|
+
is2D = false,
|
|
2515
|
+
materials
|
|
2397
2516
|
} = _ref;
|
|
2398
2517
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
|
|
2399
2518
|
initialIs2D: is2D,
|
|
2519
|
+
initialMaterials: materials,
|
|
2400
2520
|
children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
|
|
2401
2521
|
doorName: doorName
|
|
2402
2522
|
})
|