@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) • 4.9 kB
JavaScript
import { S as ShaderStore } from './index-MZPybX0H.esm.js';
import { g as gaussianSplattingVertexDeclaration, a as gaussianSplattingUboDeclaration, b as gaussianSplatting } from './gaussianSplatting-B1z0qJ8N.esm.js';
import { s as sceneUboDeclaration } from './sceneUboDeclaration-D-TsHbOr.esm.js';
import { m as meshUboDeclaration } from './meshUboDeclaration-Bv_BtoSy.esm.js';
import { c as clipPlaneVertexDeclaration, a as clipPlaneVertex } from './clipPlaneVertex-DpLNqQi1.esm.js';
import { f as fogVertexDeclaration, a as fogVertex } from './fogVertex-DcP6EK01.esm.js';
import { l as logDepthDeclaration } from './logDepthDeclaration-BdXvBJD5.esm.js';
import { h as helperFunctions } from './helperFunctions-BVaVsPjM.esm.js';
import { l as logDepthVertex } from './logDepthVertex-Bf89Lbuy.esm.js';
// Do not edit.
const name = "gaussianSplattingVertexShader";
const shader = `
uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform float minPixelSize;uniform vec3 eyePosition;uniform float alpha;
uniform mat4 partWorld[MAX_PART_COUNT];uniform float partVisibility[MAX_PART_COUNT];
uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
uniform sampler2D sogQuatsTexture;uniform vec3 sogMeansMin;uniform vec3 sogMeansMax;
uniform sampler2D sogCodebookTexture;
uniform vec3 sogScalesMin;uniform vec3 sogScalesMax;uniform vec4 sogSh0Min;uniform vec4 sogSh0Max;uniform float sogShnMin;uniform float sogShnMax;
uniform sampler2D sogShNCentroidsTexture;uniform sampler2D sogShNLabelsTexture;uniform float sogShCoeffCount;
uniform highp usampler2D shTexture0;
uniform highp usampler2D shTexture1;
uniform highp usampler2D shTexture2;
uniform highp usampler2D shTexture3;uniform highp usampler2D shTexture4;
uniform sampler2D partIndicesTexture;
varying vec4 vColor;varying vec2 vPosition;
void main () {
float splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);
mat4 splatWorld=getPartWorld(splat.partIndex);
mat4 splatWorld=world;
vec4 worldPos=splatWorld*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;
mat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));
{vec4 _row3=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0);
float _so4=texelFetch(dbgPartData,ivec2(int(splat.partIndex),4),0).x;
float _so4=1.0;
vColor.xyz=_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4);}
vColor.xyz=computeSH(splat,eyeToSplatLocalSpace);
vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);
{float _shDc=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0).x;vColor.xyz=_shDc*splat.color.xyz;}
vColor.xyz=vec3(0.0);
vColor.w*=alpha;
vColor.w*=partVisibility[splat.partIndex];
vec2 scale=vec2(1.,1.);
gl_Position=gaussianSplatting(position.xy,worldPos.xyz,scale,covA,covB,splatWorld,view,projection);
}
`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
const includes = [gaussianSplattingVertexDeclaration, sceneUboDeclaration, meshUboDeclaration, gaussianSplattingUboDeclaration, clipPlaneVertexDeclaration, fogVertexDeclaration, logDepthDeclaration, helperFunctions, gaussianSplatting, clipPlaneVertex, fogVertex, logDepthVertex];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStore[inc.name]) {
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
}
}
/** @internal */
const gaussianSplattingVertexShader = { name, shader };
export { gaussianSplattingVertexShader };
//# sourceMappingURL=gaussianSplatting.vertex-D4aTex5H.esm.js.map