@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
114 lines (111 loc) • 5.75 kB
JavaScript
import { S as ShaderStore } from './index-MZPybX0H.esm.js';
import { s as sceneUboDeclarationWGSL } from './sceneUboDeclaration-F06dki1D.esm.js';
import { m as meshUboDeclarationWGSL } from './meshUboDeclaration-CCr-qXSL.esm.js';
import { h as helperFunctionsWGSL } from './helperFunctions-CiGzvr6_.esm.js';
import { c as clipPlaneVertexDeclarationWGSL, a as clipPlaneVertexWGSL } from './clipPlaneVertex-DrcLG8k3.esm.js';
import { f as fogVertexDeclarationWGSL, a as fogVertexWGSL } from './fogVertex-jAzZJUX3.esm.js';
import { l as logDepthDeclarationWGSL } from './logDepthDeclaration-BPJH8Xtb.esm.js';
import { g as gaussianSplattingWGSL } from './gaussianSplatting-CeyBcD1t.esm.js';
import { l as logDepthVertexWGSL } from './logDepthVertex-CRHdQPyM.esm.js';
// Do not edit.
const name = "gaussianSplattingVertexShader";
const shader = `
attribute splatIndex0: vec4f;attribute splatIndex1: vec4f;attribute splatIndex2: vec4f;attribute splatIndex3: vec4f;attribute position: vec3f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform minPixelSize: f32;uniform eyePosition: vec3f;uniform alpha: f32;
uniform partWorld: array<mat4x4<f32>,MAX_PART_COUNT>;uniform partVisibility: array<f32,MAX_PART_COUNT>;
var covariancesATexture: texture_2d<f32>;var covariancesBTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;
var sogQuatsTexture: texture_2d<f32>;uniform sogMeansMin: vec3f;uniform sogMeansMax: vec3f;
var sogCodebookTexture: texture_2d<f32>;
uniform sogScalesMin: vec3f;uniform sogScalesMax: vec3f;uniform sogSh0Min: vec4f;uniform sogSh0Max: vec4f;uniform sogShnMin: f32;uniform sogShnMax: f32;
var sogShNCentroidsTexture: texture_2d<f32>;var sogShNLabelsTexture: texture_2d<f32>;uniform sogShCoeffCount: f32;
var shTexture0: texture_2d<u32>;
var shTexture1: texture_2d<u32>;
var shTexture2: texture_2d<u32>;
var shTexture3: texture_2d<u32>;var shTexture4: texture_2d<u32>;
var partIndicesTexture: texture_2d<f32>;
varying vColor: vec4f;varying vPosition: vec2f;
@vertex
fn main(input : VertexInputs)->FragmentInputs {
let splatIndex: f32=getSplatIndex(i32(vertexInputs.position.z+0.5),vertexInputs.splatIndex0,vertexInputs.splatIndex1,vertexInputs.splatIndex2,vertexInputs.splatIndex3);var splat: Splat=readSplat(splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);
let splatWorld: mat4x4f=getPartWorld(splat.partIndex);
let splatWorld: mat4x4f=mesh.world;
let worldPos: vec4f=splatWorld*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=vertexInputs.position.xy;
let worldRot: mat3x3f= mat3x3f(splatWorld[0].xyz,splatWorld[1].xyz,splatWorld[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var eyeToSplatLocalSpace: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));
{let _row3=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),3),0);
let _so4=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),4),0).x;
let _so4: f32=1.0;
vertexOutputs.vColor=vec4f(_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4),splat.color.w*uniforms.alpha);}
vertexOutputs.vColor=vec4f(computeSH(splat,eyeToSplatLocalSpace),splat.color.w*uniforms.alpha);
vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace),splat.color.w*uniforms.alpha);
{let _shDc=textureLoad(dbgPartData,vec2i(i32(splat.partIndex),3),0).x;vertexOutputs.vColor=vec4f(_shDc*splat.color.xyz,splat.color.w*uniforms.alpha);}
vertexOutputs.vColor=vec4f(0.0,0.0,0.0,splat.color.w*uniforms.alpha);
vertexOutputs.vColor=vec4f(splat.color.xyz,splat.color.w*uniforms.alpha);
vertexOutputs.vColor.w*=uniforms.partVisibility[splat.partIndex];
var scale: vec2f=vec2f(1.,1.);
vertexOutputs.position=gaussianSplatting(vertexInputs.position.xy,worldPos.xyz,scale,covA,covB,splatWorld,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize,uniforms.minPixelSize);
}
`;
// Sideeffect
if (!ShaderStore.ShadersStoreWGSL[name]) {
ShaderStore.ShadersStoreWGSL[name] = shader;
}
const includes = [sceneUboDeclarationWGSL, meshUboDeclarationWGSL, helperFunctionsWGSL, clipPlaneVertexDeclarationWGSL, fogVertexDeclarationWGSL, logDepthDeclarationWGSL, gaussianSplattingWGSL, clipPlaneVertexWGSL, fogVertexWGSL, logDepthVertexWGSL];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
}
}
/** @internal */
const gaussianSplattingVertexShaderWGSL = { name, shader };
export { gaussianSplattingVertexShaderWGSL };
//# sourceMappingURL=gaussianSplatting.vertex-CtYcLQUG.esm.js.map