@ume-group/contracts 0.2.1
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/README.md +37 -0
- package/dist/adserving.d.ts +150 -0
- package/dist/adserving.d.ts.map +1 -0
- package/dist/adserving.js +8 -0
- package/dist/campaigns.d.ts +37 -0
- package/dist/campaigns.d.ts.map +1 -0
- package/dist/campaigns.js +8 -0
- package/dist/gausst.d.ts +236 -0
- package/dist/gausst.d.ts.map +1 -0
- package/dist/gausst.js +307 -0
- package/dist/gausst.test.d.ts +2 -0
- package/dist/gausst.test.d.ts.map +1 -0
- package/dist/gausst.test.js +71 -0
- package/dist/index.d.ts +1531 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1112 -0
- package/dist/layer2/index.d.ts +9 -0
- package/dist/layer2/index.d.ts.map +1 -0
- package/dist/layer2/index.js +10 -0
- package/dist/layer2/shaders.d.ts +185 -0
- package/dist/layer2/shaders.d.ts.map +1 -0
- package/dist/layer2/shaders.js +604 -0
- package/dist/layer2/webcam-utils.d.ts +113 -0
- package/dist/layer2/webcam-utils.d.ts.map +1 -0
- package/dist/layer2/webcam-utils.js +147 -0
- package/dist/layer2/webcam-utils.test.d.ts +2 -0
- package/dist/layer2/webcam-utils.test.d.ts.map +1 -0
- package/dist/layer2/webcam-utils.test.js +18 -0
- package/dist/layer2.d.ts +558 -0
- package/dist/layer2.d.ts.map +1 -0
- package/dist/layer2.js +376 -0
- package/dist/layer2.test.d.ts +2 -0
- package/dist/layer2.test.d.ts.map +1 -0
- package/dist/layer2.test.js +65 -0
- package/dist/perspective.d.ts +28 -0
- package/dist/perspective.d.ts.map +1 -0
- package/dist/perspective.js +157 -0
- package/dist/segmentation/MediaPipeSegmenter.d.ts +201 -0
- package/dist/segmentation/MediaPipeSegmenter.d.ts.map +1 -0
- package/dist/segmentation/MediaPipeSegmenter.js +434 -0
- package/dist/segmentation/index.d.ts +5 -0
- package/dist/segmentation/index.d.ts.map +1 -0
- package/dist/segmentation/index.js +4 -0
- package/dist/webcam/GarbageMatteDragManager.d.ts +63 -0
- package/dist/webcam/GarbageMatteDragManager.d.ts.map +1 -0
- package/dist/webcam/GarbageMatteDragManager.js +183 -0
- package/dist/webcam/WebcamStreamManager.d.ts +103 -0
- package/dist/webcam/WebcamStreamManager.d.ts.map +1 -0
- package/dist/webcam/WebcamStreamManager.js +356 -0
- package/dist/webcam/index.d.ts +5 -0
- package/dist/webcam/index.d.ts.map +1 -0
- package/dist/webcam/index.js +2 -0
- package/openapi/admetise.yaml +632 -0
- package/openapi/includu.yaml +621 -0
- package/openapi/integration.yaml +372 -0
- package/openapi/shared/schemas.yaml +227 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @ume/contracts
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types and utilities for UME Group AS. This package defines the data contracts between Includu, Admetise, and the Player.
|
|
4
|
+
|
|
5
|
+
> **Public repository.** This repo is intentionally public so Cloudflare Workers Builds (NGI) and CI can install `@ume-group/contracts` from GitHub Packages without authentication tokens. Verified 2026-03-29: contains only TypeScript type definitions and OpenAPI specifications — no secrets, API keys, or business logic. Any future EA audit should re-verify before adding sensitive content. See [EA audit session log](https://github.com/uMe-Group/ume-platform/blob/main/docs/session-logs/2026-03-29-npm-auth-fix-session.md).
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build # Compile with tsc
|
|
11
|
+
npm run dev # Watch mode
|
|
12
|
+
npm run test # Run tests
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Exports
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { type Project, type Overlay, type PublishedManifest } from '@ume/contracts';
|
|
19
|
+
import { type Layer2Scene, type WebcamComposite } from '@ume/contracts/layer2';
|
|
20
|
+
import { type ChromaKeySettings } from '@ume/contracts/segmentation';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Publishing
|
|
24
|
+
|
|
25
|
+
Published to GitHub Packages as `@ume-group/contracts`. Consuming repos use npm alias:
|
|
26
|
+
```json
|
|
27
|
+
"@ume/contracts": "npm:@ume-group/contracts@^0.1.0"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Visibility Policy
|
|
31
|
+
|
|
32
|
+
This repository and its npm package are **public**. This is a deliberate architectural decision:
|
|
33
|
+
|
|
34
|
+
- **Rationale:** Eliminates npm auth token management across all Cloudflare Workers Builds and CI pipelines
|
|
35
|
+
- **Prerequisite:** Repository must ONLY contain TypeScript types, OpenAPI specs, and test code — no secrets, credentials, or proprietary business logic
|
|
36
|
+
- **Governance:** Any change adding sensitive content must first make the repo private and configure auth tokens per [ea-core-pm-documentation](https://github.com/Oss-Gruppen-AS/enterprise-continuum)
|
|
37
|
+
- **Audit trail:** Decision made 2026-03-29 by Jørgen Scheel (CTO), documented in [session log](https://github.com/uMe-Group/ume-platform/blob/main/docs/session-logs/2026-03-29-npm-auth-fix-session.md)
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ad serving contracts for Admetise ↔ Includu Player
|
|
3
|
+
*
|
|
4
|
+
* Used by:
|
|
5
|
+
* - @ume/admetise (worker: builds and returns AdPods)
|
|
6
|
+
* - packages/player (fetches AdServeResponse, sends impression events)
|
|
7
|
+
*/
|
|
8
|
+
import type { AdSlotType } from './index';
|
|
9
|
+
export interface AdServeRequest {
|
|
10
|
+
/** Includu publish ID */
|
|
11
|
+
publishId: string;
|
|
12
|
+
/** Viewer's ISO 3166-1 alpha-2 country code (e.g. "NO") */
|
|
13
|
+
viewerGeo?: string;
|
|
14
|
+
/** Device type for GAM targeting */
|
|
15
|
+
deviceType?: 'mobile' | 'tablet' | 'desktop' | 'ctv';
|
|
16
|
+
/**
|
|
17
|
+
* Random number for GAM frequency capping correlation.
|
|
18
|
+
* Generate once per player session: Math.floor(Math.random() * 1e10)
|
|
19
|
+
*/
|
|
20
|
+
correlator?: number;
|
|
21
|
+
/** Content category for targeting (e.g. "entertainment", "sports") */
|
|
22
|
+
contentCategory?: string;
|
|
23
|
+
/** Video duration in seconds (for duration-based targeting) */
|
|
24
|
+
videoDuration?: number;
|
|
25
|
+
/** Page URL where player is embedded (for domain-based targeting) */
|
|
26
|
+
pageUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A single resolved ad break, ready for IMA SDK.
|
|
30
|
+
* The player receives a list of these at load time and passes adTagUrl to IMA.
|
|
31
|
+
*/
|
|
32
|
+
export interface AdPod {
|
|
33
|
+
/** Stable ID for tracking/billing (matches AdSlotMapping.id) */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Source slot type */
|
|
36
|
+
slotType: AdSlotType;
|
|
37
|
+
/** Trigger in seconds from video start (preroll = 0, postroll = videoDuration) */
|
|
38
|
+
triggerTime?: number;
|
|
39
|
+
/** Or as percentage of video duration (0-100). One of triggerTime or triggerPercent. */
|
|
40
|
+
triggerPercent?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Fully resolved GAM VAST URL. Pass directly to IMA SDK AdDisplayContainer.
|
|
43
|
+
* Includes: network code, ad unit path, custom targeting (Admetise billing keys),
|
|
44
|
+
* correlator, geo, and standard IMA params.
|
|
45
|
+
*/
|
|
46
|
+
adTagUrl: string;
|
|
47
|
+
/** Maximum ad duration in seconds */
|
|
48
|
+
maxDuration?: number;
|
|
49
|
+
/** Normalized position for overlay ads (0–1) */
|
|
50
|
+
position?: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
};
|
|
54
|
+
/** Display width in pixels (from AdSlotTemplate) */
|
|
55
|
+
width?: number;
|
|
56
|
+
/** Display height in pixels (from AdSlotTemplate) */
|
|
57
|
+
height?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Admetise impression tracking URL.
|
|
60
|
+
* Player fires this as a GET request when IMA SDK confirms ad started.
|
|
61
|
+
* Format: https://studio.admetise.com/api/track?event=impression&podId=X&...
|
|
62
|
+
*/
|
|
63
|
+
trackingUrl: string;
|
|
64
|
+
}
|
|
65
|
+
export interface AdServeResponse {
|
|
66
|
+
publishId: string;
|
|
67
|
+
pods: AdPod[];
|
|
68
|
+
/** ISO datetime when this was resolved (for cache TTL decisions) */
|
|
69
|
+
resolvedAt: string;
|
|
70
|
+
/** Echo of the request correlator */
|
|
71
|
+
correlator?: number;
|
|
72
|
+
}
|
|
73
|
+
export type AdEventType = 'impression' | 'firstQuartile' | 'midpoint' | 'thirdQuartile' | 'complete' | 'click' | 'skip';
|
|
74
|
+
export interface AdImpressionEvent {
|
|
75
|
+
podId: string;
|
|
76
|
+
publishId: string;
|
|
77
|
+
eventType: AdEventType;
|
|
78
|
+
/** ISO 3166-1 alpha-2 (from viewer) */
|
|
79
|
+
geo?: string;
|
|
80
|
+
timestamp: string;
|
|
81
|
+
}
|
|
82
|
+
export type GamConnectionStatus = 'connected' | 'expired' | 'disconnected';
|
|
83
|
+
export interface GamAuthStatus {
|
|
84
|
+
status: GamConnectionStatus;
|
|
85
|
+
networkCode?: string;
|
|
86
|
+
networkName?: string;
|
|
87
|
+
/** ISO datetime when the access token expires */
|
|
88
|
+
tokenExpiresAt?: string;
|
|
89
|
+
/** OAuth scopes granted */
|
|
90
|
+
scopes?: string[];
|
|
91
|
+
}
|
|
92
|
+
export interface GamAdUnit {
|
|
93
|
+
/** GAM ad unit ID */
|
|
94
|
+
id: string;
|
|
95
|
+
/** Display name */
|
|
96
|
+
name: string;
|
|
97
|
+
/** Full ad unit hierarchy path, e.g. "/12345678/includu/preroll" */
|
|
98
|
+
adUnitPath: string;
|
|
99
|
+
/** Compatible slot types based on template/size */
|
|
100
|
+
compatibleSlotTypes?: AdSlotType[];
|
|
101
|
+
}
|
|
102
|
+
export type PodBuildStatus = 'pending' | 'building' | 'ready' | 'error';
|
|
103
|
+
export interface PodStatusResponse {
|
|
104
|
+
podId: string;
|
|
105
|
+
status: PodBuildStatus;
|
|
106
|
+
/** Resolved pods (only when status is 'ready') */
|
|
107
|
+
pods?: AdPod[];
|
|
108
|
+
/** Error message (only when status is 'error') */
|
|
109
|
+
error?: string;
|
|
110
|
+
/** Suggested retry delay in milliseconds (only when pending/building) */
|
|
111
|
+
retryAfterMs?: number;
|
|
112
|
+
}
|
|
113
|
+
export interface TrackingEventRequest extends AdImpressionEvent {
|
|
114
|
+
/** Current playback position in seconds */
|
|
115
|
+
positionSeconds?: number;
|
|
116
|
+
/** Viewer's user agent string */
|
|
117
|
+
userAgent?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface TrackingEventResponse {
|
|
120
|
+
accepted: boolean;
|
|
121
|
+
/** Unique event ID for deduplication */
|
|
122
|
+
eventId?: string;
|
|
123
|
+
}
|
|
124
|
+
export interface AdFormat {
|
|
125
|
+
/** Template ID (e.g. "preroll-15") */
|
|
126
|
+
id: string;
|
|
127
|
+
/** Display name */
|
|
128
|
+
name: string;
|
|
129
|
+
/** Description of the format */
|
|
130
|
+
description?: string;
|
|
131
|
+
/** Ad slot type */
|
|
132
|
+
type: AdSlotType;
|
|
133
|
+
/** Category for grouping */
|
|
134
|
+
category: 'video' | 'display' | 'companion';
|
|
135
|
+
/** Width in pixels (for display/companion) */
|
|
136
|
+
width?: number;
|
|
137
|
+
/** Height in pixels (for display/companion) */
|
|
138
|
+
height?: number;
|
|
139
|
+
/** Position for overlay ads */
|
|
140
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
|
141
|
+
/** Default duration in seconds */
|
|
142
|
+
duration?: number;
|
|
143
|
+
/** Maximum duration in seconds */
|
|
144
|
+
maxDuration?: number;
|
|
145
|
+
/** IAB standard size identifier */
|
|
146
|
+
iabSize?: string;
|
|
147
|
+
/** Whether this format is currently available */
|
|
148
|
+
active: boolean;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=adserving.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adserving.d.ts","sourceRo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AC;CACtB;AAMD,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC9D,2CAA2C;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,MAAM,WAAW,QAAQ;IACxB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,4BAA4B;IAC5B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAC5C,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,QAAQ,CAAC;IAChF,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,MAAM,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Campaign types for the Admetise ad platform
|
|
3
|
+
*
|
|
4
|
+
* Used by:
|
|
5
|
+
* - @ume/admetise (campaign management, ad serving)
|
|
6
|
+
* - @includu/editor (monetization panel, creator approval UI)
|
|
7
|
+
*/
|
|
8
|
+
export type CampaignStatus = 'draft' | 'pending_approval' | 'approved' | 'active' | 'paused' | 'ended';
|
|
9
|
+
export type CampaignType = 'exclusive' | 'non_exclusive';
|
|
10
|
+
export interface GeoTargeting {
|
|
11
|
+
/** ISO 3166-1 alpha-2 country codes (e.g., ["NO", "SE", "DK"]) */
|
|
12
|
+
countries?: string[];
|
|
13
|
+
/** Region/state identifiers */
|
|
14
|
+
regions?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface AdSlotReference {
|
|
17
|
+
/** Ad slot template ID (from AdSlotTemplate in @ume/contracts) */
|
|
18
|
+
templateId: string;
|
|
19
|
+
/** Optional override for max duration in seconds */
|
|
20
|
+
maxDuration?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ExclusiveCampaign {
|
|
23
|
+
id: string;
|
|
24
|
+
advertiserId: string;
|
|
25
|
+
title: string;
|
|
26
|
+
status: CampaignStatus;
|
|
27
|
+
type: CampaignType;
|
|
28
|
+
targeting: GeoTargeting;
|
|
29
|
+
/** Ad slot references for this campaign */
|
|
30
|
+
slots: AdSlotReference[];
|
|
31
|
+
/** GAM ad unit path for this exclusive (e.g. "/12345678/includu/exclusive-acme") */
|
|
32
|
+
gamAdUnitPath: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
startsAt: string;
|
|
35
|
+
endsAt: string;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=campaigns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../src/campaigns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,kBAAkB,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AACvG,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,eAAe,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC5B,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC/B,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,2CAA2C;IAC3C,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf"}
|
package/dist/gausst.d.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gausst Coordinate System Utilities
|
|
3
|
+
*
|
|
4
|
+
* Implements the coordinate system from Patent US8761580B2 and the
|
|
5
|
+
* legacy Gausst Maya plugin (gausstCamera.cpp).
|
|
6
|
+
*
|
|
7
|
+
* This system enables accurate camera matching between physical tracked
|
|
8
|
+
* cameras and virtual 3D scenes.
|
|
9
|
+
*
|
|
10
|
+
* Key features:
|
|
11
|
+
* - 35mm full-frame equivalent film gate (1.417" × 0.945")
|
|
12
|
+
* - FOV ↔ focal length conversion
|
|
13
|
+
* - Gausst rotation order: Tilt → Pan (negated) → Roll (negated)
|
|
14
|
+
* - Video plane sizing at distance
|
|
15
|
+
*/
|
|
16
|
+
export declare const GAUSST: {
|
|
17
|
+
readonly HORIZONTAL_APERTURE: 1.417;
|
|
18
|
+
readonly VERTICAL_APERTURE: 0.945;
|
|
19
|
+
readonly DEFAULT_FOCAL_LENGTH: 35;
|
|
20
|
+
readonly VIDEO_PLANE_DISTANCE: 500;
|
|
21
|
+
readonly DEFAULT_OVERSCAN: 1.3;
|
|
22
|
+
readonly DEG_TO_RAD: number;
|
|
23
|
+
readonly RAD_TO_DEG: number;
|
|
24
|
+
readonly MM_PER_INCH: 25.4;
|
|
25
|
+
readonly DEFAULT_CAMERA_POSITION: readonly [number, number, number];
|
|
26
|
+
readonly DEFAULT_FOV: 60;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Convert field of view (degrees) to focal length (mm)
|
|
30
|
+
*
|
|
31
|
+
* Formula from legacy gausstCamera.h:
|
|
32
|
+
* focalLength = ((aperture / 2) / tan(fieldOfView / 2)) * 25.4
|
|
33
|
+
*
|
|
34
|
+
* @param fovDegrees - Horizontal field of view in degrees
|
|
35
|
+
* @param apertureInches - Horizontal film aperture in inches (default: 35mm equivalent)
|
|
36
|
+
* @returns Focal length in millimeters
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* fovToFocalLength(60) // ≈ 31mm
|
|
40
|
+
* fovToFocalLength(90) // ≈ 18mm
|
|
41
|
+
* fovToFocalLength(45) // ≈ 43mm
|
|
42
|
+
*/
|
|
43
|
+
export declare function fovToFocalLength(fovDegrees: number, apertureInches?: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Convert focal length (mm) to field of view (degrees)
|
|
46
|
+
*
|
|
47
|
+
* Inverse of fovToFocalLength
|
|
48
|
+
*
|
|
49
|
+
* @param focalLengthMM - Focal length in millimeters
|
|
50
|
+
* @param apertureInches - Horizontal film aperture in inches (default: 35mm equivalent)
|
|
51
|
+
* @returns Horizontal field of view in degrees
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* focalLengthToFov(35) // ≈ 54.4°
|
|
55
|
+
* focalLengthToFov(50) // ≈ 39.6°
|
|
56
|
+
* focalLengthToFov(24) // ≈ 73.7°
|
|
57
|
+
*/
|
|
58
|
+
export declare function focalLengthToFov(focalLengthMM: number, apertureInches?: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Convert Gausst rotation (tilt, pan, roll) to Euler angles for Three.js
|
|
61
|
+
*
|
|
62
|
+
* From legacy gausstCamera.cpp moveTheCamera():
|
|
63
|
+
* - Maya rotation order: tilt, pan, roll
|
|
64
|
+
* - Pan and Roll are NEGATED before application
|
|
65
|
+
* - Three.js equivalent: 'YXZ' Euler order
|
|
66
|
+
*
|
|
67
|
+
* @param tiltDeg - Tilt (pitch) in degrees - rotation around X axis
|
|
68
|
+
* @param panDeg - Pan (yaw) in degrees - rotation around Y axis (will be negated)
|
|
69
|
+
* @param rollDeg - Roll in degrees - rotation around Z axis (will be negated)
|
|
70
|
+
* @returns Object with euler values and order for Three.js
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* const { x, y, z, order } = gausst RotationToEuler(10, 20, 5);
|
|
74
|
+
* mesh.rotation.set(x, y, z);
|
|
75
|
+
* mesh.rotation.order = order;
|
|
76
|
+
*/
|
|
77
|
+
export declare function gausstRotationToEuler(tiltDeg: number, panDeg: number, rollDeg: number): {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
z: number;
|
|
81
|
+
order: 'YXZ';
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Convert Three.js Euler angles back to Gausst rotation
|
|
85
|
+
*
|
|
86
|
+
* Inverse of gausst RotationToEuler - extracts tilt, pan, roll from Euler
|
|
87
|
+
* Assumes the object uses 'YXZ' rotation order
|
|
88
|
+
*
|
|
89
|
+
* @param x - Euler X rotation in radians
|
|
90
|
+
* @param y - Euler Y rotation in radians
|
|
91
|
+
* @param z - Euler Z rotation in radians
|
|
92
|
+
* @returns Gausst rotation as [tilt, pan, roll] in degrees
|
|
93
|
+
*/
|
|
94
|
+
export declare function eulerToGausstRotation(x: number, y: number, z: number): [number, number, number];
|
|
95
|
+
/**
|
|
96
|
+
* Calculate video plane dimensions at a given distance from camera
|
|
97
|
+
*
|
|
98
|
+
* From legacy gausstCamera.cpp draw():
|
|
99
|
+
* horizontalSize = videoPolygonDistance * horizontalFilmApertureValue * 25.4f / focalLengthValue;
|
|
100
|
+
* verticalSize = videoPolygonDistance * verticalFilmApertureValue * 25.4f / focalLengthValue;
|
|
101
|
+
*
|
|
102
|
+
* @param distance - Distance from camera in world units
|
|
103
|
+
* @param focalLengthMM - Focal length in millimeters
|
|
104
|
+
* @param horizontalAperture - Horizontal film aperture in inches
|
|
105
|
+
* @param verticalAperture - Vertical film aperture in inches
|
|
106
|
+
* @returns Width and height of video plane at that distance
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* // Video plane at 10m with 35mm lens
|
|
110
|
+
* const { width, height } = getVideoPlaneSize(10, 35);
|
|
111
|
+
* // width ≈ 10.27m, height ≈ 6.85m
|
|
112
|
+
*/
|
|
113
|
+
export declare function getVideoPlaneSize(distance: number, focalLengthMM: number, horizontalAperture?: number, verticalAperture?: number): {
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Calculate video plane dimensions using FOV instead of focal length
|
|
119
|
+
*
|
|
120
|
+
* @param distance - Distance from camera in world units
|
|
121
|
+
* @param fovDegrees - Horizontal field of view in degrees
|
|
122
|
+
* @returns Width and height of video plane at that distance
|
|
123
|
+
*/
|
|
124
|
+
export declare function getVideoPlaneSizeFromFov(distance: number, fovDegrees: number): {
|
|
125
|
+
width: number;
|
|
126
|
+
height: number;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Convert tracking packet position to world coordinates
|
|
130
|
+
*
|
|
131
|
+
* From legacy gausstCamera.cpp moveTheCamera():
|
|
132
|
+
* Xpos = convert4bytesToFloat(&theBuffer[6]) / 1000;
|
|
133
|
+
* (Position comes as mm × 100, divide by 1000 to get meters)
|
|
134
|
+
*
|
|
135
|
+
* @param packetValue - Raw value from tracking packet (mm × 100)
|
|
136
|
+
* @returns Position in meters
|
|
137
|
+
*/
|
|
138
|
+
export declare function trackingPacketToMeters(packetValue: number): number;
|
|
139
|
+
/**
|
|
140
|
+
* Convert meters to tracking packet format
|
|
141
|
+
*
|
|
142
|
+
* @param meters - Position in meters
|
|
143
|
+
* @returns Raw value for tracking packet (mm × 100)
|
|
144
|
+
*/
|
|
145
|
+
export declare function metersToTrackingPacket(meters: number): number;
|
|
146
|
+
/**
|
|
147
|
+
* Get the default aspect ratio from Gausst film gate
|
|
148
|
+
*
|
|
149
|
+
* @returns Aspect ratio (width / height)
|
|
150
|
+
*/
|
|
151
|
+
export declare function getGausstAspectRatio(): number;
|
|
152
|
+
/**
|
|
153
|
+
* Calculate vertical FOV from horizontal FOV using Gausst aspect ratio
|
|
154
|
+
*
|
|
155
|
+
* @param horizontalFovDeg - Horizontal field of view in degrees
|
|
156
|
+
* @returns Vertical field of view in degrees
|
|
157
|
+
*/
|
|
158
|
+
export declare function horizontalToVerticalFov(horizontalFovDeg: number): number;
|
|
159
|
+
/**
|
|
160
|
+
* Calculate horizontal FOV from vertical FOV using Gausst aspect ratio
|
|
161
|
+
*
|
|
162
|
+
* @param verticalFovDeg - Vertical field of view in degrees
|
|
163
|
+
* @returns Horizontal field of view in degrees
|
|
164
|
+
*/
|
|
165
|
+
export declare function verticalToHorizontalFov(verticalFovDeg: number): number;
|
|
166
|
+
/**
|
|
167
|
+
* Apply Gausst rotation directly to a Three.js Object3D
|
|
168
|
+
*
|
|
169
|
+
* This is the primary function for setting rotation on 3D objects
|
|
170
|
+
* using the Gausst coordinate system.
|
|
171
|
+
*
|
|
172
|
+
* @param object - Three.js Object3D (mesh, camera, group, etc.)
|
|
173
|
+
* @param tiltDeg - Tilt (pitch) in degrees
|
|
174
|
+
* @param panDeg - Pan (yaw) in degrees
|
|
175
|
+
* @param rollDeg - Roll in degrees
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* import * as THREE from 'three';
|
|
179
|
+
* const mesh = new THREE.Mesh(geometry, material);
|
|
180
|
+
* applyGausstRotation(mesh, 10, 45, 0); // 10° tilt, 45° pan
|
|
181
|
+
*/
|
|
182
|
+
export declare function applyGausstRotation(object: {
|
|
183
|
+
rotation: {
|
|
184
|
+
order: string;
|
|
185
|
+
set: (x: number, y: number, z: number) => void;
|
|
186
|
+
};
|
|
187
|
+
}, tiltDeg: number, panDeg: number, rollDeg: number): void;
|
|
188
|
+
/**
|
|
189
|
+
* Configure a Three.js PerspectiveCamera with Gausst parameters
|
|
190
|
+
*
|
|
191
|
+
* @param camera - Three.js PerspectiveCamera
|
|
192
|
+
* @param fovDegrees - Horizontal field of view in degrees
|
|
193
|
+
* @param position - Camera position [x, y, z] in meters
|
|
194
|
+
* @param lookAt - Look-at target [x, y, z] in meters
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* const camera = new THREE.PerspectiveCamera();
|
|
198
|
+
* configureGausstCamera(camera, 60, [0, 1.6, 0], [0, 1.6, -10]);
|
|
199
|
+
*/
|
|
200
|
+
export declare function configureGausstCamera(camera: {
|
|
201
|
+
fov: number;
|
|
202
|
+
position: {
|
|
203
|
+
set: (x: number, y: number, z: number) => void;
|
|
204
|
+
};
|
|
205
|
+
lookAt: (x: number, y: number, z: number) => void;
|
|
206
|
+
updateProjectionMatrix: () => void;
|
|
207
|
+
}, fovDegrees: number, position: [number, number, number], lookAt: [number, number, number]): void;
|
|
208
|
+
/**
|
|
209
|
+
* Validate FOV is within reasonable bounds
|
|
210
|
+
*
|
|
211
|
+
* @param fovDegrees - Field of view to validate
|
|
212
|
+
* @returns true if valid, false otherwise
|
|
213
|
+
*/
|
|
214
|
+
export declare function isValidFov(fovDegrees: number): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Validate focal length is within reasonable bounds
|
|
217
|
+
*
|
|
218
|
+
* @param focalLengthMM - Focal length to validate
|
|
219
|
+
* @returns true if valid, false otherwise
|
|
220
|
+
*/
|
|
221
|
+
export declare function isValidFocalLength(focalLengthMM: number): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Clamp FOV to valid range
|
|
224
|
+
*
|
|
225
|
+
* @param fovDegrees - FOV to clamp
|
|
226
|
+
* @returns Clamped FOV
|
|
227
|
+
*/
|
|
228
|
+
export declare function clampFov(fovDegrees: number): number;
|
|
229
|
+
/**
|
|
230
|
+
* Clamp rotation to reasonable range (-180 to 180)
|
|
231
|
+
*
|
|
232
|
+
* @param degrees - Rotation in degrees
|
|
233
|
+
* @returns Normalized rotation in -180 to 180 range
|
|
234
|
+
*/
|
|
235
|
+
export declare function normalizeRotation(degrees: number): number;
|
|
236
|
+
//# sourceMappingURL=gausst.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gausst.d.ts","sourceRoot":"","sources":["../src/gausst.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,eAAO,MAAM,MAAM;;;;;;;;;sCAkBsB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;CAEhE,CAAC;AAMX;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,MAAM,EAClB,cAAc,GAAE,MAAmC,GACjD,MAAM,CAGR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC/B,aAAa,EAAE,MAAM,EACrB,cAAc,GAAE,MAAmC,GACjD,MAAM,CAGR;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACb;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAOnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACpC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACP,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAM1B;AAMD;;;;;;;;;;;;;;;;;GA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