Skip to content

Commit 2b7a080

Browse files
authored
Merge branch 'main' into wrapper-validation
2 parents 0183754 + 8215caf commit 2b7a080

File tree

6 files changed

+65
-48
lines changed

6 files changed

+65
-48
lines changed

photon-client/src/components/app/photon-3d-visualizer.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<script setup lang="ts">
22
import type { PhotonTarget } from "@/types/PhotonTrackingTypes";
3+
// @ts-expect-error Intellisense says these conflict with the dynamic imports below
4+
import type { Mesh, Object3D, PerspectiveCamera, Scene, WebGLRenderer } from "three";
5+
// @ts-expect-error Intellisense says these conflict with the dynamic imports below
6+
import type { TrackballControls } from "three/examples/jsm/controls/TrackballControls";
37
import { onBeforeUnmount, onMounted, watchEffect } from "vue";
4-
import {
8+
const {
59
ArrowHelper,
610
BoxGeometry,
711
Color,
812
ConeGeometry,
913
Mesh,
1014
MeshNormalMaterial,
11-
type Object3D,
1215
PerspectiveCamera,
1316
Quaternion,
14-
Scene,
1517
Vector3,
18+
Scene,
1619
WebGLRenderer
17-
} from "three";
18-
import { TrackballControls } from "three/examples/jsm/controls/TrackballControls";
20+
} = await import("three");
21+
const { TrackballControls } = await import("three/examples/jsm/controls/TrackballControls");
1922
2023
const props = defineProps<{
2124
targets: PhotonTarget[];
@@ -114,7 +117,7 @@ const resetCamThirdPerson = () => {
114117
}
115118
};
116119
117-
onMounted(() => {
120+
onMounted(async () => {
118121
scene = new Scene();
119122
camera = new PerspectiveCamera(75, 800 / 800, 0.1, 1000);
120123

photon-client/src/components/cameras/CameraCalibrationCard.vue

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import { computed, ref } from "vue";
33
import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore";
44
import { CalibrationBoardTypes, CalibrationTagFamilies, type VideoFormat } from "@/types/SettingTypes";
5-
import JsPDF from "jspdf";
6-
import { font as PromptRegular } from "@/assets/fonts/PromptRegular";
75
import MonoLogo from "@/assets/images/logoMono.png";
86
import CharucoImage from "@/assets/images/ChArUco_Marker8x8.png";
97
import PvSlider from "@/components/common/pv-slider.vue";
@@ -15,6 +13,8 @@ import { WebsocketPipelineType } from "@/types/WebsocketDataTypes";
1513
import { getResolutionString, resolutionsAreEqual } from "@/lib/PhotonUtils";
1614
import CameraCalibrationInfoCard from "@/components/cameras/CameraCalibrationInfoCard.vue";
1715
import { useSettingsStore } from "@/stores/settings/GeneralSettingsStore";
16+
const PromptRegular = import("@/assets/fonts/PromptRegular");
17+
const jspdf = import("jspdf");
1818
1919
const settingsValid = ref(true);
2020
@@ -88,10 +88,12 @@ const tooManyPoints = computed(
8888
() => useStateStore().calibrationData.imageCount * patternWidth.value * patternHeight.value > 700000
8989
);
9090
91-
const downloadCalibBoard = () => {
92-
const doc = new JsPDF({ unit: "in", format: "letter" });
91+
const downloadCalibBoard = async () => {
92+
const { jsPDF } = await jspdf;
93+
const { font } = await PromptRegular;
94+
const doc = new jsPDF({ unit: "in", format: "letter" });
9395
94-
doc.addFileToVFS("Prompt-Regular.tff", PromptRegular);
96+
doc.addFileToVFS("Prompt-Regular.tff", font);
9597
doc.addFont("Prompt-Regular.tff", "Prompt-Regular", "normal");
9698
doc.setFont("Prompt-Regular");
9799
doc.setFontSize(12);
@@ -216,39 +218,41 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
216218
<div>
217219
<v-card class="mb-3" color="primary" dark>
218220
<v-card-title>Camera Calibration</v-card-title>
219-
<v-card-text v-show="!isCalibrating">
220-
<v-card-subtitle class="pt-0 pl-0 pr-0 text-white">Current Calibration</v-card-subtitle>
221-
<v-table fixed-header height="100%" density="compact">
222-
<thead>
223-
<tr>
224-
<th>Resolution</th>
225-
<th>Mean Error</th>
226-
<th>Horizontal FOV</th>
227-
<th>Vertical FOV</th>
228-
<th>Diagonal FOV</th>
229-
<th>Info</th>
230-
</tr>
231-
</thead>
232-
<tbody style="cursor: pointer">
233-
<tr v-for="(value, index) in getUniqueVideoFormatsByResolution()" :key="index">
234-
<td>{{ getResolutionString(value.resolution) }}</td>
235-
<td>
236-
{{ value.mean !== undefined ? (isNaN(value.mean) ? "Unknown" : value.mean.toFixed(2) + "px") : "-" }}
237-
</td>
238-
<td>{{ value.horizontalFOV !== undefined ? value.horizontalFOV.toFixed(2) + "°" : "-" }}</td>
239-
<td>{{ value.verticalFOV !== undefined ? value.verticalFOV.toFixed(2) + "°" : "-" }}</td>
240-
<td>{{ value.diagonalFOV !== undefined ? value.diagonalFOV.toFixed(2) + "°" : "-" }}</td>
241-
<v-tooltip location="bottom">
242-
<template #activator="{ props }">
243-
<td v-bind="props" @click="setSelectedVideoFormat(value)">
244-
<v-icon size="small">mdi-information</v-icon>
245-
</td>
246-
</template>
247-
<span>Click for more info on this calibration.</span>
248-
</v-tooltip>
249-
</tr>
250-
</tbody>
251-
</v-table>
221+
<v-card-text>
222+
<div v-show="!isCalibrating">
223+
<v-card-subtitle class="pt-0 pl-0 pr-0 text-white">Current Calibration</v-card-subtitle>
224+
<v-table fixed-header height="100%" density="compact">
225+
<thead>
226+
<tr>
227+
<th>Resolution</th>
228+
<th>Mean Error</th>
229+
<th>Horizontal FOV</th>
230+
<th>Vertical FOV</th>
231+
<th>Diagonal FOV</th>
232+
<th>Info</th>
233+
</tr>
234+
</thead>
235+
<tbody style="cursor: pointer">
236+
<tr v-for="(value, index) in getUniqueVideoFormatsByResolution()" :key="index">
237+
<td>{{ getResolutionString(value.resolution) }}</td>
238+
<td>
239+
{{ value.mean !== undefined ? (isNaN(value.mean) ? "Unknown" : value.mean.toFixed(2) + "px") : "-" }}
240+
</td>
241+
<td>{{ value.horizontalFOV !== undefined ? value.horizontalFOV.toFixed(2) + "°" : "-" }}</td>
242+
<td>{{ value.verticalFOV !== undefined ? value.verticalFOV.toFixed(2) + "°" : "-" }}</td>
243+
<td>{{ value.diagonalFOV !== undefined ? value.diagonalFOV.toFixed(2) + "°" : "-" }}</td>
244+
<v-tooltip location="bottom">
245+
<template #activator="{ props }">
246+
<td v-bind="props" @click="setSelectedVideoFormat(value)">
247+
<v-icon size="small">mdi-information</v-icon>
248+
</td>
249+
</template>
250+
<span>Click for more info on this calibration.</span>
251+
</v-tooltip>
252+
</tr>
253+
</tbody>
254+
</v-table>
255+
</div>
252256
<div v-if="useCameraSettingsStore().isConnected" class="d-flex flex-column">
253257
<v-card-subtitle v-show="!isCalibrating" class="pl-0 pb-3 pt-3 text-white"
254258
>Configure New Calibration</v-card-subtitle

photon-client/src/components/dashboard/tabs/Map3DTab.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ const trackedTargets = computed<PhotonTarget[]>(() => useStateStore().currentPip
1616
</v-row>
1717
<v-row style="width: 100%">
1818
<v-col style="display: flex; align-items: center; justify-content: center">
19-
<photon3d-visualizer :targets="trackedTargets" />
19+
<Suspense>
20+
<!-- Allows us to import three js when it's actually needed -->
21+
<photon3d-visualizer :targets="trackedTargets" />
22+
23+
<template #fallback> Loading... </template>
24+
</Suspense>
2025
</v-col>
2126
</v-row>
2227
</div>

photon-client/src/components/settings/ApriltagControlCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
22
import { useSettingsStore } from "@/stores/settings/GeneralSettingsStore";
3-
import { Euler, Quaternion as ThreeQuat } from "three";
43
import type { Quaternion } from "@/types/PhotonTrackingTypes";
54
import { toDeg } from "@/lib/MathUtils";
5+
const { Euler, Quaternion: ThreeQuat } = await import("three");
66
77
const quaternionToEuler = (rot_quat: Quaternion): { x: number; y: number; z: number } => {
88
const quat = new ThreeQuat(rot_quat.X, rot_quat.Y, rot_quat.Z, rot_quat.W);

photon-client/src/plugins/vuetify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "vuetify/styles";
2-
import "@mdi/font/css/materialdesignicons.css";
2+
import("@mdi/font/css/materialdesignicons.css");
33
import type { ThemeDefinition } from "vuetify/lib/composables/theme";
44
import { createVuetify } from "vuetify";
55

photon-client/src/views/GeneralSettingsView.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import ApriltagControlCard from "@/components/settings/ApriltagControlCard.vue";
1515
<NetworkingCard />
1616
<ObjectDetectionCard v-if="useSettingsStore().general.supportedBackends.length > 0" />
1717
<LightingControlCard v-if="useSettingsStore().lighting.supported" />
18-
<ApriltagControlCard />
18+
<Suspense>
19+
<!-- Allows us to import three js when it's actually needed -->
20+
<ApriltagControlCard />
21+
22+
<template #fallback> Loading... </template>
23+
</Suspense>
1924
</div>
2025
</template>

0 commit comments

Comments
 (0)