@miris-inc/core 0.0.8-a932469 → 0.0.8-a997939

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miris-inc/core",
3
- "version": "0.0.8-a932469",
3
+ "version": "0.0.8-a997939",
4
4
  "description": "Core scene-graph runtime for the Miris 3D streaming SDK. WASM-backed Engine, Client, Scene, Stream, and LOD primitives shared by all higher-level packages.",
5
5
  "keywords": [
6
6
  "3d",
package/webshark.d.ts CHANGED
@@ -56,6 +56,23 @@ export interface RenderState {
56
56
  height: number,
57
57
  splatTriangles: number,
58
58
  ): void;
59
+ // Decodes Radiance .hdr bytes into roughness-ladder level `level` (0 is the sharp mirror).
60
+ // hdrPtr must address THIS module's heap - _malloc here and copy the bytes in.
61
+ // Returns false for bytes that are not a usable Radiance image, or a level out of range.
62
+ uploadEnvironmentLadderLevelFromHdr(
63
+ level: number,
64
+ sigmaDeg: number,
65
+ hdrPtr: number,
66
+ hdrSizeBytes: number,
67
+ ): boolean;
68
+ // Republish the ladder's shape. Call after any level lands, or it is sampled at whatever shape
69
+ // the last uploadSplatSetData declared. Pass SplatSet.hasReflectionParams().
70
+ uploadReflectionLadderParams(reflectionsEnabled: boolean): void;
71
+ // Debug controls. Drop the reflection term, or replace the surfel colour with one of the layers
72
+ // it is shaded from, numbered as RenderViewModes.h's AOV_* defines. setRenderView below sets
73
+ // the AOV together with the rest of a named view.
74
+ setReflectionsEnabled(enabled: boolean): void;
75
+ setDebugAovMode(mode: number): void;
59
76
  }
60
77
 
