Commit eee5875d authored by Stoll's avatar Stoll
Browse files

Fix: Removed double instantion

parent 0abb2762
...@@ -7,7 +7,8 @@ import { Cube } from "../model/Cube"; // custom class for a simple cube ...@@ -7,7 +7,8 @@ import { Cube } from "../model/Cube"; // custom class for a simple cube
import { GLTFModel } from "../model/GLTFModel"; // custom loader for .glb 3D models import { GLTFModel } from "../model/GLTFModel"; // custom loader for .glb 3D models
import { ARBottomBar } from "./ARBottomBar"; import { ARBottomBar } from "./ARBottomBar";
import {RoomEnvironment} from "three/examples/jsm/environments/RoomEnvironment"; import {RoomEnvironment} from "three/examples/jsm/environments/RoomEnvironment";
import {addLightToScene, createCamera, createPlacementRing, createRenderer, setSceneBackground} from "./Setup.ts"; // bottom UI for selecting objects import {addLightToScene, createCamera, createPlacementRing, createRenderer, setSceneBackground} from "./Setup.ts";
import type {WebGLRenderer} from "three"; // bottom UI for selecting objects
function createARButton(renderer: WebGLRenderer, overlayRef: React.RefObject<HTMLDivElement>) { function createARButton(renderer: WebGLRenderer, overlayRef: React.RefObject<HTMLDivElement>) {
...@@ -57,15 +58,6 @@ function toLocalMeters(ll: LLA, origin: LLA) { ...@@ -57,15 +58,6 @@ function toLocalMeters(ll: LLA, origin: LLA) {
return { x: dLon * kLon, z: dLat * kLat }; // x=east, z=north return { x: dLon * kLon, z: dLat * kLat }; // x=east, z=north
} }
// Objects for Navigation to the building once user tap the labels
const arrowsRef = useRef<THREE.Object3D[]>([]);
const navigatingRef = useRef<{ active: boolean; pathLLA: LLA[]; targetIndex: number } | null>(null);
const raycaster = useRef(new THREE.Raycaster());
const tapNDC = useRef(new THREE.Vector2());
export const XRRenderer: React.FC = () => { export const XRRenderer: React.FC = () => {
// References to DOM elements (we connect three.js canvas + overlay here) // References to DOM elements (we connect three.js canvas + overlay here)
...@@ -73,6 +65,12 @@ export const XRRenderer: React.FC = () => { ...@@ -73,6 +65,12 @@ export const XRRenderer: React.FC = () => {
const overlayRef = useRef<HTMLDivElement>(null); // the overlay UI inside AR (buttons etc.) const overlayRef = useRef<HTMLDivElement>(null); // the overlay UI inside AR (buttons etc.)
const reticleRef = useRef<THREE.Mesh | null>(null);// reference to the green reticle ring const reticleRef = useRef<THREE.Mesh | null>(null);// reference to the green reticle ring
// Objects for Navigation to the building once user tap the labels
const arrowsRef = useRef<THREE.Object3D[]>([]);
const navigatingRef = useRef<{ active: boolean; pathLLA: LLA[]; targetIndex: number } | null>(null);
const raycaster = useRef(new THREE.Raycaster());
const tapNDC = useRef(new THREE.Vector2());
// 🟡 ADD holds loaded POIs and their label meshes // 🟡 ADD holds loaded POIs and their label meshes
const poiRuntimeRef = useRef<POIRuntime[]>([]); const poiRuntimeRef = useRef<POIRuntime[]>([]);
...@@ -255,7 +253,6 @@ export const XRRenderer: React.FC = () => { ...@@ -255,7 +253,6 @@ export const XRRenderer: React.FC = () => {
// Labels within 500 m (always-on visibility rule) // Labels within 500 m (always-on visibility rule)
const MAX_LABEL_DIST_M = 500; const MAX_LABEL_DIST_M = 500;
const camPos = new THREE.Vector3();
camera.getWorldPosition(camPos); camera.getWorldPosition(camPos);
for (const item of poiRuntimeRef.current) { for (const item of poiRuntimeRef.current) {
......
...@@ -5,6 +5,6 @@ export default defineConfig({ ...@@ -5,6 +5,6 @@ export default defineConfig({
plugins: [react()], plugins: [react()],
server: { server: {
host: 'localhost', // bind to all interfaces host: 'localhost', // bind to all interfaces
port: 8080, port: 8081,
}, },
}); });
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment