playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
42 lines (34 loc) • 1.42 kB
JavaScript
var gsplatStructsVS = /* glsl */ `
// Shared splat identification (index, uv) and setSplat() helper
// stores the render order and corner for this vertex
struct SplatSource {
uint order; // render order
vec2 cornerUV; // corner coordinates for this vertex of the gaussian (-1, -1)..(1, 1)
};
// stores the camera and clip space position of the gaussian center
struct SplatCenter {
vec3 view; // center in view space
vec4 proj; // center in clip space
mat4 modelView; // model-view matrix
float projMat00; // element [0][0] of the projection matrix
vec3 modelCenterOriginal; // original model center before modification
vec3 modelCenterModified; // model center after modification
float fisheyeSinTK; // sin(theta / k), shared with corner shader
float fisheyeCosTK; // cos(theta / k), shared with corner shader
float fisheyeRxy; // length(v.xy), shared with corner shader
};
// stores the offset from center for the current gaussian
struct SplatCorner {
vec3 offset; // corner offset (clip XY for 3DGS, model XYZ for 2DGS)
vec2 uv; // corner uv
float aaFactor; // for scenes generated with antialiasing
vec2 v;
float dlen;
};
`;
export { gsplatStructsVS as default };