door_models 5.2.0 → 5.2.1
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 +112 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +112 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -188,22 +188,32 @@ const ConfiguratorProvider = _ref => {
|
|
|
188
188
|
material: "infill_material",
|
|
189
189
|
depth: 20
|
|
190
190
|
});
|
|
191
|
+
const defaultOptions = ["D_PRF_COLOR", "D_FR_SRF_DECOR", "D_FR_SRF_DECOR_S2"];
|
|
192
|
+
|
|
193
|
+
// Function to pick the first valid value
|
|
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({
|
|
@@ -761,20 +771,52 @@ const useConfigurator = () => {
|
|
|
761
771
|
return context;
|
|
762
772
|
};
|
|
763
773
|
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
774
|
+
const textureLoader = new THREE__namespace.TextureLoader();
|
|
775
|
+
const bodyInt = textureLoader.load("https://backend.tecnibo.com/api/plan2dimage?versionId=2cbb5eef-2f38-46ce-9e9f-6297753bde61&file=2cbb5eef-2f38-46ce-9e9f-6297753bde61-1759389624942.png");
|
|
776
|
+
const bodyExt = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
777
|
+
const frameAlu = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
778
|
+
const frameWoodenInt = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
779
|
+
textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
780
|
+
const wdg = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
781
|
+
const gasket = textureLoader.load("https://threejs.org/examples/textures/brick_diffuse.jpg");
|
|
782
|
+
bodyInt.wrapS = THREE__namespace.RepeatWrapping;
|
|
783
|
+
bodyInt.wrapT = THREE__namespace.RepeatWrapping;
|
|
784
|
+
bodyExt.wrapS = THREE__namespace.RepeatWrapping;
|
|
785
|
+
bodyExt.wrapT = THREE__namespace.RepeatWrapping;
|
|
772
786
|
const availableMaterials = {
|
|
787
|
+
D_SRF_DECOR_2: new THREE__namespace.MeshStandardMaterial({
|
|
788
|
+
map: bodyInt,
|
|
789
|
+
roughness: 0.8
|
|
790
|
+
}),
|
|
791
|
+
D_SRF_DECOR: new THREE__namespace.MeshStandardMaterial({
|
|
792
|
+
map: bodyExt,
|
|
793
|
+
roughness: 0.8
|
|
794
|
+
}),
|
|
795
|
+
D_PRF_COLOR: new THREE__namespace.MeshStandardMaterial({
|
|
796
|
+
map: frameAlu,
|
|
797
|
+
roughness: 0.8
|
|
798
|
+
}),
|
|
799
|
+
D_FR_SRF_DECOR: new THREE__namespace.MeshStandardMaterial({
|
|
800
|
+
map: frameWoodenInt,
|
|
801
|
+
roughness: 0.8
|
|
802
|
+
}),
|
|
803
|
+
D_FR_SRF_DECOR_S2: new THREE__namespace.MeshStandardMaterial({
|
|
804
|
+
map: frameWoodenInt,
|
|
805
|
+
roughness: 0.8
|
|
806
|
+
}),
|
|
807
|
+
D_FR_COLOR: new THREE__namespace.MeshStandardMaterial({
|
|
808
|
+
map: wdg,
|
|
809
|
+
roughness: 0.8
|
|
810
|
+
}),
|
|
811
|
+
D_GASKET: new THREE__namespace.MeshStandardMaterial({
|
|
812
|
+
map: gasket,
|
|
813
|
+
roughness: 0.8
|
|
814
|
+
}),
|
|
773
815
|
black: new THREE__namespace.MeshStandardMaterial({
|
|
774
816
|
color: "#000000"
|
|
775
817
|
}),
|
|
776
818
|
metal: new THREE__namespace.MeshStandardMaterial({
|
|
777
|
-
color: "#
|
|
819
|
+
color: "#aaaaaa",
|
|
778
820
|
metalness: 1.0,
|
|
779
821
|
roughness: 0.4
|
|
780
822
|
}),
|
|
@@ -840,8 +882,15 @@ const availableMaterials = {
|
|
|
840
882
|
roughness: 0.1
|
|
841
883
|
})
|
|
842
884
|
};
|
|
885
|
+
const placeholderMaterial = new THREE__namespace.MeshStandardMaterial({
|
|
886
|
+
color: "#cccccc",
|
|
887
|
+
roughness: 0.8
|
|
888
|
+
});
|
|
889
|
+
const placeholderMaterialforFrames = new THREE__namespace.MeshStandardMaterial({
|
|
890
|
+
color: "#000",
|
|
891
|
+
roughness: 0.8
|
|
892
|
+
});
|
|
843
893
|
|
|
844
|
-
// Custom hook for door handle calculations
|
|
845
894
|
function StandardHandle(_ref) {
|
|
846
895
|
let {
|
|
847
896
|
position,
|
|
@@ -1438,11 +1487,6 @@ function DoorModels(_ref7) {
|
|
|
1438
1487
|
secondDoorStopOffset
|
|
1439
1488
|
} = doorFrame;
|
|
1440
1489
|
const initialDoorHeight = React.useRef(doorHeight);
|
|
1441
|
-
|
|
1442
|
-
// useEffect(() => {
|
|
1443
|
-
// initialDoorHeight.current = doorHeight;
|
|
1444
|
-
// }, [cpid]);
|
|
1445
|
-
|
|
1446
1490
|
const {
|
|
1447
1491
|
height: interiorFanlightHeightValue
|
|
1448
1492
|
} = interiorFanlight;
|
|
@@ -2059,16 +2103,15 @@ function DoorLeaf(_ref8) {
|
|
|
2059
2103
|
secondDoorStopOffset
|
|
2060
2104
|
} = doorFrame;
|
|
2061
2105
|
const initialDoorHeight = React.useRef(null);
|
|
2062
|
-
|
|
2063
|
-
// useEffect(() => {
|
|
2064
|
-
// initialDoorHeight.current = doorHeight;
|
|
2065
|
-
// }, [cpid]);
|
|
2066
|
-
|
|
2106
|
+
const initialDoorWidth = React.useRef(null);
|
|
2067
2107
|
React.useEffect(() => {
|
|
2068
2108
|
if (doorHeight > 0 && initialDoorHeight.current === null) {
|
|
2069
2109
|
initialDoorHeight.current = doorHeight;
|
|
2070
2110
|
}
|
|
2071
|
-
|
|
2111
|
+
if (doorWidth > 0 && initialDoorWidth.current === null) {
|
|
2112
|
+
initialDoorWidth.current = doorWidth;
|
|
2113
|
+
}
|
|
2114
|
+
}, [doorHeight, doorWidth]);
|
|
2072
2115
|
const {
|
|
2073
2116
|
height: interiorFanlightHeightValue
|
|
2074
2117
|
} = interiorFanlight;
|
|
@@ -2214,6 +2257,39 @@ function DoorLeaf(_ref8) {
|
|
|
2214
2257
|
}
|
|
2215
2258
|
return true;
|
|
2216
2259
|
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
2260
|
+
|
|
2261
|
+
// --- DYNAMIC TEXTURE MATERIALS ---
|
|
2262
|
+
const dynamicFrontDoorPlaneMaterial = React.useMemo(() => {
|
|
2263
|
+
const newMaterial = frontDoorPlaneMaterial.clone();
|
|
2264
|
+
if (newMaterial.map) {
|
|
2265
|
+
newMaterial.map = newMaterial.map.clone();
|
|
2266
|
+
newMaterial.map.needsUpdate = true;
|
|
2267
|
+
newMaterial.map.wrapS = THREE__namespace.RepeatWrapping;
|
|
2268
|
+
newMaterial.map.wrapT = THREE__namespace.RepeatWrapping;
|
|
2269
|
+
const initialHeightM = initialDoorHeight.current ? initialDoorHeight.current / 1000 : mainDoorHeightM;
|
|
2270
|
+
const initialWidthM = initialDoorWidth.current ? initialDoorWidth.current / 1000 : doorWidthM;
|
|
2271
|
+
const repeatY = initialHeightM > 0 ? mainDoorHeightM / initialHeightM : 1;
|
|
2272
|
+
const repeatX = initialWidthM > 0 ? doorWidthM / initialWidthM : 1;
|
|
2273
|
+
newMaterial.map.repeat.set(repeatX, repeatY * 2);
|
|
2274
|
+
console.log(repeatX, repeatY);
|
|
2275
|
+
}
|
|
2276
|
+
return newMaterial;
|
|
2277
|
+
}, [frontDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2278
|
+
const dynamicBackDoorPlaneMaterial = React.useMemo(() => {
|
|
2279
|
+
const newMaterial = backDoorPlaneMaterial.clone();
|
|
2280
|
+
if (newMaterial.map) {
|
|
2281
|
+
newMaterial.map = newMaterial.map.clone();
|
|
2282
|
+
newMaterial.map.needsUpdate = true;
|
|
2283
|
+
newMaterial.map.wrapS = THREE__namespace.RepeatWrapping;
|
|
2284
|
+
newMaterial.map.wrapT = THREE__namespace.RepeatWrapping;
|
|
2285
|
+
const initialHeightM = initialDoorHeight.current ? initialDoorHeight.current / 1000 : mainDoorHeightM;
|
|
2286
|
+
const initialWidthM = initialDoorWidth.current ? initialDoorWidth.current / 1000 : doorWidthM;
|
|
2287
|
+
const repeatY = initialHeightM > 0 ? mainDoorHeightM / initialHeightM : 1;
|
|
2288
|
+
const repeatX = initialWidthM > 0 ? doorWidthM / initialWidthM : 1;
|
|
2289
|
+
newMaterial.map.repeat.set(repeatX, repeatY * 2);
|
|
2290
|
+
}
|
|
2291
|
+
return newMaterial;
|
|
2292
|
+
}, [backDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2217
2293
|
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2218
2294
|
"position-x": xOffset,
|
|
2219
2295
|
children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
@@ -2342,7 +2418,7 @@ function DoorLeaf(_ref8) {
|
|
|
2342
2418
|
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
2343
2419
|
useGroups: true,
|
|
2344
2420
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
2345
|
-
material:
|
|
2421
|
+
material: dynamicFrontDoorPlaneMaterial,
|
|
2346
2422
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2347
2423
|
args: [doorWidthM, mainDoorHeightM, 0.001]
|
|
2348
2424
|
})
|
|
@@ -2359,7 +2435,7 @@ function DoorLeaf(_ref8) {
|
|
|
2359
2435
|
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
2360
2436
|
useGroups: true,
|
|
2361
2437
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
2362
|
-
material:
|
|
2438
|
+
material: dynamicBackDoorPlaneMaterial,
|
|
2363
2439
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2364
2440
|
args: [doorWidthM, mainDoorHeightM, 0.0001]
|
|
2365
2441
|
})
|