Skip to content

Commit

Permalink
feat: simplify the house and set it as a square
Browse files Browse the repository at this point in the history
  • Loading branch information
ReidyT committed Nov 19, 2024
1 parent b6b0f71 commit d1917dc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 89 deletions.
Binary file modified public/models/ResidentialHouse.glb
Binary file not shown.
15 changes: 0 additions & 15 deletions src/modules/models/House/ResidentialHouse/FrontHome.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Model: "Residential Houses" from: https://www.sloyd.ai/
*/
import { BaseHome } from './BaseHome';
import { Floor } from './Floor';
import { FrontHome } from './FrontHome';
import { Roof } from './Roof';
import { useResidentialHouse } from './useResidentialHouse';

Expand All @@ -22,8 +21,7 @@ export const ResidentialHouse = ({
<group {...props} dispose={null}>
{displayAxesHelper && <axesHelper args={[50]} />}
<BaseHome nodes={nodes} materials={materials} />
<FrontHome nodes={nodes} materials={materials} />
<Roof nodes={nodes} materials={materials} hasDetails={false} />
<Roof nodes={nodes} materials={materials} />
<Floor nodes={nodes} materials={materials} />
</group>
);
Expand Down
81 changes: 14 additions & 67 deletions src/modules/models/House/ResidentialHouse/Roof.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,5 @@
import { GLTFResult } from './useResidentialHouse';

const RoofDetails = ({
nodes,
materials,
}: {
nodes: GLTFResult['nodes'];
materials: GLTFResult['materials'];
}): JSX.Element => (
<mesh
geometry={nodes.RoofDetailGroup.geometry}
material={materials.Wall}
position={[0, 4, 2]}
rotation={[0, 1.571, 0]}
>
<group rotation={[-Math.PI / 2, 0, 0]}>
<mesh geometry={nodes.RoofDetail_1.geometry} material={materials.Roof} />
<mesh geometry={nodes.RoofDetail_2.geometry} material={materials.Wood} />
</group>
<group position={[0, 0.953, 3.22]}>
<mesh
geometry={nodes.RoofDetailWindow001_1.geometry}
material={materials.Roof}
/>
<mesh
geometry={nodes.RoofDetailWindow001_2.geometry}
material={materials.Window}
/>
<mesh
geometry={nodes.RoofDetailWindow001_3.geometry}
material={materials.Wood}
/>
</group>
<group position={[0, 0.953, -3.22]} rotation={[-Math.PI, 0, -Math.PI]}>
<mesh
geometry={nodes.RoofDetailWindow001_1.geometry}
material={materials.Roof}
/>
<mesh
geometry={nodes.RoofDetailWindow001_2.geometry}
material={materials.Window}
/>
<mesh
geometry={nodes.RoofDetailWindow001_3.geometry}
material={materials.Wood}
/>
</group>
</mesh>
);

const RoofWindows = ({
nodes,
materials,
Expand All @@ -56,7 +8,7 @@ const RoofWindows = ({
materials: GLTFResult['materials'];
}): JSX.Element => (
<>
<group position={[0.4, 0.952, -4.375]} rotation={[-Math.PI, 0, -Math.PI]}>
<group position={[0.4, 0.952, -4.05]} rotation={[-Math.PI, 0, -Math.PI]}>
<mesh
geometry={nodes.RoofWindowBack_1.geometry}
material={materials.Roof}
Expand All @@ -70,7 +22,7 @@ const RoofWindows = ({
material={materials.Wood}
/>
</group>
<group position={[-0.4, 0.952, 4.375]}>
<group position={[-0.4, 0.952, 4.05]}>
<mesh
geometry={nodes.RoofWindowFront_1.geometry}
material={materials.Roof}
Expand All @@ -90,26 +42,21 @@ const RoofWindows = ({
export const Roof = ({
nodes,
materials,
hasDetails = true,
}: {
nodes: GLTFResult['nodes'];
materials: GLTFResult['materials'];
hasDetails: boolean;
}): JSX.Element => (
<>
{hasDetails && <RoofDetails nodes={nodes} materials={materials} />}
<mesh
geometry={nodes.RoofGroup.geometry}
material={materials.Wall}
position={[0, 3.45, 0]}
rotation={[-Math.PI, 0, -Math.PI]}
>
<group rotation={[-Math.PI / 2, 0, Math.PI]}>
<mesh geometry={nodes.Roof_1.geometry} material={materials.Roof} />
<mesh geometry={nodes.Roof_2.geometry} material={materials.Wood} />
</group>
<mesh
geometry={nodes.RoofGroup.geometry}
material={materials.Wall}
position={[0, 3.45, 0]}
rotation={[-Math.PI, 0, -Math.PI]}
>
<group rotation={[-Math.PI / 2, 0, Math.PI]}>
<mesh geometry={nodes.Roof_1.geometry} material={materials.Roof} />
<mesh geometry={nodes.Roof_2.geometry} material={materials.Wood} />
</group>

<RoofWindows nodes={nodes} materials={materials} />
</mesh>
</>
<RoofWindows nodes={nodes} materials={materials} />
</mesh>
);
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const invertAxesXZ = (pos: Position): Position => {
};

const BACK_WALL_PROPS: CommonProps = {
wallPosition: [0, 0, 4.375] as const,
wallPosition: [0, 0, 4.05] as const,
windowPosition: [2.188, 1.8, 0.06] as const,
doorPosition: [0, 1.295, 0.1] as const,
arrowPosition: [0, 1.425, 1.1] as const,
Expand Down
5 changes: 2 additions & 3 deletions src/modules/scenes/FirstScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,16 @@ const FirstSceneComponent = (): JSX.Element => {

<Stack direction="row" alignItems="center" spacing={1}>
<House />
<Typography>House Walls</Typography>
<Typography>
House Floor (m<sup>3</sup>)
8.1 x 2.85 m<sup>2</sup>
</Typography>
<Typography>8.75 x 8.1 x 2.85</Typography>
</Stack>
</Stack>
</Stack>
</Stack>

<Canvas
// style={{ height: '100vh', width: '100vw' }}
style={{ height: '400px' }}
camera={{ position: [10, 1, -15], fov: 60 }}
>
Expand Down

0 comments on commit d1917dc

Please sign in to comment.