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.

3 lines (2 loc) 2.75 kB
import{S as t}from"./index-BPURObVq.esm.min.js";import{s as e}from"./sceneUboDeclaration-BlOB2RUY.esm.min.js";import{m as r}from"./meshUboDeclaration-CnWBjnGc.esm.min.js";import{g as n}from"./gaussianSplatting-Bl_Q-cP-.esm.min.js";const a="gaussianSplattingVoxelVertexShader",i="#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\nattribute 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;\n#if IS_COMPOUND\nuniform partWorld: array<mat4x4<f32>,MAX_PART_COUNT>;uniform partVisibility: array<f32,MAX_PART_COUNT>;\n#endif\nvar rotationsATexture: texture_2d<f32>;var rotationsBTexture: texture_2d<f32>;var rotationScaleTexture: texture_2d<f32>;var centersTexture: texture_2d<f32>;var colorsTexture: texture_2d<f32>;\n#if IS_COMPOUND\nvar partIndicesTexture: texture_2d<f32>;\n#endif\nvarying vNormalizedPosition: vec3f;varying vNormalizedCenterPosition: vec3f;varying vAlpha: f32;varying vPatchPosition: vec2f;\n#include<gaussianSplatting>\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {let splatIndex: f32=getSplatIndex(\ni32(vertexInputs.position.z+0.5),\nvertexInputs.splatIndex0,vertexInputs.splatIndex1,\nvertexInputs.splatIndex2,vertexInputs.splatIndex3\n);var splat: Splat=readSplat(splatIndex,uniforms.dataTextureSize);\n#if IS_COMPOUND\nif (uniforms.partVisibility[splat.partIndex]==0.0) {vertexOutputs.position=vec4f(2.0,2.0,2.0,1.0);return vertexOutputs;}\nlet splatWorld: mat4x4f=getPartWorld(splat.partIndex);\n#else\nlet splatWorld: mat4x4f=mesh.world;\n#endif\nlet 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;\n#if IS_COMPOUND\nvertexOutputs.vAlpha*=uniforms.partVisibility[splat.partIndex];\n#endif\nvertexOutputs.vPatchPosition=quadPos;}\n";t.ShadersStoreWGSL[a]||(t.ShadersStoreWGSL[a]=i);const s=[e,r,n];for(const e of s)t.IncludesShadersStoreWGSL[e.name]||(t.IncludesShadersStoreWGSL[e.name]=e.shader);const o={name:a,shader:i};export{o as gaussianSplattingVoxelVertexShaderWGSL}; //# sourceMappingURL=gaussianSplattingVoxel.vertex-DwlQqEsS.esm.min.js.map