Skip to content

Commit

Permalink
chore - begin experiment with stat values for placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
sdubourg committed Jul 27, 2023
1 parent 5e75dcb commit 12a6243
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
9 changes: 4 additions & 5 deletions src/components/gl/House/Appartment_v4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,13 @@ export const AppartmentV4 = forwardRef<
geometry={nodes.Cube002.geometry}
material={materials['16_clean plaster texture-seamless.001']}
/>
<mesh
{/* TODO : THIS IS AN EXAMPLE, WE NEED REMAINING HOTSPOTS : A REST MACHINE, A FOOD MACHINE, AND A SOCIALISE MACHINE */}
<AppartmentHotspot
geometry={nodes.sofa_2001.geometry}
material={materials.sofa_2}
materials={materials.sofa_2}
position={[-16.512, 0.613, 4.434]}
scale={1.182}
hotSpotMachine={barMachine}
/>
<mesh
geometry={nodes.closet_without_chair001.geometry}
Expand All @@ -183,14 +185,12 @@ export const AppartmentV4 = forwardRef<
geometry={nodes.plant_1001.geometry}
material={materials['plant_1.001']}
/>

<AppartmentHotspot
geometry={nodes.bar001.geometry}
materials={materials.bar}
position={[8.725, 1.23, 7.158]}
hotSpotMachine={barMachine}
/>

<mesh
geometry={nodes.graffitti_party.geometry}
material={materials.graffitti_party}
Expand Down Expand Up @@ -279,7 +279,6 @@ export const AppartmentV4 = forwardRef<
materials['38_black and white marble tile texture-seamless']
}
/>

<AppartmentHotspot
geometry={nodes.cheloupee.geometry}
materials={materials.cheloupee}
Expand Down
12 changes: 6 additions & 6 deletions src/components/gl/House/HotSpots/AppartmentHotspot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { Text, useCursor } from '@react-three/drei';
import { type MeshProps } from '@react-three/fiber';
import { useInterpret, useSelector } from '@xstate/react';

Check warning on line 4 in src/components/gl/House/HotSpots/AppartmentHotspot.tsx

View workflow job for this annotation

GitHub Actions / main - Build and deploy

'useSelector' is defined but never used

Check failure on line 4 in src/components/gl/House/HotSpots/AppartmentHotspot.tsx

View workflow job for this annotation

GitHub Actions / main - Build and deploy

'useSelector' is declared but its value is never read.
import { useRef, useState } from 'react';
import type { Mesh } from 'three';
import { Vector3, type Mesh } from 'three';

Check warning on line 6 in src/components/gl/House/HotSpots/AppartmentHotspot.tsx

View workflow job for this annotation

GitHub Actions / main - Build and deploy

'Vector3' is defined but never used

Check failure on line 6 in src/components/gl/House/HotSpots/AppartmentHotspot.tsx

View workflow job for this annotation

GitHub Actions / main - Build and deploy

'Vector3' is declared but its value is never read.
import { shallow } from 'zustand/shallow';
import { useStoreDragging } from '../../../../stores/storeDragging';
import type { AppartmentHotSpot } from './types';
import { AppartmentHotspotStats } from './AppartmentHotspotStats';

export const AppartmentHotspot = ({
geometry,
Expand All @@ -19,8 +20,6 @@ export const AppartmentHotspot = ({
const service = useInterpret(hotSpotMachine);
useCursor(isHovered);

const { persons } = useSelector(service, (s) => s.context);

const {
setIsDragging,
isDragging,
Expand Down Expand Up @@ -92,9 +91,10 @@ export const AppartmentHotspot = ({
material-emissiveMap={materials.map}
name="hotspot"
>
<Text color="blue" position-y={6} fontSize={5}>
{persons.length}
</Text>
<AppartmentHotspotStats
service={service}
textPosition={[1.25, -2, 1]}
/>
</a.mesh>
</a.group>
);
Expand Down
29 changes: 29 additions & 0 deletions src/components/gl/House/HotSpots/AppartmentHotspotStats.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Text } from '@react-three/drei';
import { useSelector } from '@xstate/react';
import type { InterpreterFrom } from 'xstate';
import type { hotspotMachine } from '../../../../machines/hotspot.machine';
import type { MeshProps } from '@react-three/fiber';

type AppartmentHotspotStats = {
service: InterpreterFrom<typeof hotspotMachine>;
textPosition: MeshProps['position'];
};

export const AppartmentHotspotStats = ({

Check warning on line 12 in src/components/gl/House/HotSpots/AppartmentHotspotStats.tsx

View workflow job for this annotation

GitHub Actions / main - Build and deploy

'AppartmentHotspotStats' is assigned a value but never used
service,
textPosition,
}: AppartmentHotspotStats) => {
const { persons, maxPersons } = useSelector(service, (s) => s.context);

return (
<Text position={textPosition} fontSize={0.7}>
{persons.length}/{maxPersons}
<meshStandardMaterial
color="white"
emissive={0xffffff}
emissiveIntensity={2}
toneMapped={false}
/>
</Text>
);
};
2 changes: 0 additions & 2 deletions src/components/gl/World/World.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const World = () => {
<>
<Cam />

{/* <AppartmentModelv3 ref={refFloor} position-y={-0.5} /> */}

<AppartmentV4 ref={refFloor} position-y={-0.5} />

<Suspense fallback={null}>
Expand Down

0 comments on commit 12a6243

Please sign in to comment.