@plasius/gpu-camera 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/LICENSE +203 -0
- package/README.md +101 -0
- package/dist/index.cjs +685 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +654 -0
- package/dist/index.js.map +1 -0
- package/legal/CLA-REGISTRY.csv +2 -0
- package/legal/CLA.md +22 -0
- package/legal/CORPORATE_CLA.md +57 -0
- package/legal/INDIVIDUAL_CLA.md +91 -0
- package/package.json +71 -0
- package/src/index.d.ts +224 -0
- package/src/index.js +759 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"sourcesContent":["const EPSILON = 1e-6;\nconst DEFAULT_VIEWPORT = Object.freeze({\n x: 0,\n y: 0,\n width: 1,\n height: 1,\n});\n\nconst DEFAULT_UP = Object.freeze([0, 1, 0]);\n\nexport const cameraProjectionKinds = Object.freeze([\n \"perspective\",\n \"orthographic\",\n]);\n\nexport const cameraControlKinds = Object.freeze([\n \"set-look-at\",\n \"orbit\",\n \"pan\",\n \"truck\",\n \"dolly\",\n]);\n\nfunction nowMs(timeSource) {\n if (typeof timeSource === \"function\") {\n return Number(timeSource()) || Date.now();\n }\n if (typeof performance !== \"undefined\" && typeof performance.now === \"function\") {\n return performance.now();\n }\n return Date.now();\n}\n\nfunction clamp(value, min, max) {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction finiteNumber(value, fallback = 0) {\n const number = Number(value);\n return Number.isFinite(number) ? number : fallback;\n}\n\nfunction cloneVec3(value, fallback = [0, 0, 0]) {\n if (!Array.isArray(value) || value.length < 3) {\n return [...fallback];\n }\n return [\n finiteNumber(value[0], fallback[0]),\n finiteNumber(value[1], fallback[1]),\n finiteNumber(value[2], fallback[2]),\n ];\n}\n\nfunction addVec3(a, b) {\n return [a[0] + b[0], a[1] + b[1], a[2] + b[2]];\n}\n\nfunction subVec3(a, b) {\n return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];\n}\n\nfunction scaleVec3(vector, scalar) {\n return [vector[0] * scalar, vector[1] * scalar, vector[2] * scalar];\n}\n\nfunction dotVec3(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nfunction crossVec3(a, b) {\n return [\n a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0],\n ];\n}\n\nfunction lengthVec3(vector) {\n return Math.hypot(vector[0], vector[1], vector[2]);\n}\n\nfunction normalizeVec3(vector, fallback = [0, 0, 1]) {\n const length = lengthVec3(vector);\n if (length <= EPSILON) {\n return [...fallback];\n }\n return [vector[0] / length, vector[1] / length, vector[2] / length];\n}\n\nfunction cloneViewport(viewport = DEFAULT_VIEWPORT) {\n return {\n x: clamp(finiteNumber(viewport.x, DEFAULT_VIEWPORT.x), 0, 1),\n y: clamp(finiteNumber(viewport.y, DEFAULT_VIEWPORT.y), 0, 1),\n width: clamp(finiteNumber(viewport.width, DEFAULT_VIEWPORT.width), EPSILON, 1),\n height: clamp(finiteNumber(viewport.height, DEFAULT_VIEWPORT.height), EPSILON, 1),\n };\n}\n\nfunction normalizeProjection(projection = {}) {\n const kind = cameraProjectionKinds.includes(projection.kind)\n ? projection.kind\n : \"perspective\";\n\n if (kind === \"orthographic\") {\n const left = finiteNumber(projection.left, -1);\n const right = finiteNumber(projection.right, 1);\n const bottom = finiteNumber(projection.bottom, -1);\n const top = finiteNumber(projection.top, 1);\n const near = Math.max(EPSILON, finiteNumber(projection.near, 0.1));\n const far = Math.max(near + EPSILON, finiteNumber(projection.far, 2000));\n return {\n kind,\n left,\n right,\n bottom,\n top,\n near,\n far,\n aspect: finiteNumber(projection.aspect, 1),\n };\n }\n\n const fovY = clamp(finiteNumber(projection.fovY, 60), 1, 179);\n const near = Math.max(EPSILON, finiteNumber(projection.near, 0.1));\n const far = Math.max(near + EPSILON, finiteNumber(projection.far, 2000));\n const aspect = Math.max(EPSILON, finiteNumber(projection.aspect, 1));\n return {\n kind,\n fovY,\n near,\n far,\n aspect,\n };\n}\n\nfunction normalizeTransform(transform = {}) {\n const position = cloneVec3(transform.position, [0, 0, 5]);\n const target = cloneVec3(transform.target, [0, 0, 0]);\n const up = normalizeVec3(cloneVec3(transform.up, DEFAULT_UP), DEFAULT_UP);\n return {\n position,\n target,\n up,\n };\n}\n\nfunction cloneCamera(camera) {\n return {\n id: camera.id,\n enabled: camera.enabled,\n priority: camera.priority,\n revision: camera.revision,\n touchedAt: camera.touchedAt,\n viewport: cloneViewport(camera.viewport),\n transform: normalizeTransform(camera.transform),\n projection: normalizeProjection(camera.projection),\n metadata: camera.metadata ? { ...camera.metadata } : undefined,\n };\n}\n\nfunction assertCameraId(cameras, cameraId) {\n const camera = cameras.get(cameraId);\n if (!camera) {\n throw new Error(`Unknown camera \"${cameraId}\".`);\n }\n return camera;\n}\n\nfunction sortedCameras(cameras) {\n return [...cameras].sort((a, b) => {\n if (b.priority !== a.priority) {\n return b.priority - a.priority;\n }\n return a.id.localeCompare(b.id);\n });\n}\n\nfunction promoteActive(cameras, activeCameraId) {\n if (!activeCameraId) {\n return cameras;\n }\n const index = cameras.findIndex((camera) => camera.id === activeCameraId);\n if (index <= 0) {\n return cameras;\n }\n const promoted = [...cameras];\n const [active] = promoted.splice(index, 1);\n promoted.unshift(active);\n return promoted;\n}\n\nfunction ensureArray(value) {\n return Array.isArray(value) ? value : [];\n}\n\nfunction buildPerspectiveMatrix(projection, overrideAspect) {\n const aspect = Math.max(EPSILON, finiteNumber(overrideAspect, projection.aspect));\n const fovRad = (projection.fovY * Math.PI) / 180;\n const f = 1 / Math.tan(fovRad / 2);\n const near = projection.near;\n const far = projection.far;\n\n return new Float32Array([\n f / aspect,\n 0,\n 0,\n 0,\n 0,\n f,\n 0,\n 0,\n 0,\n 0,\n (far + near) / (near - far),\n -1,\n 0,\n 0,\n (2 * far * near) / (near - far),\n 0,\n ]);\n}\n\nfunction buildOrthographicMatrix(projection, overrideAspect) {\n const near = projection.near;\n const far = projection.far;\n const aspect = Math.max(EPSILON, finiteNumber(overrideAspect, projection.aspect || 1));\n\n let left = projection.left;\n let right = projection.right;\n let top = projection.top;\n let bottom = projection.bottom;\n\n if (finiteNumber(projection.aspect, 0) > EPSILON) {\n const scale = aspect / projection.aspect;\n left *= scale;\n right *= scale;\n }\n\n const width = Math.max(EPSILON, right - left);\n const height = Math.max(EPSILON, top - bottom);\n const depth = Math.max(EPSILON, far - near);\n\n return new Float32Array([\n 2 / width,\n 0,\n 0,\n 0,\n 0,\n 2 / height,\n 0,\n 0,\n 0,\n 0,\n -2 / depth,\n 0,\n -(right + left) / width,\n -(top + bottom) / height,\n -(far + near) / depth,\n 1,\n ]);\n}\n\nexport function buildProjectionMatrix(camera, overrideAspect) {\n const projection = normalizeProjection(camera?.projection);\n if (projection.kind === \"orthographic\") {\n return buildOrthographicMatrix(projection, overrideAspect);\n }\n return buildPerspectiveMatrix(projection, overrideAspect);\n}\n\nexport function buildViewMatrix(camera) {\n const transform = normalizeTransform(camera?.transform);\n const eye = transform.position;\n const target = transform.target;\n const up = normalizeVec3(transform.up, DEFAULT_UP);\n\n let zAxis = normalizeVec3(subVec3(eye, target), [0, 0, 1]);\n let xAxis = normalizeVec3(crossVec3(up, zAxis), [1, 0, 0]);\n let yAxis = crossVec3(zAxis, xAxis);\n\n if (lengthVec3(xAxis) <= EPSILON) {\n zAxis = [0, 0, 1];\n xAxis = [1, 0, 0];\n yAxis = [0, 1, 0];\n }\n\n return new Float32Array([\n xAxis[0],\n yAxis[0],\n zAxis[0],\n 0,\n xAxis[1],\n yAxis[1],\n zAxis[1],\n 0,\n xAxis[2],\n yAxis[2],\n zAxis[2],\n 0,\n -dotVec3(xAxis, eye),\n -dotVec3(yAxis, eye),\n -dotVec3(zAxis, eye),\n 1,\n ]);\n}\n\nexport function toCameraUniform(camera, overrideAspect) {\n const normalized = {\n transform: normalizeTransform(camera?.transform),\n projection: normalizeProjection(camera?.projection),\n };\n\n return {\n id: String(camera?.id ?? \"\"),\n viewMatrix: buildViewMatrix(normalized),\n projectionMatrix: buildProjectionMatrix(normalized, overrideAspect),\n position: new Float32Array(normalized.transform.position),\n target: new Float32Array(normalized.transform.target),\n near: normalized.projection.near,\n far: normalized.projection.far,\n projectionKind: normalized.projection.kind,\n };\n}\n\nfunction normalizeCameraDefinition(definition, generatedId) {\n const id = String(definition?.id ?? generatedId ?? \"camera\").trim();\n if (!id) {\n throw new Error(\"Camera id cannot be empty.\");\n }\n\n return {\n id,\n enabled: definition?.enabled !== false,\n priority: finiteNumber(definition?.priority, 0),\n revision: Math.max(0, Math.floor(finiteNumber(definition?.revision, 0))),\n touchedAt: finiteNumber(definition?.touchedAt, 0),\n viewport: cloneViewport(definition?.viewport),\n transform: normalizeTransform(definition?.transform),\n projection: normalizeProjection(definition?.projection),\n metadata: definition?.metadata\n ? { ...definition.metadata }\n : undefined,\n };\n}\n\nexport function applyCameraControl(camera, control, options = {}) {\n const base = normalizeCameraDefinition(camera, camera?.id ?? \"camera\");\n if (!control || typeof control !== \"object\") {\n return base;\n }\n\n const kind = String(control.type || \"\").trim();\n if (!cameraControlKinds.includes(kind)) {\n throw new Error(`Unknown camera control \"${kind}\".`);\n }\n\n const minDistance = Math.max(EPSILON, finiteNumber(options.minDistance, 0.05));\n const maxDistance = Math.max(minDistance + EPSILON, finiteNumber(options.maxDistance, 100000));\n const minPolarAngle = clamp(\n finiteNumber(options.minPolarAngle, EPSILON),\n EPSILON,\n Math.PI - EPSILON\n );\n const maxPolarAngle = clamp(\n finiteNumber(options.maxPolarAngle, Math.PI - EPSILON),\n minPolarAngle,\n Math.PI - EPSILON\n );\n\n let next = cloneCamera(base);\n\n if (kind === \"set-look-at\") {\n next.transform.position = cloneVec3(control.position, next.transform.position);\n next.transform.target = cloneVec3(control.target, next.transform.target);\n next.transform.up = normalizeVec3(cloneVec3(control.up, next.transform.up), DEFAULT_UP);\n }\n\n if (kind === \"pan\" || kind === \"truck\") {\n const delta = cloneVec3(control.delta, [0, 0, 0]);\n next.transform.position = addVec3(next.transform.position, delta);\n next.transform.target = addVec3(next.transform.target, delta);\n }\n\n if (kind === \"dolly\") {\n const distance = finiteNumber(control.distance, 0);\n const eye = next.transform.position;\n const target = next.transform.target;\n const direction = normalizeVec3(subVec3(target, eye), [0, 0, -1]);\n\n const offset = subVec3(eye, target);\n const currentRadius = Math.max(EPSILON, lengthVec3(offset));\n const nextRadius = clamp(currentRadius - distance, minDistance, maxDistance);\n const moved = subVec3(target, scaleVec3(direction, nextRadius));\n next.transform.position = moved;\n }\n\n if (kind === \"orbit\") {\n const deltaAzimuth = finiteNumber(control.deltaAzimuth, 0);\n const deltaPolar = finiteNumber(control.deltaPolar, 0);\n const radiusDelta = finiteNumber(control.radiusDelta, 0);\n\n const eye = next.transform.position;\n const target = next.transform.target;\n const offset = subVec3(eye, target);\n\n const radius = Math.max(EPSILON, lengthVec3(offset));\n const nextRadius = clamp(radius + radiusDelta, minDistance, maxDistance);\n\n const azimuth = Math.atan2(offset[0], offset[2]) + deltaAzimuth;\n const polarCurrent = Math.acos(clamp(offset[1] / radius, -1, 1));\n const polar = clamp(\n polarCurrent + deltaPolar,\n minPolarAngle,\n maxPolarAngle\n );\n\n const sinPolar = Math.sin(polar);\n const position = [\n target[0] + nextRadius * sinPolar * Math.sin(azimuth),\n target[1] + nextRadius * Math.cos(polar),\n target[2] + nextRadius * sinPolar * Math.cos(azimuth),\n ];\n\n next.transform.position = position;\n }\n\n next.revision = Math.max(base.revision + 1, next.revision);\n next.touchedAt = finiteNumber(options.touchedAt, base.touchedAt);\n return next;\n}\n\nexport function createRenderPlan(snapshot, options = {}) {\n const mode = options.mode === \"multiview\" ? \"multiview\" : \"single\";\n const enabledOnly = options.enabledOnly !== false;\n const includeMatrices = options.includeMatrices !== false;\n const maxParallelViews = Math.max(\n 1,\n Math.floor(\n finiteNumber(\n options.maxParallelViews,\n finiteNumber(snapshot?.maxParallelViews, 1)\n )\n )\n );\n\n const byId = new Map();\n const inputCameras = ensureArray(snapshot?.cameras).map((camera) =>\n normalizeCameraDefinition(camera, camera?.id)\n );\n\n for (const camera of inputCameras) {\n byId.set(camera.id, camera);\n }\n\n let selected;\n if (Array.isArray(options.cameraIds) && options.cameraIds.length > 0) {\n selected = options.cameraIds\n .map((cameraId) => byId.get(String(cameraId)))\n .filter(Boolean);\n } else {\n selected = sortedCameras(inputCameras);\n }\n\n if (enabledOnly) {\n selected = selected.filter((camera) => camera.enabled);\n }\n\n selected = promoteActive(selected, snapshot?.activeCameraId ?? null);\n\n if (mode === \"single\") {\n selected = selected.slice(0, 1);\n }\n\n const hotSet = new Set(ensureArray(snapshot?.hotCameraIds).map((id) => String(id)));\n\n const batches = [];\n for (let index = 0; index < selected.length; index += maxParallelViews) {\n const chunk = selected.slice(index, index + maxParallelViews);\n batches.push({\n index: batches.length,\n parallel: chunk.length > 1,\n views: chunk.map((camera, order) => {\n const aspect = camera.viewport.width / camera.viewport.height;\n const view = {\n cameraId: camera.id,\n order,\n priority: camera.priority,\n revision: camera.revision,\n hot: hotSet.has(camera.id),\n viewport: cloneViewport(camera.viewport),\n };\n\n if (includeMatrices) {\n view.viewMatrix = buildViewMatrix(camera);\n view.projectionMatrix = buildProjectionMatrix(camera, aspect);\n }\n\n return view;\n }),\n });\n }\n\n return {\n mode,\n generatedAt: finiteNumber(options.generatedAt, Date.now()),\n activeCameraId: snapshot?.activeCameraId ?? null,\n hotCameraIds: [...hotSet],\n maxParallelViews,\n totalViews: selected.length,\n canRenderInParallel: mode === \"multiview\" && batches.some((batch) => batch.parallel),\n batches,\n };\n}\n\nexport function createCameraManager(options = {}) {\n const listeners = new Set();\n const cameras = new Map();\n\n const maxParallelViews = Math.max(1, Math.floor(finiteNumber(options.maxParallelViews, 2)));\n const maxHotCameras = Math.max(1, Math.floor(finiteNumber(options.maxHotCameras, 3)));\n const timeSource = options.timeSource;\n\n let sequence = 0;\n let activeCameraId = null;\n let version = 0;\n let hotCameraIds = [];\n let updatedAt = nowMs(timeSource);\n\n function bumpVersion() {\n version += 1;\n updatedAt = nowMs(timeSource);\n const snapshot = getSnapshot();\n for (const listener of listeners) {\n listener(snapshot);\n }\n }\n\n function markHot(cameraId) {\n hotCameraIds = [cameraId, ...hotCameraIds.filter((id) => id !== cameraId)].slice(\n 0,\n maxHotCameras\n );\n }\n\n function selectFallbackActive() {\n const enabled = sortedCameras([...cameras.values()]).filter((camera) => camera.enabled);\n if (enabled.length > 0) {\n return enabled[0].id;\n }\n const sorted = sortedCameras([...cameras.values()]);\n return sorted.length > 0 ? sorted[0].id : null;\n }\n\n function getSnapshot() {\n const snapshot = {\n activeCameraId,\n version,\n updatedAt,\n maxParallelViews,\n maxHotCameras,\n hotCameraIds: [...hotCameraIds],\n cameras: sortedCameras([...cameras.values()]).map((camera) => cloneCamera(camera)),\n };\n return snapshot;\n }\n\n function registerCamera(definition = {}) {\n sequence += 1;\n const generatedId = `camera-${sequence}`;\n const camera = normalizeCameraDefinition(definition, generatedId);\n\n if (cameras.has(camera.id)) {\n throw new Error(`Camera \"${camera.id}\" is already registered.`);\n }\n\n camera.touchedAt = nowMs(timeSource);\n cameras.set(camera.id, camera);\n\n if (!activeCameraId) {\n activeCameraId = camera.id;\n }\n\n markHot(camera.id);\n bumpVersion();\n return cloneCamera(camera);\n }\n\n function updateCamera(cameraId, patch = {}) {\n const current = assertCameraId(cameras, cameraId);\n const next = normalizeCameraDefinition(\n {\n ...current,\n ...patch,\n id: current.id,\n transform: {\n ...current.transform,\n ...patch.transform,\n },\n projection: {\n ...current.projection,\n ...patch.projection,\n },\n viewport: {\n ...current.viewport,\n ...patch.viewport,\n },\n },\n current.id\n );\n\n next.revision = current.revision + 1;\n next.touchedAt = nowMs(timeSource);\n\n cameras.set(current.id, next);\n markHot(current.id);\n\n if (patch.makeActive === true) {\n activeCameraId = current.id;\n }\n\n bumpVersion();\n return cloneCamera(next);\n }\n\n function upsertCamera(definition = {}) {\n if (definition?.id && cameras.has(definition.id)) {\n return updateCamera(definition.id, definition);\n }\n return registerCamera(definition);\n }\n\n function removeCamera(cameraId) {\n if (!cameras.has(cameraId)) {\n return false;\n }\n\n cameras.delete(cameraId);\n hotCameraIds = hotCameraIds.filter((id) => id !== cameraId);\n\n if (activeCameraId === cameraId) {\n activeCameraId = selectFallbackActive();\n }\n\n bumpVersion();\n return true;\n }\n\n function activateCamera(cameraId) {\n const current = assertCameraId(cameras, cameraId);\n activeCameraId = current.id;\n\n const updated = cloneCamera(current);\n updated.touchedAt = nowMs(timeSource);\n cameras.set(current.id, updated);\n\n markHot(current.id);\n bumpVersion();\n return cloneCamera(updated);\n }\n\n function listCameras(listOptions = {}) {\n let next = sortedCameras([...cameras.values()]);\n if (listOptions.enabledOnly) {\n next = next.filter((camera) => camera.enabled);\n }\n return next.map((camera) => cloneCamera(camera));\n }\n\n function switchCamera(direction = 1, switchOptions = {}) {\n let list = sortedCameras([...cameras.values()]);\n if (switchOptions.enabledOnly !== false) {\n list = list.filter((camera) => camera.enabled);\n }\n\n if (list.length === 0) {\n return null;\n }\n\n const currentIndex = list.findIndex((camera) => camera.id === activeCameraId);\n const step = direction >= 0 ? 1 : -1;\n const nextIndex =\n currentIndex < 0\n ? 0\n : (currentIndex + step + list.length) % list.length;\n\n return activateCamera(list[nextIndex].id);\n }\n\n function applyControl(cameraId, control, controlOptions = {}) {\n const current = assertCameraId(cameras, cameraId);\n const touchedAt = nowMs(timeSource);\n const next = applyCameraControl(current, control, {\n ...controlOptions,\n touchedAt,\n });\n\n cameras.set(cameraId, next);\n markHot(cameraId);\n\n if (controlOptions.makeActive === true) {\n activeCameraId = cameraId;\n }\n\n bumpVersion();\n return cloneCamera(next);\n }\n\n function getCamera(cameraId) {\n const camera = cameras.get(cameraId);\n return camera ? cloneCamera(camera) : null;\n }\n\n function hasCamera(cameraId) {\n return cameras.has(cameraId);\n }\n\n function createPlan(planOptions = {}) {\n return createRenderPlan(getSnapshot(), {\n ...planOptions,\n maxParallelViews:\n planOptions.maxParallelViews ?? maxParallelViews,\n generatedAt: nowMs(timeSource),\n });\n }\n\n function subscribe(listener) {\n if (typeof listener !== \"function\") {\n throw new Error(\"Listener must be a function.\");\n }\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n }\n\n function clear() {\n cameras.clear();\n activeCameraId = null;\n hotCameraIds = [];\n bumpVersion();\n }\n\n return {\n registerCamera,\n updateCamera,\n upsertCamera,\n removeCamera,\n activateCamera,\n switchCamera,\n applyControl,\n hasCamera,\n getCamera,\n listCameras,\n getSnapshot,\n createRenderPlan: createPlan,\n subscribe,\n clear,\n };\n}\n"],"mappings":";AAAA,IAAM,UAAU;AAChB,IAAM,mBAAmB,OAAO,OAAO;AAAA,EACrC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO;AAAA,EACP,QAAQ;AACV,CAAC;AAED,IAAM,aAAa,OAAO,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAEnC,IAAM,wBAAwB,OAAO,OAAO;AAAA,EACjD;AAAA,EACA;AACF,CAAC;AAEM,IAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,MAAM,YAAY;AACzB,MAAI,OAAO,eAAe,YAAY;AACpC,WAAO,OAAO,WAAW,CAAC,KAAK,KAAK,IAAI;AAAA,EAC1C;AACA,MAAI,OAAO,gBAAgB,eAAe,OAAO,YAAY,QAAQ,YAAY;AAC/E,WAAO,YAAY,IAAI;AAAA,EACzB;AACA,SAAO,KAAK,IAAI;AAClB;AAEA,SAAS,MAAM,OAAO,KAAK,KAAK;AAC9B,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;AAEA,SAAS,aAAa,OAAO,WAAW,GAAG;AACzC,QAAM,SAAS,OAAO,KAAK;AAC3B,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;AAEA,SAAS,UAAU,O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;AACtB,WAAO,MAAM;AACX,gBAAU,OAAO,QAAQ;AAAA,IAC3B;AAAA,EACF;AAEA,WAAS,QAAQ;AACf,YAAQ,MAAM;AACd,qBAAiB;AACjB,mBAAe,CAAC;AAChB,gBAAY;AAAA,EACd;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,EACF;AACF;","names":["near","far"]}
|
package/legal/CLA.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Contributor License Agreements (CLA)
|
|
2
|
+
|
|
3
|
+
To protect the intellectual property of this project and ensure clarity of rights, all contributors must sign a Contributor License Agreement (CLA) before their first contribution.
|
|
4
|
+
|
|
5
|
+
## Which CLA should I sign?
|
|
6
|
+
|
|
7
|
+
- **Individual CLA**: If you are contributing personally and not on behalf of an employer, sign the [Individual CLA](INDIVIDUAL_CLA.md).
|
|
8
|
+
- **Corporate CLA**: If you are contributing as part of your work for a company, the company should sign the [Corporate CLA](CORPORATE_CLA.md).
|
|
9
|
+
|
|
10
|
+
## How to sign
|
|
11
|
+
|
|
12
|
+
1. Download the appropriate CLA file (Individual or Corporate).
|
|
13
|
+
2. Fill in the required details, sign, and date it.
|
|
14
|
+
3. Email a PDF copy of the signed document to **[contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)** with subject: `CLA – Individual` or `CLA – Corporate`.
|
|
15
|
+
|
|
16
|
+
## Registry
|
|
17
|
+
|
|
18
|
+
All signed CLAs are logged internally in the CLA registry (`CLA-REGISTRY.csv`).
|
|
19
|
+
|
|
20
|
+
## Questions?
|
|
21
|
+
|
|
22
|
+
If you have any questions about which CLA to sign or how the process works, please email **[contributors@plasius.co.uk](mailtocontributors@plasius.co.uk)**.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Corporate Contributor License Agreement (CLA)
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This Corporate Contributor License Agreement ("Agreement") is intended to protect the intellectual property rights of the contributors and the project, ensure clear licensing terms for contributions, and maintain trust within the community. By signing this Agreement, the corporation agrees to the terms that facilitate the use, distribution, and modification of contributions under the project's licensing framework.
|
|
6
|
+
|
|
7
|
+
## Agreement
|
|
8
|
+
|
|
9
|
+
1. **Representation of Authority**
|
|
10
|
+
The undersigned individual represents and warrants that they have the full legal authority to enter into this Agreement on behalf of the corporation named below ("Corporation") and to grant the rights contained herein.
|
|
11
|
+
|
|
12
|
+
2. **Grant of Copyright License**
|
|
13
|
+
The Corporation hereby grants to the project maintainers and users a perpetual, worldwide, non-exclusive, royalty-free, irrevocable copyright license to use, reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the contributions submitted to the project.
|
|
14
|
+
|
|
15
|
+
3. **Grant of Patent License**
|
|
16
|
+
The Corporation hereby grants to the project maintainers and users a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under any patent claims that are necessarily infringed by the contributions to make, use, sell, offer for sale, import, and otherwise dispose of the contributions or derivative works thereof.
|
|
17
|
+
|
|
18
|
+
4. **Warranties and Representations**
|
|
19
|
+
The Corporation represents and warrants that:
|
|
20
|
+
|
|
21
|
+
- The contributions are the original work of the Corporation or that the Corporation has sufficient rights to grant the licenses herein.
|
|
22
|
+
- The submission of the contributions does not violate any agreements or rights of third parties.
|
|
23
|
+
|
|
24
|
+
5. **No Revocation**
|
|
25
|
+
This license is granted on a perpetual basis and cannot be revoked, provided that the terms of this Agreement are met.
|
|
26
|
+
|
|
27
|
+
6. **Governing Law**
|
|
28
|
+
This Agreement shall be governed by and construed in accordance with the laws of the United Kingdom, without regard to its conflict of laws principles.
|
|
29
|
+
|
|
30
|
+
7. **Execution**
|
|
31
|
+
|
|
32
|
+
This Agreement is effective upon signature by the authorized representative of the Corporation. Please sign and date this document, then email a scanned PDF copy to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
### **@plasius/gpu-xr**
|
|
37
|
+
|
|
38
|
+
**Corporation Legal Name:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
39
|
+
|
|
40
|
+
**Authorized Representative:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
41
|
+
|
|
42
|
+
**Title:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
43
|
+
|
|
44
|
+
**Email:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
45
|
+
|
|
46
|
+
**Date:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
47
|
+
|
|
48
|
+
**Signature:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## How to Sign
|
|
53
|
+
|
|
54
|
+
- Download this file as a template.
|
|
55
|
+
- Fill in the Corporation’s legal name, authorized representative, title, email, date, and provide a signature.
|
|
56
|
+
- Sign and date the document.
|
|
57
|
+
- Send a scanned copy of the signed Agreement to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Individual Contributor License Agreement (CLA)
|
|
2
|
+
|
|
3
|
+
**Project:** @plasius/gpu-xr (Plasius LTD)
|
|
4
|
+
**Version:** 1.0 — 2025‑09‑12
|
|
5
|
+
**Contact:** [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Definitions
|
|
10
|
+
|
|
11
|
+
- **"You"** (or **"Contributor"**) means the individual signing this CLA and submitting Contributions to the Project.
|
|
12
|
+
- **"Contribution"** means any original work of authorship, including code, documentation, data, designs, or feedback that You submit to the Project in any form (e.g., pull request, issue comment, email, file upload).
|
|
13
|
+
- **"Project"** means the @plasius/gpu-xr repositories and related materials owned or managed by **Plasius LTD**.
|
|
14
|
+
|
|
15
|
+
## 2. Copyright License Grant
|
|
16
|
+
|
|
17
|
+
You hereby grant to Plasius LTD a **perpetual, worldwide, non‑exclusive, transferable, sublicensable, royalty‑free, irrevocable** copyright license to:
|
|
18
|
+
|
|
19
|
+
- use, reproduce, publicly display, publicly perform, modify, create derivative works of, and
|
|
20
|
+
- distribute Contributions in source and object form,
|
|
21
|
+
- and to **sublicense** these rights under any terms Plasius LTD chooses, including proprietary or open‑source licenses.
|
|
22
|
+
|
|
23
|
+
## 3. Patent License Grant
|
|
24
|
+
|
|
25
|
+
You hereby grant to Plasius LTD and its sublicensees a **perpetual, worldwide, non‑exclusive, transferable, royalty‑free, irrevocable** patent license to **make, have made, use, offer to sell, sell, import, and otherwise transfer** the Contribution and derivative works thereof, where such license applies only to patent claims that You **own or control** and that would be infringed by Your Contribution or its combination with the Project.
|
|
26
|
+
|
|
27
|
+
## 4. Moral Rights & Attribution
|
|
28
|
+
|
|
29
|
+
To the maximum extent permitted by applicable law, You **waive** and agree not to assert any moral rights (e.g., rights of attribution or integrity) in or to the Contribution against Plasius LTD. Plasius LTD may, but is not required to, credit You.
|
|
30
|
+
|
|
31
|
+
## 5. Representations & Warranties
|
|
32
|
+
|
|
33
|
+
You represent that:
|
|
34
|
+
|
|
35
|
+
1. **Originality / Rights:** Each Contribution is Your original creation, or You have sufficient rights to submit it and grant the licenses above.
|
|
36
|
+
2. **No Confidential Info:** Contributions **do not** include confidential information or trade secrets of any third party.
|
|
37
|
+
3. **No Infringement:** To the best of Your knowledge, Contributions do not infringe any third‑party IP rights.
|
|
38
|
+
4. **Employment / Contractor Status:** If Your employer or a third party might claim rights in Your Contribution, You have obtained **written permission** to make the Contribution and grant these licenses (attach or reference below), or Your Contribution is made **outside the scope** of your employment and without using your employer’s confidential information or resources.
|
|
39
|
+
5. **Compliance:** You will follow the Project’s policies (e.g., Code of Conduct, Security Policy) and applicable laws.
|
|
40
|
+
|
|
41
|
+
## 6. Third‑Party Code
|
|
42
|
+
|
|
43
|
+
If Your Contribution includes code, data, or other material from a third party, You will **identify the material and its license** in the pull request or submission, and ensure it is **compatible** with the Project’s licensing model. You will not submit material subject to terms that require the Project to disclose proprietary source code (e.g., certain copyleft obligations) unless the Project has **pre‑approved** such inclusion in writing.
|
|
44
|
+
|
|
45
|
+
## 7. Scope & Duration
|
|
46
|
+
|
|
47
|
+
- This CLA covers **all past and future** Contributions You submit to the Project, unless and until You provide written notice to **revoke** it.
|
|
48
|
+
- Revocation is **not retroactive**: rights granted for prior Contributions remain in effect.
|
|
49
|
+
|
|
50
|
+
## 8. Disclaimer
|
|
51
|
+
|
|
52
|
+
THE CONTRIBUTION IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON‑INFRINGEMENT.
|
|
53
|
+
|
|
54
|
+
## 9. Governing Law & Jurisdiction
|
|
55
|
+
|
|
56
|
+
This CLA is governed by the **laws of England and Wales**, and the courts of England and Wales shall have **exclusive jurisdiction** over any dispute arising out of or relating to it.
|
|
57
|
+
|
|
58
|
+
## 10. Entire Agreement
|
|
59
|
+
|
|
60
|
+
This CLA is the entire agreement between You and Plasius LTD regarding Contributions. It supersedes any prior discussions relating to Contributions. If any provision is held unenforceable, the remaining provisions remain in full force.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 11. Contributor Information & Signature
|
|
65
|
+
|
|
66
|
+
By signing below, You agree to the terms of this CLA for Your Contributions to the Project.
|
|
67
|
+
|
|
68
|
+
**Full Name:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
69
|
+
|
|
70
|
+
**Email:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
71
|
+
|
|
72
|
+
**GitHub Handle:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
73
|
+
|
|
74
|
+
**Address (optional):** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
75
|
+
|
|
76
|
+
**Employer (if applicable):** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
77
|
+
|
|
78
|
+
**If employed:** ☐ I confirm Contributions are made outside the scope of employment **or** ☐ I have attached my employer’s written permission.
|
|
79
|
+
|
|
80
|
+
**Signature:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
81
|
+
|
|
82
|
+
**Date (YYYY‑MM‑DD):** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
83
|
+
|
|
84
|
+
_Electronic signatures are accepted. You may type your name in the Signature field and email a PDF copy._
|
|
85
|
+
|
|
86
|
+
**Submission:** Please email the signed CLA to **[contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)** with subject line: `CLA – Individual – <GitHubHandle>`.
|
|
87
|
+
|
|
88
|
+
**(Optional) Attachments / Notes:**
|
|
89
|
+
|
|
90
|
+
- Employer permission letter (if required)
|
|
91
|
+
- Third‑party license disclosures (if any)
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plasius/gpu-camera",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Framework-agnostic multi-camera control runtime with parallel multiview planning.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"private": false,
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./src/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"src",
|
|
14
|
+
"README.md",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"legal"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./src/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"require": "./dist/index.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup",
|
|
29
|
+
"demo": "python3 -m http.server --directory ..",
|
|
30
|
+
"test": "npm run test:unit",
|
|
31
|
+
"test:unit": "node --test",
|
|
32
|
+
"test:coverage": "c8 --reporter=lcov --reporter=text node --test"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"camera",
|
|
36
|
+
"multi-camera",
|
|
37
|
+
"multiview",
|
|
38
|
+
"render-plan",
|
|
39
|
+
"webgpu",
|
|
40
|
+
"gpu",
|
|
41
|
+
"plasius"
|
|
42
|
+
],
|
|
43
|
+
"author": "Plasius LTD <development@plasius.co.uk>",
|
|
44
|
+
"license": "Apache-2.0",
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"c8": "^10.1.3",
|
|
47
|
+
"tsup": "^8.5.0",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/Plasius-LTD/gpu-camera.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/Plasius-LTD/gpu-camera/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/Plasius-LTD/gpu-camera#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"funding": [
|
|
62
|
+
{
|
|
63
|
+
"type": "patreon",
|
|
64
|
+
"url": "https://www.patreon.com/c/plasiusltd/membership"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "github",
|
|
68
|
+
"url": "https://github.com/sponsors/Plasius-LTD"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
export type Vec3 = [number, number, number];
|
|
2
|
+
|
|
3
|
+
export interface CameraViewport {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface PerspectiveProjection {
|
|
11
|
+
kind: "perspective";
|
|
12
|
+
fovY: number;
|
|
13
|
+
near: number;
|
|
14
|
+
far: number;
|
|
15
|
+
aspect?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface OrthographicProjection {
|
|
19
|
+
kind: "orthographic";
|
|
20
|
+
left: number;
|
|
21
|
+
right: number;
|
|
22
|
+
top: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
near: number;
|
|
25
|
+
far: number;
|
|
26
|
+
aspect?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type CameraProjection = PerspectiveProjection | OrthographicProjection;
|
|
30
|
+
|
|
31
|
+
export interface CameraTransform {
|
|
32
|
+
position: Vec3;
|
|
33
|
+
target: Vec3;
|
|
34
|
+
up?: Vec3;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CameraDefinition {
|
|
38
|
+
id?: string;
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
priority?: number;
|
|
41
|
+
revision?: number;
|
|
42
|
+
touchedAt?: number;
|
|
43
|
+
transform?: Partial<CameraTransform>;
|
|
44
|
+
projection?: Partial<CameraProjection> & { kind?: CameraProjection["kind"] };
|
|
45
|
+
viewport?: Partial<CameraViewport>;
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface CameraState {
|
|
50
|
+
id: string;
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
priority: number;
|
|
53
|
+
revision: number;
|
|
54
|
+
touchedAt: number;
|
|
55
|
+
transform: CameraTransform;
|
|
56
|
+
projection: CameraProjection;
|
|
57
|
+
viewport: CameraViewport;
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface OrbitControl {
|
|
62
|
+
type: "orbit";
|
|
63
|
+
deltaAzimuth?: number;
|
|
64
|
+
deltaPolar?: number;
|
|
65
|
+
radiusDelta?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface PanControl {
|
|
69
|
+
type: "pan" | "truck";
|
|
70
|
+
delta?: Vec3;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface DollyControl {
|
|
74
|
+
type: "dolly";
|
|
75
|
+
distance?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface SetLookAtControl {
|
|
79
|
+
type: "set-look-at";
|
|
80
|
+
position?: Vec3;
|
|
81
|
+
target?: Vec3;
|
|
82
|
+
up?: Vec3;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type CameraControl = OrbitControl | PanControl | DollyControl | SetLookAtControl;
|
|
86
|
+
|
|
87
|
+
export interface CameraUniform {
|
|
88
|
+
id: string;
|
|
89
|
+
viewMatrix: Float32Array;
|
|
90
|
+
projectionMatrix: Float32Array;
|
|
91
|
+
position: Float32Array;
|
|
92
|
+
target: Float32Array;
|
|
93
|
+
near: number;
|
|
94
|
+
far: number;
|
|
95
|
+
projectionKind: CameraProjection["kind"];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface RenderPlanView {
|
|
99
|
+
cameraId: string;
|
|
100
|
+
order: number;
|
|
101
|
+
priority: number;
|
|
102
|
+
revision: number;
|
|
103
|
+
hot: boolean;
|
|
104
|
+
viewport: CameraViewport;
|
|
105
|
+
viewMatrix?: Float32Array;
|
|
106
|
+
projectionMatrix?: Float32Array;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface RenderPlanBatch {
|
|
110
|
+
index: number;
|
|
111
|
+
parallel: boolean;
|
|
112
|
+
views: RenderPlanView[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface RenderPlan {
|
|
116
|
+
mode: "single" | "multiview";
|
|
117
|
+
generatedAt: number;
|
|
118
|
+
activeCameraId: string | null;
|
|
119
|
+
hotCameraIds: string[];
|
|
120
|
+
maxParallelViews: number;
|
|
121
|
+
totalViews: number;
|
|
122
|
+
canRenderInParallel: boolean;
|
|
123
|
+
batches: RenderPlanBatch[];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface CameraManagerSnapshot {
|
|
127
|
+
activeCameraId: string | null;
|
|
128
|
+
version: number;
|
|
129
|
+
updatedAt: number;
|
|
130
|
+
maxParallelViews: number;
|
|
131
|
+
maxHotCameras: number;
|
|
132
|
+
hotCameraIds: string[];
|
|
133
|
+
cameras: CameraState[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface CreateRenderPlanOptions {
|
|
137
|
+
mode?: "single" | "multiview";
|
|
138
|
+
enabledOnly?: boolean;
|
|
139
|
+
includeMatrices?: boolean;
|
|
140
|
+
maxParallelViews?: number;
|
|
141
|
+
cameraIds?: string[];
|
|
142
|
+
generatedAt?: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface CameraManagerOptions {
|
|
146
|
+
maxParallelViews?: number;
|
|
147
|
+
maxHotCameras?: number;
|
|
148
|
+
timeSource?: () => number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface CameraSwitchOptions {
|
|
152
|
+
enabledOnly?: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ApplyControlOptions {
|
|
156
|
+
minDistance?: number;
|
|
157
|
+
maxDistance?: number;
|
|
158
|
+
minPolarAngle?: number;
|
|
159
|
+
maxPolarAngle?: number;
|
|
160
|
+
makeActive?: boolean;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface UpdateCameraOptions extends CameraDefinition {
|
|
164
|
+
makeActive?: boolean;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface CameraManager {
|
|
168
|
+
registerCamera(definition: CameraDefinition): CameraState;
|
|
169
|
+
updateCamera(cameraId: string, patch: UpdateCameraOptions): CameraState;
|
|
170
|
+
upsertCamera(definition: CameraDefinition): CameraState;
|
|
171
|
+
removeCamera(cameraId: string): boolean;
|
|
172
|
+
activateCamera(cameraId: string): CameraState;
|
|
173
|
+
switchCamera(direction?: number, options?: CameraSwitchOptions): CameraState | null;
|
|
174
|
+
applyControl(cameraId: string, control: CameraControl, options?: ApplyControlOptions): CameraState;
|
|
175
|
+
hasCamera(cameraId: string): boolean;
|
|
176
|
+
getCamera(cameraId: string): CameraState | null;
|
|
177
|
+
listCameras(options?: { enabledOnly?: boolean }): CameraState[];
|
|
178
|
+
getSnapshot(): CameraManagerSnapshot;
|
|
179
|
+
createRenderPlan(options?: CreateRenderPlanOptions): RenderPlan;
|
|
180
|
+
subscribe(listener: (snapshot: CameraManagerSnapshot) => void): () => void;
|
|
181
|
+
clear(): void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function buildProjectionMatrix(
|
|
185
|
+
camera: Pick<CameraState, "projection">,
|
|
186
|
+
overrideAspect?: number
|
|
187
|
+
): Float32Array;
|
|
188
|
+
|
|
189
|
+
export function buildViewMatrix(
|
|
190
|
+
camera: Pick<CameraState, "transform">
|
|
191
|
+
): Float32Array;
|
|
192
|
+
|
|
193
|
+
export function toCameraUniform(
|
|
194
|
+
camera: Pick<CameraState, "id" | "transform" | "projection">,
|
|
195
|
+
overrideAspect?: number
|
|
196
|
+
): CameraUniform;
|
|
197
|
+
|
|
198
|
+
export function applyCameraControl(
|
|
199
|
+
camera: CameraDefinition,
|
|
200
|
+
control: CameraControl,
|
|
201
|
+
options?: {
|
|
202
|
+
minDistance?: number;
|
|
203
|
+
maxDistance?: number;
|
|
204
|
+
minPolarAngle?: number;
|
|
205
|
+
maxPolarAngle?: number;
|
|
206
|
+
touchedAt?: number;
|
|
207
|
+
}
|
|
208
|
+
): CameraState;
|
|
209
|
+
|
|
210
|
+
export function createRenderPlan(
|
|
211
|
+
snapshot: Partial<CameraManagerSnapshot>,
|
|
212
|
+
options?: CreateRenderPlanOptions
|
|
213
|
+
): RenderPlan;
|
|
214
|
+
|
|
215
|
+
export function createCameraManager(options?: CameraManagerOptions): CameraManager;
|
|
216
|
+
|
|
217
|
+
export const cameraProjectionKinds: readonly ["perspective", "orthographic"];
|
|
218
|
+
export const cameraControlKinds: readonly [
|
|
219
|
+
"set-look-at",
|
|
220
|
+
"orbit",
|
|
221
|
+
"pan",
|
|
222
|
+
"truck",
|
|
223
|
+
"dolly"
|
|
224
|
+
];
|