door_models 5.4.2 → 5.4.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 CHANGED
@@ -8,7 +8,6 @@ var csg = require('@react-three/csg');
8
8
  var three = require('@react-spring/three');
9
9
  var THREE = require('three');
10
10
  var drei = require('@react-three/drei');
11
- var fiber = require('@react-three/fiber');
12
11
 
13
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
13
 
@@ -727,74 +726,61 @@ const useConfigurator = () => {
727
726
 
728
727
  const availableMaterials = {
729
728
  black: new THREE__namespace.MeshStandardMaterial({
730
- color: "#000000",
731
- side: THREE__namespace.DoubleSide
729
+ color: "#000000"
732
730
  }),
733
731
  metal: new THREE__namespace.MeshStandardMaterial({
734
732
  color: "#aaaaaa",
735
733
  metalness: 1.0,
736
- roughness: 0.4,
737
- side: THREE__namespace.DoubleSide
734
+ roughness: 0.4
738
735
  }),
739
736
  darkgrey: new THREE__namespace.MeshStandardMaterial({
740
- color: "#5e5e5e",
741
- side: THREE__namespace.DoubleSide
737
+ color: "#5e5e5e"
742
738
  }),
743
739
  grey: new THREE__namespace.MeshStandardMaterial({
744
- color: "#cccccc",
745
- side: THREE__namespace.DoubleSide
740
+ color: "#cccccc"
746
741
  }),
747
742
  yellow: new THREE__namespace.MeshStandardMaterial({
748
- color: "#ffff00",
749
- side: THREE__namespace.DoubleSide
743
+ color: "#ffff00"
750
744
  }),
751
745
  darkBrown: new THREE__namespace.MeshStandardMaterial({
752
- color: "#a0522d",
753
- side: THREE__namespace.DoubleSide
746
+ color: "#a0522d"
754
747
  }),
755
748
  brown: new THREE__namespace.MeshStandardMaterial({
756
- color: "#d2b48c",
757
- side: THREE__namespace.DoubleSide
749
+ color: "#d2b48c"
758
750
  }),
759
751
  glass: new THREE__namespace.MeshStandardMaterial({
760
752
  color: "#ffffff",
761
753
  roughness: 0.1,
762
754
  transparent: true,
763
- opacity: 0.7,
764
- side: THREE__namespace.DoubleSide
755
+ opacity: 0.7
765
756
  }),
766
757
  aluminum: new THREE__namespace.MeshStandardMaterial({
767
758
  color: "#abb0aa",
768
759
  metalness: 0.8,
769
760
  roughness: 0.5,
770
- envMapIntensity: 1.2,
771
- side: THREE__namespace.DoubleSide
761
+ envMapIntensity: 1.2
772
762
  }),
773
763
  aluminumBrighter: new THREE__namespace.MeshStandardMaterial({
774
764
  color: "#cdcdcd",
775
765
  metalness: 0.8,
776
766
  roughness: 0.5,
777
- envMapIntensity: 1.2,
778
- side: THREE__namespace.DoubleSide
767
+ envMapIntensity: 1.2
779
768
  }),
780
769
  aluminumExtraBrighter: new THREE__namespace.MeshStandardMaterial({
781
770
  color: "#ececec",
782
771
  metalness: 0.8,
783
772
  roughness: 0.5,
784
- envMapIntensity: 1.2,
785
- side: THREE__namespace.DoubleSide
773
+ envMapIntensity: 1.2
786
774
  }),
787
775
  silver: new THREE__namespace.MeshStandardMaterial({
788
776
  color: "#c0c0c0",
789
777
  metalness: 1.0,
790
- roughness: 0.2,
791
- side: THREE__namespace.DoubleSide
778
+ roughness: 0.2
792
779
  }),
793
780
  gold: new THREE__namespace.MeshStandardMaterial({
794
781
  color: "#ffd700",
795
782
  metalness: 1.0,
796
- roughness: 0.3,
797
- side: THREE__namespace.DoubleSide
783
+ roughness: 0.3
798
784
  }),
799
785
  diamond: new THREE__namespace.MeshStandardMaterial({
800
786
  color: "#e0f7fa",
@@ -802,24 +788,20 @@ const availableMaterials = {
802
788
  roughness: 0.05,
803
789
  transparent: true,
804
790
  opacity: 0.9,
805
- envMapIntensity: 1.5,
806
- side: THREE__namespace.DoubleSide
791
+ envMapIntensity: 1.5
807
792
  }),
808
793
  test_material: new THREE__namespace.MeshStandardMaterial({
809
794
  color: "red",
810
- roughness: 0.1,
811
- side: THREE__namespace.DoubleSide
795
+ roughness: 0.1
812
796
  })
813
797
  };
814
798
  new THREE__namespace.MeshStandardMaterial({
815
799
  color: "#cccccc",
816
- roughness: 0.8,
817
- side: THREE__namespace.DoubleSide
800
+ roughness: 0.8
818
801
  });
819
802
  new THREE__namespace.MeshStandardMaterial({
820
803
  color: "#000",
821
- roughness: 0.8,
822
- side: THREE__namespace.DoubleSide
804
+ roughness: 0.8
823
805
  });
824
806
 
825
807
  // Helper function to check for hex color codes
@@ -827,13 +809,12 @@ const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
827
809
 
828
810
  /**
829
811
  * A simple "builder" that creates a THREE.MeshStandardMaterial from a prop and an
830
- * optional map of pre-loaded textures. It does NOT load textures itself.
812
+ * optional map of pre-loaded textures. It now loads textures if they are not pre-loaded.
831
813
  * @param prop - The material definition (string or object).
832
814
  * @param textures - A map of URL -> THREE.Texture, provided by useTexture.
833
815
  * @returns A THREE.MeshStandardMaterial instance.
834
816
  */
835
- const BuildMaterial = (prop, textures) => {
836
- const texture = fiber.useLoader(THREE.TextureLoader, "https://threejs.org/examples/textures/hardwood2_diffuse.jpg");
817
+ const buildMaterial = (prop, textures) => {
837
818
  if (!prop) {
838
819
  return new THREE__namespace.MeshStandardMaterial({
839
820
  color: "#cccccc",
@@ -843,14 +824,16 @@ const BuildMaterial = (prop, textures) => {
843
824
  const sourceValue = typeof prop === "string" ? prop : prop.value;
844
825
  const opacity = typeof prop === "object" ? prop.opacity : 1;
845
826
  const params = {
846
- roughness: 0.8
827
+ roughness: 0.8,
828
+ side: THREE__namespace.DoubleSide
847
829
  };
848
830
  if (isHexColor(sourceValue)) {
849
831
  params.color = sourceValue;
850
832
  } else if (textures && textures[sourceValue]) {
851
- params.map = texture;
833
+ params.map = textures[sourceValue];
852
834
  } else {
853
- params.color = "#cccccc";
835
+ const texture = new THREE__namespace.TextureLoader().load(sourceValue);
836
+ params.map = texture;
854
837
  }
855
838
  if (opacity !== undefined && opacity < 1) {
856
839
  params.transparent = true;
@@ -904,7 +887,7 @@ const useDoorMaterials = function () {
904
887
  // 4. Now that textures are guaranteed to be loaded, build all materials.
905
888
  // This memo ensures the materials are only created when props or textures change.
906
889
  return React.useMemo(() => {
907
- const build = prop => BuildMaterial(prop, textureMap);
890
+ const build = prop => buildMaterial(prop, textureMap);
908
891
  return {
909
892
  doorMaterial: build(materialsProp.Body),
910
893
  frameMaterial: build(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])),