Skip to main content

Module tile_viewer

Module tile_viewer 

Source
Expand description

Debug-only standalone single-tile texture viewer (CelestialTileViewer): re-bakes one icosphere face’s surface detail into a W×W texture as the user zooms/pans, isolated from the clipmap. Excluded from release builds. Debug-only standalone single-tile texture viewer (CelestialTileViewer).

A flat 2-D view of ONE icosphere face’s baked surface colour, isolated from the clipmap/icosphere. The TileViewer compute shader bakes the SAME albedo

  • grass/rock detail as ChunkTileBake.slang over a SQUARE barycentric region of one face into a W×W rgba8 texture. Each scroll/pan re-dispatches the bake over a smaller/shifted barycentric window (no caching), so the user can see how the detail noise holds up as they zoom toward rock/grass scale.

Additive and read-only with respect to the production chunk path: it only reuses the shared shading code + TerrainGpu defaults. GPU work runs on the main RenderingDevice via RenderingServer::call_on_render_thread. The GPU resources live in a separate RefCounted [TileViewerJob] (the CEL-58 pattern): the render-thread callback borrows the job, not the node, so a synchronous call_on_render_thread can’t re-enter the node’s borrow.

Structs§

CelestialTileChunk
Debug node (mode B): one production chunk realized + baked + drawn flat-on.
CelestialTileViewer
Debug node driving the single-tile texture viewer. Exposed to the editor as a tool so the bundled debug/tile_viewer.tscn scene can run it standalone.
TileViewerJob
Render-thread job owning the viewer’s GPU resources + the pending view. A separate RefCounted so the render-thread callback never re-enters the node’s borrow (mirrors CesChunkJob).
TileViewerParams
std430 params for TileViewer.slang — byte-identical to struct TileViewerParams there (176 bytes). The tile_viewer_params_layout test locks the offsets. Field offsets: a 0, b 16, c 32, sub0 48, sub1 64, sub2 80, width 96, tex_res 100, terrain 112.