UNPKG

@playcanvas/splat-transform

Version:

Library and CLI tool for 3D Gaussian splat format conversion and transformation

30 lines (29 loc) 2.12 kB
import { UniformFormat } from 'playcanvas'; /** * Shared WGSL declaration of the `struct Uniforms` block consumed by * every per-render compute shader (project, prefix-sum, emit-pairs, * init-tile-offsets, find-boundaries, rasterize-binned, finalize). The * matching JS layout produced by {@link uniformFormatEntries} sits * immediately below — when one changes the other must change in * lock-step. The pad fields keep f32 triples 16-byte aligned per * WGSL's uniform storage rules. * * Included into each consuming shader via the engine's WGSL preprocessor: * `#include "uniformsStruct"` at the top of the shader source replaces * the directive with the full struct declaration. See * `playcanvas/src/platform/graphics/shader.js` for the preprocessor * wiring (the `cincludes` Map on the `Shader` constructor's definition). */ declare const uniformsStruct = "\nstruct Uniforms {\n rightX: f32, rightY: f32, rightZ: f32, _p0: f32,\n downX: f32, downY: f32, downZ: f32, _p1: f32,\n forwardX: f32, forwardY: f32, forwardZ: f32, _p2: f32,\n eyeX: f32, eyeY: f32, eyeZ: f32, _p3: f32,\n focalX: f32, focalY: f32, near: f32, _p4: f32,\n focusDistance: f32, apertureScale: f32, _p5: f32, _p6: f32,\n imageWidth: u32, imageHeight: u32, splatStride: u32, chunkSize: u32,\n groupPixelMinX: u32, groupPixelMinY: u32, groupPixelMaxX: u32, groupPixelMaxY: u32,\n groupTilesX: u32, groupTilesY: u32, groupPixelOriginX: u32, groupPixelOriginY: u32,\n bgR: f32, bgG: f32, bgB: f32, bgA: f32,\n}\n"; /** * Build the {@link UniformFormat} entries describing the WGSL `struct * Uniforms` block above, in declaration order. The PlayCanvas * UniformBuffer machinery expects a JS-side description that matches the * shader's uniform layout exactly; this function is the single source of * truth for that JS-side description and is consumed by every compute * shader that binds the shared Uniforms struct. * * @returns Array of UniformFormat entries in declaration order. */ declare const uniformFormatEntries: () => UniformFormat[]; export { uniformsStruct, uniformFormatEntries };