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) 4.28 kB
import{S as e}from"./index-BPURObVq.esm.min.js";import{g as n,a as o,b as i}from"./gaussianSplatting-C91gccOg.esm.min.js";import{s as a}from"./sceneUboDeclaration-De4jS-Et.esm.min.js";import{m as r}from"./meshUboDeclaration-7dyMOx3r.esm.min.js";import{c as t,a as s}from"./clipPlaneVertex-DrbRp_6Q.esm.min.js";import{f as l,a as f}from"./fogVertex-CbddD2pe.esm.min.js";import{l as m}from"./logDepthDeclaration-D8y4De99.esm.min.js";import{h as p}from"./helperFunctions-Sht42MtG.esm.min.js";import{l as c}from"./logDepthVertex-C_c4pzf4.esm.min.js";const d="gaussianSplattingVertexShader",S="#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\nuniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform float minPixelSize;uniform vec3 eyePosition;uniform float alpha;\n#if IS_COMPOUND\nuniform mat4 partWorld[MAX_PART_COUNT];uniform float partVisibility[MAX_PART_COUNT];\n#endif\nuniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#ifdef USE_SOG\nuniform sampler2D sogQuatsTexture;uniform vec3 sogMeansMin;uniform vec3 sogMeansMax;\n#ifdef USE_SOG_V2\nuniform sampler2D sogCodebookTexture; \n#else\nuniform vec3 sogScalesMin;uniform vec3 sogScalesMax;uniform vec4 sogSh0Min;uniform vec4 sogSh0Max;uniform float sogShnMin;uniform float sogShnMax;\n#endif\n#if SH_DEGREE>0\nuniform sampler2D sogShNCentroidsTexture;uniform sampler2D sogShNLabelsTexture;uniform float sogShCoeffCount;\n#endif\n#endif\n#if SH_DEGREE>0 && !defined(USE_SOG)\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1 && !defined(USE_SOG)\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2 && !defined(USE_SOG)\nuniform highp usampler2D shTexture2;\n#endif\n#if SH_DEGREE>3 && !defined(USE_SOG)\nuniform highp usampler2D shTexture3;uniform highp usampler2D shTexture4;\n#endif\n#if IS_COMPOUND\nuniform sampler2D partIndicesTexture;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#define CUSTOM_VERTEX_DEFINITIONS\n#include<gaussianSplatting>\nvoid main () {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nfloat 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);\n#if IS_COMPOUND\nmat4 splatWorld=getPartWorld(splat.partIndex);\n#else\nmat4 splatWorld=world;\n#endif\nvec4 worldPos=splatWorld*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));\n#if defined(GS_DBG_ENABLED) && IS_COMPOUND\n{vec4 _row3=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0);\n#if SH_DEGREE>3\nfloat _so4=texelFetch(dbgPartData,ivec2(int(splat.partIndex),4),0).x;\n#else\nfloat _so4=1.0;\n#endif\nvColor.xyz=_row3.x*splat.color.xyz+computeSHWeighted(splat,eyeToSplatLocalSpace,_row3.y,_row3.z,_row3.w,_so4);}\n#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0\nvColor.xyz=computeSH(splat,eyeToSplatLocalSpace);\n#else\nvColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);\n#endif\n#else\n#if defined(GS_DBG_ENABLED) && IS_COMPOUND\n{float _shDc=texelFetch(dbgPartData,ivec2(int(splat.partIndex),3),0).x;vColor.xyz=_shDc*splat.color.xyz;}\n#elif defined(GS_DBG_ENABLED) && GS_DBG_SH_DC==0\nvColor.xyz=vec3(0.0);\n#endif\n#endif\nvColor.w*=alpha;\n#if IS_COMPOUND\nvColor.w*=partVisibility[splat.partIndex];\n#endif\nvec2 scale=vec2(1.,1.);\n#define CUSTOM_VERTEX_UPDATE\ngl_Position=gaussianSplatting(position.xy,worldPos.xyz,scale,covA,covB,splatWorld,view,projection);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";e.ShadersStore[d]||(e.ShadersStore[d]=S);const u=[n,a,r,o,t,l,m,p,i,s,f,c];for(const n of u)e.IncludesShadersStore[n.name]||(e.IncludesShadersStore[n.name]=n.shader);const _={name:d,shader:S};export{_ as gaussianSplattingVertexShader}; //# sourceMappingURL=gaussianSplatting.vertex-BYGTT-cn.esm.min.js.map