@miris-inc/core 0.0.8-c42bedf → 0.0.8-c560ed8

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-c42bedf",
3
+ "version": "0.0.8-c560ed8",
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 (0 off, 1 world normals, 2 reflectance, 3 roughness, 4 reflection,
73
+ // 6 base colour, 18 surfel index).
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;
@@ -108,6 +129,66 @@ export interface SplatSet {
108
129
  // like finalize() but keeps splats in their delivered (octant-sorted) order — no kd-tree reorder —
109
130
  // so sparse-octant range masking can index child-octant ranges directly. RADIX_SORT only.
110
131
  finalizeBounds(): void;
132
+ // Whether the asset carries per-surfel reflectance records, which is what decides whether
133
+ // reflections are shaded at all. Pass to RenderState.uploadReflectionLadderParams.
134
+ hasReflectionParams(): boolean;
135
+ // Widens packed 26-byte reflectanceDataV1 records into the per-splat GPU records at
136
+ // bufferOffset. wirePtr must address THIS module's heap - _malloc here and copy the bytes in,
137
+ // since the attribute lives in the engine module's. Records cover a node's surfel range, which
138
+ // starts at its first splat. Returns the records written; 0 if the data was rejected.
139
+ decodeReflectionParams(
140
+ wirePtr: number,
141
+ wireSizeBytes: number,
142
+ elementCount: number,
143
+ bufferOffset: number,
144
+ nodeSplatCount: number,
145
+ logId: number,
146
+ ): number;
147
+ // Zeroes records in [startSplat, endSplat). Needed wherever splats are re-packed at fresh
148
+ // offsets, or a reused slot shades its splat from the previous occupant's material.
149
+ clearReflectionParams(startSplat: number, endSplat: number): void;
150
+ // Splats in [0, count) holding a non-zero record. Diagnostic.
151
+ populatedReflectionParamCount(count: number): number;
152
+ }
153
+
154
+ export interface GlassMeshRegistry {
155
+ // Decodes one octree node's glass payload and registers it, replacing any previous entry for
156
+ // that object. False for a malformed or empty payload, leaving the registry unchanged.
157
+ //
158
+ // The two slot arguments are different numbers here, unlike on the native path, and swapping
159
+ // them renders glass that does not follow its asset: modelRootSlot scopes the panel dedupe to
160
+ // one asset instance, while chunkModelRootIndex is stamped into every vertex and read back as
161
+ // chunkModelRoots[pos.w], so that one takes the chunk's fade slot.
162
+ //
163
+ // geometryPtr/panelPtr address THIS module's heap - _malloc here and copy the bytes in, since
164
+ // the attributes live in the engine module's. The AABB is the geometry attribute's own range.
165
+ registerObject(
166
+ objectId: number,
167
+ lodIndex: number,
168
+ modelRootSlot: number,
169
+ chunkModelRootIndex: number,
170
+ geometryPtr: number,
171
+ geometryByteCount: number,
172
+ panelPtr: number,
173
+ panelByteCount: number,
174
+ aabbMinX: number,
175
+ aabbMinY: number,
176
+ aabbMinZ: number,
177
+ aabbMaxX: number,
178
+ aabbMaxY: number,
179
+ aabbMaxZ: number,
180
+ ): boolean;
181
+ // Returns true if the object had glass, which is what says the buffers need rebuilding.
182
+ removeObject(objectId: number): boolean;
183
+ clear(): void;
184
+ isDirty(): boolean;
185
+ // Rebuilds the flattened buffers, keeping each panel from its deepest resident LOD. Stays dirty
186
+ // so uploadIfDirty still fires. Walks every registered object, so not per frame.
187
+ flattenIfDirty(): void;
188
+ uploadIfDirty(renderState: RenderState): void;
189
+ vertexCount(): number;
190
+ panelCount(): number;
191
+ delete(): void;
111
192
  }
112
193
 
113
194
  export interface WebGPUInterface {
@@ -120,6 +201,7 @@ export interface MainModule {
120
201
  Camera: new () => Camera;
121
202
  RenderState: new () => RenderState;
122
203
  SplatSet: new () => SplatSet;
204
+ GlassMeshRegistry: new () => GlassMeshRegistry;
123
205
  vec4: new (x: number, y: number, z: number, w: number) => vec4;
124
206
 
125
207
  SortType: {
@@ -157,6 +239,13 @@ export interface MainModule {
157
239
 
158
240
  WebGPU: WebGPUInterface;
159
241
 
242
+ // Emscripten runtime, exported by modules/shark/CMakeLists.txt. The pointer-taking bindings
243
+ // above address THIS heap, so bytes from the engine module have to be staged through it.
244
+ // HEAPU8 is replaced whenever the heap grows, so read it fresh rather than caching it.
245
+ _malloc(byteCount: number): number;
246
+ _free(ptr: number): void;
247
+ readonly HEAPU8: Uint8Array;
248
+
160
249
  uploadSplatSetData(
161
250
  set: SplatSet,
162
251
  renderState: RenderState,