UNPKG

@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.

53 lines (50 loc) 3.09 kB
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 { g as gaussianSplattingWGSL } from './gaussianSplatting-CeyBcD1t.esm.js'; // Do not edit. const name = "gaussianSplattingVoxelVertexShader"; const shader = `#include<sceneUboDeclaration> #include<meshUboDeclaration> attribute splatIndex0: vec4f;attribute splatIndex1: vec4f;attribute splatIndex2: vec4f;attribute splatIndex3: vec4f;attribute position: vec3f;uniform dataTextureSize: vec2f;uniform alpha: f32;uniform invWorldScale: mat4x4f;uniform viewMatrix: mat4x4f; #if IS_COMPOUND uniform partWorld: array<mat4x4<f32>,MAX_PART_COUNT>;uniform partVisibility: array<f32,MAX_PART_COUNT>; #endif var rotationsATexture: texture_2d<f32>;var rotationsBTexture: texture_2d<f32>;var rotationScaleTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>; #if IS_COMPOUND var partIndicesTexture: texture_2d<f32>; #endif varying vNormalizedPosition: vec3f;varying vNormalizedCenterPosition: vec3f;varying vAlpha: f32;varying vPatchPosition: vec2f; #include<gaussianSplatting> @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); #if IS_COMPOUND if (uniforms.partVisibility[splat.partIndex]==0.0) {vertexOutputs.position=vec4f(2.0,2.0,2.0,1.0);return vertexOutputs;} let splatWorld: mat4x4f=getPartWorld(splat.partIndex); #else let splatWorld: mat4x4f=mesh.world; #endif let quadPos: vec2f=vertexInputs.position.xy;let worldPos: vec4f=computeVoxelSplatWorldPos(splat.rotationA,splat.rotationB,splat.rotationScale,splat.center.xyz,splatWorld,uniforms.viewMatrix,uniforms.invWorldScale,quadPos);vertexOutputs.vNormalizedPosition=(uniforms.invWorldScale*worldPos).xyz*0.5+0.5;let clipPos: vec4f=uniforms.viewMatrix*uniforms.invWorldScale*worldPos;vertexOutputs.position=vec4f(clipPos.x,clipPos.y,clipPos.z*0.5+0.5,1.0);vertexOutputs.vNormalizedCenterPosition=(uniforms.invWorldScale*splatWorld*vec4f(splat.center.xyz,1.0)).xyz*0.5+0.5;vertexOutputs.vAlpha=splat.color.w*uniforms.alpha; #if IS_COMPOUND vertexOutputs.vAlpha*=uniforms.partVisibility[splat.partIndex]; #endif vertexOutputs.vPatchPosition=quadPos;} `; // Sideeffect if (!ShaderStore.ShadersStoreWGSL[name]) { ShaderStore.ShadersStoreWGSL[name] = shader; } const includes = [sceneUboDeclarationWGSL, meshUboDeclarationWGSL, gaussianSplattingWGSL]; for (const inc of includes) { if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) { ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader; } } /** @internal */ const gaussianSplattingVoxelVertexShaderWGSL = { name, shader }; export { gaussianSplattingVoxelVertexShaderWGSL }; //# sourceMappingURL=gaussianSplattingVoxel.vertex-CgUbzjJb.esm.js.map