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.

253 lines (248 loc) 10.5 kB
import { S as ShaderStore } from './index-MZPybX0H.esm.js'; import { d as decalVertexDeclaration, u as uvAttributeDeclaration, p as prePassVertexDeclaration, s as samplerVertexDeclaration, a as prePassVertex, b as uvVariableDeclaration, c as samplerVertexImplementation } from './samplerVertexImplementation-SyjrTaCQ.esm.js'; import { s as sceneUboDeclaration } from './sceneUboDeclaration-D-TsHbOr.esm.js'; import { m as meshUboDeclaration } from './meshUboDeclaration-Bv_BtoSy.esm.js'; import { d as defaultUboDeclaration } from './defaultUboDeclaration-CtwsKbM_.esm.js'; import { h as helperFunctions } from './helperFunctions-BVaVsPjM.esm.js'; import { b as bonesDeclaration, a as bakedVertexAnimationDeclaration, i as instancesVertex, c as bonesVertex, d as bakedVertexAnimation } from './bakedVertexAnimation-wpiWOSwD.esm.js'; import { i as instancesDeclaration } from './instancesDeclaration-BsiN991H.esm.js'; import { m as mainUVVaryingDeclaration } from './mainUVVaryingDeclaration-Bm0UsfVq.esm.js'; import { b as bumpVertexDeclaration } from './bumpVertexDeclaration-BskwVZKJ.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 lightVxFragmentDeclaration, a as lightVxUboDeclaration, s as shadowsVertex } from './shadowsVertex-BA-1OlXD.esm.js'; import { m as morphTargetsVertexGlobalDeclaration, a as morphTargetsVertexDeclaration, b as morphTargetsVertexGlobal, c as morphTargetsVertex } from './morphTargetsVertex-BRsti3ha.esm.js'; import { l as logDepthDeclaration } from './logDepthDeclaration-BdXvBJD5.esm.js'; import { b as bumpVertex } from './bumpVertex-eKH8yilz.esm.js'; import { v as vertexColorMixing } from './vertexColorMixing-CuklZfs4.esm.js'; import { l as logDepthVertex } from './logDepthVertex-Bf89Lbuy.esm.js'; // Do not edit. const name$2 = "defaultVertexDeclaration"; const shader$2 = `uniform mat4 viewProjection; #ifdef MULTIVIEW mat4 viewProjectionR; #endif uniform mat4 view; #ifdef DIFFUSE uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos; #endif #ifdef AMBIENT uniform mat4 ambientMatrix;uniform vec2 vAmbientInfos; #endif #ifdef OPACITY uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos; #endif #ifdef EMISSIVE uniform vec2 vEmissiveInfos;uniform mat4 emissiveMatrix; #endif #ifdef LIGHTMAP uniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix; #endif #if defined(SPECULAR) && defined(SPECULARTERM) uniform vec2 vSpecularInfos;uniform mat4 specularMatrix; #endif #ifdef BUMP uniform vec3 vBumpInfos;uniform mat4 bumpMatrix; #endif #ifdef REFLECTION uniform mat4 reflectionMatrix; #endif #ifdef POINTSIZE uniform float pointSize; #endif #ifdef DETAIL uniform vec4 vDetailInfos;uniform mat4 detailMatrix; #endif uniform vec4 cameraInfo;uniform vec4 vTextureRepetitionHexTilingParams; #include<decalVertexDeclaration> #define ADDITIONAL_VERTEX_DECLARATION `; // Sideeffect if (!ShaderStore.IncludesShadersStore[name$2]) { ShaderStore.IncludesShadersStore[name$2] = shader$2; } /** @internal */ const defaultVertexDeclaration = { name: name$2, shader: shader$2 }; // Do not edit. const name$1 = "pointCloudVertex"; const shader$1 = `#if defined(POINTSIZE) && !defined(WEBGPU) gl_PointSize=pointSize; #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStore[name$1]) { ShaderStore.IncludesShadersStore[name$1] = shader$1; } /** @internal */ const pointCloudVertex = { name: name$1, shader: shader$1 }; // Do not edit. const name = "defaultVertexShader"; const shader = `#define CUSTOM_VERTEX_EXTENSION #include<__decl__defaultVertex> #define CUSTOM_VERTEX_BEGIN attribute vec3 position; #ifdef NORMAL attribute vec3 normal; #endif #ifdef TANGENT attribute vec4 tangent; #endif #ifdef UV1 attribute vec2 uv; #endif #include<uvAttributeDeclaration>[2..7] #ifdef VERTEXCOLOR attribute vec4 color; #endif #include<helperFunctions> #include<bonesDeclaration> #include<bakedVertexAnimationDeclaration> #include<instancesDeclaration> #include<prePassVertexDeclaration> #include<mainUVVaryingDeclaration>[1..7] #include<samplerVertexDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse) #include<samplerVertexDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) #include<samplerVertexDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) #include<samplerVertexDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) #include<samplerVertexDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive) #include<samplerVertexDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap) #if defined(SPECULARTERM) #include<samplerVertexDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular) #endif #include<samplerVertexDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump) #include<samplerVertexDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) varying vec3 vPositionW; #ifdef NORMAL varying vec3 vNormalW; #endif #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) varying vec4 vColor; #endif #include<bumpVertexDeclaration> #include<clipPlaneVertexDeclaration> #include<fogVertexDeclaration> #include<__decl__lightVxFragment>[0..maxSimultaneousLights] #include<morphTargetsVertexGlobalDeclaration> #include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets] #ifdef REFLECTIONMAP_SKYBOX varying vec3 vPositionUVW; #endif #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) varying vec3 vDirectionW; #endif #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 varying float vViewDepth; #endif #include<logDepthDeclaration> #define CUSTOM_VERTEX_DEFINITIONS void main(void) { #define CUSTOM_VERTEX_MAIN_BEGIN vec3 positionUpdated=position; #ifdef NORMAL vec3 normalUpdated=normal; #endif #ifdef TANGENT vec4 tangentUpdated=tangent; #endif #ifdef UV1 vec2 uvUpdated=uv; #endif #ifdef UV2 vec2 uv2Updated=uv2; #endif #ifdef VERTEXCOLOR vec4 colorUpdated=color; #endif #include<morphTargetsVertexGlobal> #include<morphTargetsVertex>[0..maxSimultaneousMorphTargets] #ifdef REFLECTIONMAP_SKYBOX vPositionUVW=positionUpdated; #endif #define CUSTOM_VERTEX_UPDATE_POSITION #define CUSTOM_VERTEX_UPDATE_NORMAL #include<instancesVertex> #if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0); #endif #include<bonesVertex> #include<bakedVertexAnimation> vec4 worldPos=finalWorld*vec4(positionUpdated,1.0); #ifdef NORMAL mat3 normalWorld=mat3(finalWorld); #if defined(INSTANCES) && defined(THIN_INSTANCES) vNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW); #else #ifdef NONUNIFORMSCALING normalWorld=transposeMat3(inverseMat3(normalWorld)); #endif vNormalW=normalize(normalWorld*normalUpdated); #endif #endif #define CUSTOM_VERTEX_UPDATE_WORLDPOS #ifdef MULTIVIEW if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;} #else gl_Position=viewProjection*worldPos; #endif vPositionW=vec3(worldPos); #ifdef PREPASS #include<prePassVertex> #endif #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0))); #endif #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 #ifdef RIGHT_HANDED vViewDepth=-(view*worldPos).z; #else vViewDepth=(view*worldPos).z; #endif #endif #ifndef UV1 vec2 uvUpdated=vec2(0.,0.); #endif #ifndef UV2 vec2 uv2Updated=vec2(0.,0.); #endif #ifdef MAINUV1 vMainUV1=uvUpdated; #endif #ifdef MAINUV2 vMainUV2=uv2Updated; #endif #include<uvVariableDeclaration>[3..7] #include<samplerVertexImplementation>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x) #include<samplerVertexImplementation>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) #include<samplerVertexImplementation>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) #include<samplerVertexImplementation>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) #include<samplerVertexImplementation>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x) #include<samplerVertexImplementation>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x) #if defined(SPECULARTERM) #include<samplerVertexImplementation>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x) #endif #include<samplerVertexImplementation>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x) #include<samplerVertexImplementation>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) #include<bumpVertex> #include<clipPlaneVertex> #include<fogVertex> #include<shadowsVertex>[0..maxSimultaneousLights] #include<vertexColorMixing> #include<pointCloudVertex> #include<logDepthVertex> #define CUSTOM_VERTEX_MAIN_END } `; // Sideeffect if (!ShaderStore.ShadersStore[name]) { ShaderStore.ShadersStore[name] = shader; } const includes = [decalVertexDeclaration, defaultVertexDeclaration, sceneUboDeclaration, meshUboDeclaration, defaultUboDeclaration, uvAttributeDeclaration, helperFunctions, bonesDeclaration, bakedVertexAnimationDeclaration, instancesDeclaration, prePassVertexDeclaration, mainUVVaryingDeclaration, samplerVertexDeclaration, bumpVertexDeclaration, clipPlaneVertexDeclaration, fogVertexDeclaration, lightVxFragmentDeclaration, lightVxUboDeclaration, morphTargetsVertexGlobalDeclaration, morphTargetsVertexDeclaration, logDepthDeclaration, morphTargetsVertexGlobal, morphTargetsVertex, instancesVertex, bonesVertex, bakedVertexAnimation, prePassVertex, uvVariableDeclaration, samplerVertexImplementation, bumpVertex, clipPlaneVertex, fogVertex, shadowsVertex, vertexColorMixing, pointCloudVertex, logDepthVertex]; for (const inc of includes) { if (!ShaderStore.IncludesShadersStore[inc.name]) { ShaderStore.IncludesShadersStore[inc.name] = inc.shader; } } /** @internal */ const defaultVertexShader = { name, shader }; export { defaultVertexShader }; //# sourceMappingURL=default.vertex-S7PQYSXP.esm.js.map