Refactor code structure for improved readability and maintainability
This commit is contained in:
BIN
app/src/assets/textures/floor/tex3/metal_plate_diff_1k.jpg
Normal file
BIN
app/src/assets/textures/floor/tex3/metal_plate_diff_1k.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
BIN
app/src/assets/textures/floor/tex3/metal_plate_metal_1k.png
Normal file
BIN
app/src/assets/textures/floor/tex3/metal_plate_metal_1k.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 347 KiB |
BIN
app/src/assets/textures/floor/tex3/metal_plate_nor_gl_1k.png
Normal file
BIN
app/src/assets/textures/floor/tex3/metal_plate_nor_gl_1k.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 580 KiB |
BIN
app/src/assets/textures/floor/tex3/metal_plate_rough_1k.png
Normal file
BIN
app/src/assets/textures/floor/tex3/metal_plate_rough_1k.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 324 KiB |
BIN
app/src/assets/textures/hdr/autoshop_01_1k.hdr
Normal file
BIN
app/src/assets/textures/hdr/autoshop_01_1k.hdr
Normal file
Binary file not shown.
BIN
app/src/assets/textures/hdr/empty_warehouse_01_1k.hdr
Normal file
BIN
app/src/assets/textures/hdr/empty_warehouse_01_1k.hdr
Normal file
Binary file not shown.
BIN
app/src/assets/textures/hdr/industrial_pipe_and_valve_01_1k.hdr
Normal file
BIN
app/src/assets/textures/hdr/industrial_pipe_and_valve_01_1k.hdr
Normal file
Binary file not shown.
BIN
app/src/assets/textures/hdr/machine_shop_02_1k.hdr
Normal file
BIN
app/src/assets/textures/hdr/machine_shop_02_1k.hdr
Normal file
Binary file not shown.
@@ -6,6 +6,7 @@ import defaultTexture from '../../../../assets/textures/floor/white.png';
|
||||
import flootTexture1 from '../../../../assets/textures/floor/factory wall texture.jpg';
|
||||
import flootTexture2 from '../../../../assets/textures/floor/tex1/MI_FactoryConcreteFloor01_BaseColor.001.jpg';
|
||||
import flootTexture3 from '../../../../assets/textures/floor/tex2/MI_FloorMats01_baseColor.png';
|
||||
import flootTexture4 from '../../../../assets/textures/floor/tex3/metal_plate_diff_1k.jpg';
|
||||
|
||||
import { useBuilderStore } from "../../../../store/builder/useBuilderStore";
|
||||
|
||||
@@ -20,6 +21,7 @@ export const materials = [
|
||||
{ texture: flootTexture1, textureId: "Material 1", textureName: "Grunge Concrete Wall" },
|
||||
{ texture: flootTexture2, textureId: "Material 2", textureName: "Tiled Floor" },
|
||||
{ texture: flootTexture3, textureId: "Material 3", textureName: "Metal Floor" },
|
||||
{ texture: flootTexture4, textureId: "Material 4", textureName: "Metal Floor 2" },
|
||||
];
|
||||
|
||||
const FloorProperties = () => {
|
||||
|
||||
@@ -29,6 +29,12 @@ import material3Map from "../../../../../assets/textures/floor/tex2/MI_FloorMats
|
||||
import material3NormalMap from "../../../../../assets/textures/floor/tex2/MI_FloorMats01_Normal.png";
|
||||
import material3MetalicRoughnessMap from "../../../../../assets/textures/floor/tex2/MI_FloorMats01_occlusionRoughnessMetallic.png";
|
||||
|
||||
// floor-mat3
|
||||
import material4Map from "../../../../../assets/textures/floor/tex3/metal_plate_diff_1k.jpg";
|
||||
import material4RoughnessMap from "../../../../../assets/textures/floor/tex3/metal_plate_rough_1k.png";
|
||||
import material4MetalicMap from "../../../../../assets/textures/floor/tex3/metal_plate_metal_1k.png";
|
||||
import material4NormalMap from "../../../../../assets/textures/floor/tex3/metal_plate_nor_gl_1k.png";
|
||||
|
||||
function FloorInstance({ floor }: { floor: Floor }) {
|
||||
const { togglView } = useToggleView();
|
||||
const { activeModule } = useModuleStore();
|
||||
@@ -65,6 +71,12 @@ function FloorInstance({ floor }: { floor: Floor }) {
|
||||
metalnessMap: material3MetalicRoughnessMap,
|
||||
normalMap: material3NormalMap,
|
||||
},
|
||||
"Material 4": {
|
||||
map: material4Map,
|
||||
roughnessMap: material4RoughnessMap,
|
||||
metalnessMap: material4MetalicMap,
|
||||
normalMap: material4NormalMap,
|
||||
},
|
||||
};
|
||||
|
||||
const shape = useMemo(() => {
|
||||
@@ -131,6 +143,7 @@ function FloorInstance({ floor }: { floor: Floor }) {
|
||||
if (!tex) return;
|
||||
tex.wrapS = tex.wrapT = RepeatWrapping;
|
||||
tex.repeat.set(tileScale, tileScale);
|
||||
tex.anisotropy = 16;
|
||||
// First texture is always the color map (use SRGB), others should be linear
|
||||
tex.colorSpace = idx < 1 ? SRGBColorSpace : NoColorSpace;
|
||||
});
|
||||
@@ -184,14 +197,14 @@ function FloorInstance({ floor }: { floor: Floor }) {
|
||||
]}
|
||||
userData={floor}
|
||||
>
|
||||
<meshStandardMaterial
|
||||
<meshPhysicalMaterial
|
||||
attach="material-0"
|
||||
color={Constants.floorConfig.defaultColor}
|
||||
map={topTexture}
|
||||
roughnessMap={topRoughnessTexture}
|
||||
metalnessMap={topMetalicTexture}
|
||||
normalMap={topNormalTexture}
|
||||
roughness={1.0}
|
||||
roughness={1.5}
|
||||
metalness={1.0}
|
||||
side={DoubleSide}
|
||||
/>
|
||||
|
||||
@@ -52,6 +52,7 @@ export default function Scene({ layout }: { readonly layout: 'Main Layout' | 'Co
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
// eslint-disable-next-line
|
||||
}, [activeModule, assets, loadingProgress])
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user