Refactor wall creator and socket responses; update nav mesh components and remove unused pillar functions
- Updated import path for getClosestIntersection in wallCreator.tsx - Cleaned up socketResponses.dev.tsx by removing unused imports and code, simplifying the component structure - Modified navMesh.tsx to remove lines prop and adjust NavMeshDetails accordingly - Refactored navMeshDetails.tsx to remove lines dependency in useEffect - Updated polygonGenerator.tsx to remove lines prop and commented out unused code - Added getClosestIntersection helper function for better modularity - Removed unused pillar-related functions and commented out code in addAndUpdateReferencePillar.ts, addPillar.ts, deletableHoveredPillar.ts, deletePillar.ts, and updateReferencePolesheight.ts
This commit is contained in:
@@ -2,26 +2,23 @@ import * as THREE from "three";
|
||||
import { useEffect } from "react";
|
||||
import * as turf from "@turf/turf";
|
||||
import * as Types from "../../../../types/world/worldTypes";
|
||||
import arrayLinesToObject from "../../../builder/geomentries/lines/lineConvertions/arrayLinesToObject";
|
||||
import { useThree } from "@react-three/fiber";
|
||||
import { useSceneContext } from "../../../scene/sceneContext";
|
||||
|
||||
interface PolygonGeneratorProps {
|
||||
groupRef: React.MutableRefObject<THREE.Group | null>;
|
||||
lines: Types.RefLines;
|
||||
}
|
||||
|
||||
export default function PolygonGenerator({
|
||||
groupRef,
|
||||
lines,
|
||||
}: PolygonGeneratorProps) {
|
||||
const { aisleStore } = useSceneContext();
|
||||
const { aisles } = aisleStore();
|
||||
const { scene } = useThree();
|
||||
|
||||
useEffect(() => {
|
||||
let allLines = arrayLinesToObject(lines.current);
|
||||
const wallLines = allLines?.filter((line) => line?.type === "WallLine");
|
||||
// let allLines = arrayLinesToObject(lines.current);
|
||||
// const wallLines = allLines?.filter((line) => line?.type === "WallLine");
|
||||
const result = aisles
|
||||
.filter(
|
||||
(aisle) =>
|
||||
@@ -64,9 +61,9 @@ export default function PolygonGenerator({
|
||||
});
|
||||
});
|
||||
|
||||
const wallPoints = wallLines
|
||||
.map((pair) => pair?.line.map((vals) => vals.position))
|
||||
.filter((wall): wall is THREE.Vector3[] => !!wall);
|
||||
// const wallPoints = wallLines
|
||||
// .map((pair) => pair?.line.map((vals) => vals.position))
|
||||
// .filter((wall): wall is THREE.Vector3[] => !!wall);
|
||||
|
||||
|
||||
if (!result || result.some((line) => !line)) {
|
||||
@@ -84,7 +81,7 @@ export default function PolygonGenerator({
|
||||
|
||||
const polygons = turf.polygonize(turf.featureCollection(validLineFeatures));
|
||||
|
||||
renderWallGeometry(wallPoints);
|
||||
// renderWallGeometry(wallPoints);
|
||||
|
||||
if (polygons.features.length > 0) {
|
||||
polygons.features.forEach((feature) => {
|
||||
@@ -119,7 +116,7 @@ export default function PolygonGenerator({
|
||||
});
|
||||
}
|
||||
|
||||
}, [lines.current, aisles, scene]);
|
||||
}, [ aisles, scene]);
|
||||
|
||||
const renderWallGeometry = (walls: THREE.Vector3[][]) => {
|
||||
walls.forEach((wall) => {
|
||||
|
||||
Reference in New Issue
Block a user