import React, { useEffect, useMemo, useRef } from 'react'; import { useWallStore } from '../../../../store/builder/useWallStore' import WallInstance from './instance/wallInstance'; import Line from '../../line/line'; import Point from '../../point/point'; import { useToggleView } from '../../../../store/builder/store'; import { Base, Geometry, Subtraction } from '@react-three/csg'; import { BoxGeometry } from 'three'; function WallInstances() { const { walls } = useWallStore(); const { toggleView } = useToggleView(); const ref = useRef(); const csg = useRef(); useEffect(() => { // console.log('walls: ', walls); }, [walls]) const allPoints = useMemo(() => { const points: Point[] = []; const seenUuids = new Set(); walls.forEach(aisle => { aisle.points.forEach(point => { if (!seenUuids.has(point.pointUuid)) { seenUuids.add(point.pointUuid); points.push(point); } }); }); return points; }, [walls]); const box = useMemo(() => new BoxGeometry(), []); return ( <> {walls.map((wall) => ( ))} {toggleView && ( <> {allPoints.map((point) => ( ))} {walls.map((wall) => ( ))} )} ) } export default WallInstances