door_models 5.2.2 → 5.2.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.
- package/dist/index.cjs.js +53 -124
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +53 -124
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -777,6 +777,10 @@ const useConfigurator = () => {
|
|
|
777
777
|
return context;
|
|
778
778
|
};
|
|
779
779
|
|
|
780
|
+
// Keep the textureLoader instance
|
|
781
|
+
const textureLoader = new THREE__namespace.TextureLoader();
|
|
782
|
+
|
|
783
|
+
// This is your new core logic. It's self-contained.
|
|
780
784
|
const isUrl = string => {
|
|
781
785
|
try {
|
|
782
786
|
new URL(string);
|
|
@@ -787,12 +791,16 @@ const isUrl = string => {
|
|
|
787
791
|
};
|
|
788
792
|
const createMaterialFromProp = value => {
|
|
789
793
|
if (!value) return null;
|
|
794
|
+
|
|
795
|
+
// Handle HEX colors
|
|
790
796
|
if (value.startsWith("#")) {
|
|
791
797
|
return new THREE__namespace.MeshStandardMaterial({
|
|
792
798
|
color: value,
|
|
793
799
|
roughness: 0.8
|
|
794
800
|
});
|
|
795
801
|
}
|
|
802
|
+
|
|
803
|
+
// Handle URLs
|
|
796
804
|
if (isUrl(value)) {
|
|
797
805
|
const texture = textureLoader.load(value);
|
|
798
806
|
texture.wrapS = THREE__namespace.RepeatWrapping;
|
|
@@ -802,78 +810,30 @@ const createMaterialFromProp = value => {
|
|
|
802
810
|
roughness: 0.8
|
|
803
811
|
});
|
|
804
812
|
}
|
|
813
|
+
|
|
814
|
+
// It's good practice to return null if the format is not recognized.
|
|
805
815
|
return null;
|
|
806
816
|
};
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
817
|
+
|
|
818
|
+
// --- REMOVED THE ENTIRE `availableMaterials` OBJECT ---
|
|
819
|
+
// It is no longer needed.
|
|
820
|
+
|
|
821
|
+
// Keep placeholder materials as a fallback if a material prop isn't provided
|
|
822
|
+
const placeholderMaterial = new THREE__namespace.MeshStandardMaterial({
|
|
823
|
+
color: "#cccccc",
|
|
824
|
+
// A neutral grey
|
|
825
|
+
roughness: 0.8
|
|
826
|
+
});
|
|
827
|
+
const placeholderMaterialforFrames = new THREE__namespace.MeshStandardMaterial({
|
|
828
|
+
color: "#555555",
|
|
829
|
+
// A darker grey for frames
|
|
830
|
+
roughness: 0.8
|
|
831
|
+
});
|
|
832
|
+
|
|
819
833
|
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
|
-
}),
|
|
848
834
|
black: new THREE__namespace.MeshStandardMaterial({
|
|
849
835
|
color: "#000000"
|
|
850
836
|
}),
|
|
851
|
-
metal: new THREE__namespace.MeshStandardMaterial({
|
|
852
|
-
color: "#aaaaaa",
|
|
853
|
-
metalness: 1.0,
|
|
854
|
-
roughness: 0.4
|
|
855
|
-
}),
|
|
856
|
-
darkgrey: new THREE__namespace.MeshStandardMaterial({
|
|
857
|
-
color: "#5e5e5e"
|
|
858
|
-
}),
|
|
859
|
-
grey: new THREE__namespace.MeshStandardMaterial({
|
|
860
|
-
color: "#cccccc"
|
|
861
|
-
}),
|
|
862
|
-
yellow: new THREE__namespace.MeshStandardMaterial({
|
|
863
|
-
color: "#ffff00"
|
|
864
|
-
}),
|
|
865
|
-
darkBrown: new THREE__namespace.MeshStandardMaterial({
|
|
866
|
-
color: "#a0522d"
|
|
867
|
-
}),
|
|
868
|
-
brown: new THREE__namespace.MeshStandardMaterial({
|
|
869
|
-
color: "#d2b48c"
|
|
870
|
-
}),
|
|
871
|
-
glass: new THREE__namespace.MeshStandardMaterial({
|
|
872
|
-
color: "#ffffff",
|
|
873
|
-
roughness: 0.1,
|
|
874
|
-
transparent: true,
|
|
875
|
-
opacity: 0.7
|
|
876
|
-
}),
|
|
877
837
|
aluminum: new THREE__namespace.MeshStandardMaterial({
|
|
878
838
|
color: "#abb0aa",
|
|
879
839
|
metalness: 0.8,
|
|
@@ -891,39 +851,10 @@ const availableMaterials = {
|
|
|
891
851
|
metalness: 0.8,
|
|
892
852
|
roughness: 0.5,
|
|
893
853
|
envMapIntensity: 1.2
|
|
894
|
-
}),
|
|
895
|
-
silver: new THREE__namespace.MeshStandardMaterial({
|
|
896
|
-
color: "#c0c0c0",
|
|
897
|
-
metalness: 1.0,
|
|
898
|
-
roughness: 0.2
|
|
899
|
-
}),
|
|
900
|
-
gold: new THREE__namespace.MeshStandardMaterial({
|
|
901
|
-
color: "#ffd700",
|
|
902
|
-
metalness: 1.0,
|
|
903
|
-
roughness: 0.3
|
|
904
|
-
}),
|
|
905
|
-
diamond: new THREE__namespace.MeshStandardMaterial({
|
|
906
|
-
color: "#e0f7fa",
|
|
907
|
-
metalness: 0.9,
|
|
908
|
-
roughness: 0.05,
|
|
909
|
-
transparent: true,
|
|
910
|
-
opacity: 0.9,
|
|
911
|
-
envMapIntensity: 1.5
|
|
912
|
-
}),
|
|
913
|
-
test_material: new THREE__namespace.MeshStandardMaterial({
|
|
914
|
-
color: "red",
|
|
915
|
-
roughness: 0.1
|
|
916
854
|
})
|
|
917
855
|
};
|
|
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
|
-
});
|
|
926
856
|
|
|
857
|
+
// Custom hook for door handle calculations
|
|
927
858
|
function StandardHandle(_ref) {
|
|
928
859
|
let {
|
|
929
860
|
position,
|
|
@@ -1479,27 +1410,25 @@ function DoorModels(_ref7) {
|
|
|
1479
1410
|
return dynamicMaterials;
|
|
1480
1411
|
}, [materials]);
|
|
1481
1412
|
// --- Material Logic ---
|
|
1482
|
-
React.useMemo(() =>
|
|
1483
|
-
const frameMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 ||
|
|
1484
|
-
const gasketMaterial = React.useMemo(() => pers.D_GASKET || availableMaterials[testGasketMaterial
|
|
1485
|
-
color: "#111111"
|
|
1486
|
-
}), [testGasketMaterial, gasketMaterialName]);
|
|
1413
|
+
React.useMemo(() => placeholderMaterial, [testDoorMaterial, doorMaterialName]);
|
|
1414
|
+
const frameMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterialforFrames, [testFrameMaterial, frameMaterialName]);
|
|
1415
|
+
const gasketMaterial = React.useMemo(() => pers.D_GASKET || availableMaterials.black, [testGasketMaterial, gasketMaterialName]);
|
|
1487
1416
|
const doorStopMaterial = React.useMemo(() => {
|
|
1488
|
-
return pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 ||
|
|
1417
|
+
return pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || frameMaterial;
|
|
1489
1418
|
}, [testDoorStopMaterial, doorStopMaterialName, frameType, frameMaterial]);
|
|
1490
|
-
const interiorFanlightMaterial = React.useMemo(() => pers.D_SRF_DECOR_2 ||
|
|
1491
|
-
const exteriorFanlightMaterial = React.useMemo(() =>
|
|
1492
|
-
React.useMemo(() =>
|
|
1493
|
-
const glassInfillMaterial = React.useMemo(() => pers.D_FR_COLOR ||
|
|
1494
|
-
React.useMemo(() =>
|
|
1419
|
+
const interiorFanlightMaterial = React.useMemo(() => pers.D_SRF_DECOR_2 || placeholderMaterial, [testInteriorFanlightMaterial, interiorFanlightMaterialName]);
|
|
1420
|
+
const exteriorFanlightMaterial = React.useMemo(() => placeholderMaterial, [testExteriorFanlightMaterial, exteriorFanlightMaterialName]);
|
|
1421
|
+
React.useMemo(() => placeholderMaterial, [testOcculusInfillMaterial, occulusInfillMaterialName]);
|
|
1422
|
+
const glassInfillMaterial = React.useMemo(() => pers.D_FR_COLOR || placeholderMaterial, [testGlassInfillMaterial, glassInfillMaterialName]);
|
|
1423
|
+
React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
1495
1424
|
color: "#d4d4d4",
|
|
1496
1425
|
metalness: 1.0,
|
|
1497
1426
|
roughness: 0.4
|
|
1498
1427
|
}), [testHingeMaterial, hingeMaterialName]);
|
|
1499
|
-
const frontCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 ||
|
|
1500
|
-
const backCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 ||
|
|
1501
|
-
React.useMemo(() => pers.D_SRF_DECOR_2 ||
|
|
1502
|
-
React.useMemo(() => pers.D_SRF_DECOR ||
|
|
1428
|
+
const frontCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterial, [testFrontCoverPanelMaterial, frontCoverPanelMaterialName]);
|
|
1429
|
+
const backCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterial, [testBackCoverPanelMaterial, backCoverPanelMaterialName]);
|
|
1430
|
+
React.useMemo(() => pers.D_SRF_DECOR_2 || placeholderMaterial, [testFrontDoorPlaneMaterial, frontDoorPlaneMaterialName]);
|
|
1431
|
+
React.useMemo(() => pers.D_SRF_DECOR || placeholderMaterial, [testBackDoorPlaneMaterial, backDoorPlaneMaterialName]);
|
|
1503
1432
|
React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
1504
1433
|
color: "#1a1a1a",
|
|
1505
1434
|
roughness: 0.1
|
|
@@ -2095,27 +2024,27 @@ function DoorLeaf(_ref8) {
|
|
|
2095
2024
|
} = backDoorPlane;
|
|
2096
2025
|
|
|
2097
2026
|
// --- Material Logic ---
|
|
2098
|
-
const doorMaterial = React.useMemo(() =>
|
|
2099
|
-
const frameMaterial = React.useMemo(() =>
|
|
2100
|
-
const gasketMaterial = React.useMemo(() =>
|
|
2027
|
+
const doorMaterial = React.useMemo(() => placeholderMaterial, [testDoorMaterial, doorMaterialName]);
|
|
2028
|
+
const frameMaterial = React.useMemo(() => placeholderMaterialforFrames, [testFrameMaterial, frameMaterialName]);
|
|
2029
|
+
const gasketMaterial = React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
2101
2030
|
color: "#111111"
|
|
2102
2031
|
}), [testGasketMaterial, gasketMaterialName]);
|
|
2103
2032
|
React.useMemo(() => {
|
|
2104
|
-
return
|
|
2033
|
+
return frameMaterial;
|
|
2105
2034
|
}, [testDoorStopMaterial, doorStopMaterialName, frameType, frameMaterial]);
|
|
2106
|
-
React.useMemo(() =>
|
|
2107
|
-
React.useMemo(() =>
|
|
2108
|
-
const occulusInfillMaterial = React.useMemo(() =>
|
|
2109
|
-
const glassInfillMaterial = React.useMemo(() =>
|
|
2110
|
-
const hingeBodyMaterial = React.useMemo(() =>
|
|
2035
|
+
React.useMemo(() => placeholderMaterial, [testInteriorFanlightMaterial, interiorFanlightMaterialName]);
|
|
2036
|
+
React.useMemo(() => placeholderMaterial, [testExteriorFanlightMaterial, exteriorFanlightMaterialName]);
|
|
2037
|
+
const occulusInfillMaterial = React.useMemo(() => placeholderMaterial, [testOcculusInfillMaterial, occulusInfillMaterialName]);
|
|
2038
|
+
const glassInfillMaterial = React.useMemo(() => placeholderMaterial, [testGlassInfillMaterial, glassInfillMaterialName]);
|
|
2039
|
+
const hingeBodyMaterial = React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
2111
2040
|
color: "#d4d4d4",
|
|
2112
2041
|
metalness: 1.0,
|
|
2113
2042
|
roughness: 0.4
|
|
2114
2043
|
}), [testHingeMaterial, hingeMaterialName]);
|
|
2115
|
-
React.useMemo(() =>
|
|
2116
|
-
React.useMemo(() =>
|
|
2117
|
-
const frontDoorPlaneMaterial = React.useMemo(() =>
|
|
2118
|
-
const backDoorPlaneMaterial = React.useMemo(() =>
|
|
2044
|
+
React.useMemo(() => placeholderMaterial, [testFrontCoverPanelMaterial, frontCoverPanelMaterialName]);
|
|
2045
|
+
React.useMemo(() => placeholderMaterial, [testBackCoverPanelMaterial, backCoverPanelMaterialName]);
|
|
2046
|
+
const frontDoorPlaneMaterial = React.useMemo(() => placeholderMaterial, [testFrontDoorPlaneMaterial, frontDoorPlaneMaterialName]);
|
|
2047
|
+
const backDoorPlaneMaterial = React.useMemo(() => placeholderMaterial, [testBackDoorPlaneMaterial, backDoorPlaneMaterialName]);
|
|
2119
2048
|
const hingeAccentMaterial = React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
2120
2049
|
color: "#1a1a1a",
|
|
2121
2050
|
roughness: 0.1
|