InternalCreates a GPUMemoryManager.
Shared renderer context used for WebGL access and config.
StaticitemEstimated per-item byte sizes managed by GPUMemoryManager.
Useful for debugging/telemetry and rough capacity planning.
Adds a SceneMesh to a batch and returns a GPUMemoryMeshHandle used for updates.
The handle contains:
gpuMemoryBatchIndex and meshIndex for addressing the meshnumIndices / numVertices counts for rendering/picking convenienceTarget batch index.
Mesh to add.
SDKInternalException If the batch index is invalid.
Notifies that a camera's view matrix was updated.
Forwards to GPUTileManager so per-tile per-view matrices can be recomputed/updated.
Creates and allocates a new GPU memory batch.
The created GPUMemoryBatch is appended to dataTextures.batches and DataTextures.onBatchCreated is dispatched.
SDKResult containing the new batch index, or ok:false if allocation fails.
Returns total GPU memory allocated by this manager in bytes.
Includes:
Returns draw parameters for a mesh in a given batch.
Intended to support WebGL drawArrays(first, count) style draws.
GPU batch index.
Mesh index within the batch.
Returns geometry for a given (batchIndex, geometryIndex) pair.
GPU batch index.
Geometry index within the batch.
Returns GPU memory usage in megabytes, derived from allocated/used byte totals.
Returns a mesh for a given (batchIndex, meshIndex) pair.
GPU batch index.
Mesh index within the batch.
Returns the current number of allocated tiles.
Returns total GPU memory currently used by this manager in bytes.
Includes:
Returns whether a batch has sufficient remaining space to add the given mesh.
Target batch index.
Mesh to test.
Allocates GPU memory and initializes tile-related data textures for this manager.
Creates:
viewTileCameraMatrixTexture[0..3] mapping tileIndex -> camera view matrix per viewviewTilePickMatrixTexture[0..3] mapping tileIndex -> pick matrix per viewSDKResult that is ok:true when initialization succeeds, or ok:false
when texture allocation fails (typically due to GPU memory limits).
Moves a tile (if required) so it contains the given world-space position.
The same tile if no move was needed, otherwise a different tile. When a different tile is returned, the old tile is released back to GPUTileManager.
Releases a tile back to the tile manager.
A tile is destroyed/recycled once it has been released as many times as it was acquired.
The tile to release.
Removes a SceneMesh.
Handle to the mesh to remove.
Re-encodes the per-batch pattern-table slots for a
SceneMaterial whose linePattern or hatchPattern
was just updated. Every batch that has allocated a slot
for this material on either its line-pattern or
hatch-pattern texture overwrites that slot with the new
entries; batches that don't reference the material at all
skip cheaply via a single Map.get.
Returns true when at least one batch re-encoded a slot,
which lets the caller decide whether to nudge a re-render
(the dirty texel buffer also drives an upload on next
frame).
Sets batch-wide (all-view) attributes for a mesh.
Mesh handle returned by addMesh.
Attribute parameters.
OptionaltileIndex?: numberOptional explicit tile index containing the mesh. This can change over time as the mesh moves between tiles.
SDKInternalException If the mesh handle references an invalid batch.
Updates the per-view clippable bit for a mesh — written
into the MeshViewAttributeTexture's second texel
(renderFlags.g) so the FS clip loop honours the new
state on the next frame.
Sets whether a mesh is culled in a given view. Independent of visibility — the batch draws a mesh only when it is visible and not culled.
Mesh handle returned by addMesh.
Target view index.
Cull flag.
SDKInternalException If the mesh handle references an invalid batch.
Sets the modeling transform matrix for a mesh.
The modeling transform is relative to the center of the mesh's current tile.
Mesh handle returned by addMesh.
Model matrix.
SDKInternalException If the mesh handle references an invalid batch.
Sets the render pass state for a mesh within a view.
Mesh handle returned by addMesh.
Target view index.
Render pass value to assign.
SDKInternalException If the mesh handle references an invalid batch.
Sets per-view attributes for a mesh.
Mesh handle returned by addMesh.
Target view index.
Per-view attributes.
Optionalclippable?: booleanWhether the mesh participates in clipping.
Optionalcolor?: Vec3RGB color encoded as bytes 0..255 (packed on upload).
Optionalopacity?: numberOpacity in range 0..1.
Optionalpickable?: booleanWhether the mesh can be picked.
SDKInternalException If the mesh handle references an invalid batch.
Sets whether a mesh is visible in a given view.
Mesh handle returned by addMesh.
Target view index.
Visibility flag.
SDKInternalException If the mesh handle references an invalid batch.
Walks every batch and re-uploads the SceneTexture's pixels into
any atlas that holds it. Returns true if at least one atlas
was refreshed.
Wired to the Scene.events.onSceneTextureImageDataChanged flow —
lets callers (e.g. the heat-map brush) mutate
SceneTexture.imageData in place and have the GPU side stay in
sync without a finalize/rebuild cycle.
Uploads all pending CPU-side changes to GPU textures/buffers.
This should be called once per frame (or tick) before rendering, after any state changes have been queued by higher-level managers.
Recreates GPU resources after a WebGL context restoration.
Forwards the restoration event to all GPU-backed resources owned by this manager.
SDKResult indicating success or failure.
SDKInternalException If called before init created the required resources.
Owns GPU-resident, dynamically editable storage for tiles, geometry, and mesh attributes.
Owned by a ViewManager, used by MeshManager, RenderManager, and PickManager.
GPUMemoryManagerimplements a data-texture + batch based memory system to support rendering and picking for large scenes with frequent updates.It is responsible for:
Tiled Coordinate System, RTC (Relative To Center), and GPU Matrix Textures
Large-scale 3D scenes require high-precision rendering, which is achieved by partitioning world space into "tiles". Each tile defines a local coordinate system centered at a specific world position, allowing geometry within the tile to be transformed relative to its center (RTC: Relative To Center). This approach minimizes floating-point precision errors when rendering large or distant objects.
Key Components
GPUTile:
GPUTileManager:
MatrixTexture:
DataTextures.viewTileCameraMatrixTexture:
DataTextures.viewTilePickMatrixTexture:
Matrix Conversion and GPU Upload
Shader Usage
Workflow Summary
Remarks