Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -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