diff --git a/src/App.vue b/src/App.vue index 85c6cf2..32643a1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,7 +9,7 @@ import Models from "./models/Models.vue"; import {VLayout, VMain, VToolbarTitle} from "vuetify/lib/components"; import {settings} from "./misc/settings"; import {NetworkManager, NetworkUpdateEvent} from "./misc/network"; -import {newSceneMgrData, SceneMgr, SceneManagerData} from "./misc/scene"; +import {SceneManagerData, SceneMgr} from "./misc/scene"; // NOTE: The ModelViewer library is big (THREE.js), so we split it and import it asynchronously const ModelViewerWrapper = defineAsyncComponent({ @@ -51,7 +51,7 @@ for (let model of settings.preloadModels) { - + diff --git a/src/misc/settings.ts b/src/misc/settings.ts index 442d53f..c30f9cb 100644 --- a/src/misc/settings.ts +++ b/src/misc/settings.ts @@ -2,9 +2,9 @@ export const settings = { preloadModels: [ // @ts-ignore - new URL('../../assets/fox.glb', import.meta.url).href, + // new URL('../../assets/fox.glb', import.meta.url).href, // @ts-ignore - // new URL('../../assets/logo.glbs', import.meta.url).href, + new URL('../../assets/logo.glbs', import.meta.url).href, // Websocket URLs automatically listen for new models from the python backend //"ws://localhost:8080/" ], diff --git a/src/models/glb/glbs.ts b/src/models/glb/glbs.ts index f3cfe49..c8a013d 100644 --- a/src/models/glb/glbs.ts +++ b/src/models/glb/glbs.ts @@ -18,7 +18,7 @@ export async function* splitGlbs(readerSrc: ReadableStream): AsyncGe finalBuffer.set(buffer4Bytes); finalBuffer.set(remaining, buffer4Bytes.length); yield finalBuffer - } else if (magic !== "GLBS") { + } else if (magic === "GLBS") { // First, we read the number of chunks (can be 0xFFFFFFFF if the number of chunks is unknown). [buffer4Bytes, buffered] = await readN(reader, buffered, 4); let numChunks = new DataView(buffer4Bytes.buffer).getUint32(0, true); @@ -28,7 +28,8 @@ export async function* splitGlbs(readerSrc: ReadableStream): AsyncGe // - Read length [buffer4Bytes, buffered] = await readN(reader, buffered, 4); if (buffer4Bytes.length === 0) { - if (numChunks != 0xFFFFFFFF) throw new Error('Unexpected end of stream while reading chunk length'); + if (numChunks != 0xFFFFFFFF) throw new Error('Unexpected end of stream while reading chunk length:'+ + ' expected ' + (numChunks - i) + ' more chunks'); else break // We reached the end of the stream of unknown length, so we stop reading chunks. } let length = new DataView(buffer4Bytes.buffer).getUint32(0, true); @@ -41,7 +42,8 @@ export async function* splitGlbs(readerSrc: ReadableStream): AsyncGe reader.releaseLock() } -/** Reads exactly `n` bytes from the reader and returns them as a Uint8Array. +/** + * Reads up to `n` bytes from the reader and returns them as a Uint8Array. * An over-read is possible, in which case the returned array will still have `n` bytes and the over-read bytes will be * returned. They should be provided to the next call to `readN` to avoid losing data. */ diff --git a/src/tools/Tools.vue b/src/tools/Tools.vue index 88802f9..69c8bee 100644 --- a/src/tools/Tools.vue +++ b/src/tools/Tools.vue @@ -59,6 +59,18 @@ function centerCamera() { + + + + + + + + + + + +