61
78
  export interface vec4 {
@@ -83,6 +100,10 @@ export interface SplatSet {
83
100
  sh2View(): Uint32Array;
84
101
  sh3aView(): Uint32Array;
85
102
  sh3bView(): Uint32Array;
103
+ // mod_depth is a half-float per primitive slot (dense, padded for non-surfels), so this is a
104
+ // Uint16Array unlike every other view here -- do not address it with the uint32 splat strides
105
+ // used for ellipsoids/colors/sh*.
106
+ modDepthView(): Uint16Array;
86
107
  // Per-chunk fade (opacity multiplier), one float per chunk, defaults to 1.0.
87
108
  // Also sizes the chunk slot to model root slot map below, since both are indexed by chunk slot
88
109
  resizeChunkFades(chunkCount: number): void;
@@ -102,12 +123,80 @@ export interface SplatSet {
102
123
  modelRootInverseTransformsView(): Float32Array;
103
124
  // Sized by resizeChunkFades. Defaults to slot 0 (identity) for every chunk
104
125
  chunkModelRootsView(): Int32Array;
126
+ // resizeModelRootSlots resets every slot to the absolute decode. False for a slot outside the table
127
+ setModelRootRootRelativeDecode(
128
+ slot: number,
129
+ originX: number,
130
+ originY: number,
131
+ originZ: number,
132
+ step: number,
133
+ ): boolean;
105
134
  // int32 render-order buffer (sized 2*splatCount after finalize). Valid only until the next resize.
106
135
  orderingView(): Int32Array;
107
136
  finalize(): void;
108
137
  // like finalize() but keeps splats in their delivered (octant-sorted) order — no kd-tree reorder —
109
138
  // so sparse-octant range masking can index child-octant ranges directly. RADIX_SORT only.
110
139
  finalizeBounds(): void;
140
+ // Whether the asset carries per-surfel reflectance records, which is what decides whether
141
+ // reflections are shaded at all. Pass to RenderState.uploadReflectionLadderParams.
142
+ hasReflectionParams(): boolean;
143
+ // Widens packed 26-byte reflectanceDataV1 records into the per-splat GPU records at
144
+ // bufferOffset. wirePtr must address THIS module's heap - _malloc here and copy the bytes in,
145
+ // since the attribute lives in the engine module's. Records cover a node's surfel range, which
146
+ // starts at its first splat. Returns the records written; 0 if the data was rejected.
147
+ decodeReflectionParams(
148
+ wirePtr: number,
149
+ wireSizeBytes: number,
150
+ elementCount: number,
151
+ bufferOffset: number,
152
+ nodeSplatCount: number,
153
+ logId: number,
154
+ ): number;
155
+ // Zeroes records in [startSplat, endSplat). Needed wherever splats are re-packed at fresh
156
+ // offsets, or a reused slot shades its splat from the previous occupant's material.
157
+ clearReflectionParams(startSplat: number, endSplat: number): void;
158
+ // Splats in [0, count) holding a non-zero record. Diagnostic.
159
+ populatedReflectionParamCount(count: number): number;
160
+ }
161
+
162
+ export interface GlassMeshRegistry {
163
+ // Decodes one octree node's glass payload and registers it, replacing any previous entry for
164
+ // that object. False for a malformed or empty payload, leaving the registry unchanged.
165
+ //
166
+ // The two slot arguments are different numbers here, unlike on the native path, and swapping
167
+ // them renders glass that does not follow its asset: modelRootSlot scopes the panel dedupe to
168
+ // one asset instance, while chunkModelRootIndex is stamped into every vertex and read back as
169
+ // chunkModelRoots[pos.w], so that one takes the chunk's fade slot.
170
+ //
171
+ // geometryPtr/panelPtr address THIS module's heap - _malloc here and copy the bytes in, since
172
+ // the attributes live in the engine module's. The AABB is the geometry attribute's own range.
173
+ registerObject(
174
+ objectId: number,
175
+ lodIndex: number,
176
+ modelRootSlot: number,
177
+ chunkModelRootIndex: number,
178
+ geometryPtr: number,
179
+ geometryByteCount: number,
180
+ panelPtr: number,
181
+ panelByteCount: number,
182
+ aabbMinX: number,
183
+ aabbMinY: number,
184
+ aabbMinZ: number,
185
+ aabbMaxX: number,
186
+ aabbMaxY: number,
187
+ aabbMaxZ: number,
188
+ ): boolean;
189
+ // Returns true if the object had glass, which is what says the buffers need rebuilding.
190
+ removeObject(objectId: number): boolean;
191
+ clear(): void;
192
+ isDirty(): boolean;
193
+ // Rebuilds the flattened buffers, keeping each panel from its deepest resident LOD. Stays dirty
194
+ // so uploadIfDirty still fires. Walks every registered object, so not per frame.
195
+ flattenIfDirty(): void;
196
+ uploadIfDirty(renderState: RenderState): void;
197
+ vertexCount(): number;
198
+ panelCount(): number;
199
+ delete(): void;
111
200
  }
112
201
 
113
202
  export interface WebGPUInterface {
@@ -120,6 +209,7 @@ export interface MainModule {
120
209
  Camera: new () => Camera;
121
210
  RenderState: new () => RenderState;
122
211
  SplatSet: new () => SplatSet;
212
+ GlassMeshRegistry: new () => GlassMeshRegistry;
123
213
  vec4: new (x: number, y: number, z: number, w: number) => vec4;
124
214
 
125
215
  SortType: {
@@ -157,6 +247,13 @@ export interface MainModule {
157
247
 
158
248
  WebGPU: WebGPUInterface;
159
249
 
250
+ // Emscripten runtime, exported by modules/shark/CMakeLists.txt. The pointer-taking bindings
251
+ // above address THIS heap, so bytes from the engine module have to be staged through it.
252
+ // HEAPU8 is replaced whenever the heap grows, so read it fresh rather than caching it.
253
+ _malloc(byteCount: number): number;
254
+ _free(ptr: number): void;
255
+ readonly HEAPU8: Uint8Array;
256
+
160
257
  uploadSplatSetData(
161
258
  set: SplatSet,
162
259
  renderState: RenderState,
@@ -192,6 +289,15 @@ export interface MainModule {
192
289
  depthTarget: number,
193
290
  renderGES: boolean,
194
291
  ): void;
292
+ // Render view registry, indexed as RenderViews.h orders it. setRenderView ignores an index
293
+ // Shark cannot produce.
294
+ setRenderView(viewIndex: number): void;
295
+ renderView(): number;
296
+ renderViewCount(): number;
297
+ renderViewName(viewIndex: number): string;
298
+ renderViewSupported(viewIndex: number): boolean;
299
+ // The next supported view, forwards for direction 1 and backwards for -1.
300
+ stepRenderView(from: number, direction: number): number;
195
301
  }
196
302
 
197
303
  declare function WebShark(