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.

57 lines (54 loc) 3.04 kB
import { S as ShaderStore } from './index-MZPybX0H.esm.js'; import { m as mrtFragmentDeclaration } from './mrtFragmentDeclaration-CK4LPOcC.esm.js'; // Do not edit. const name = "iblVoxelGridPixelShader"; const shader = `#extension GL_EXT_draw_buffers : require precision highp float;varying vec3 vNormalizedPosition; #include<mrtFragmentDeclaration>[MAX_DRAW_BUFFERS] uniform float nearPlane;uniform float farPlane;uniform float stepSize;void main(void) {vec3 normPos=vNormalizedPosition.xyz;if (normPos.z<nearPlane || normPos.z>farPlane) {discard;} glFragData[0]=normPos.z<nearPlane+stepSize ? vec4(1.0) : vec4(0.0); #if MAX_DRAW_BUFFERS>1 glFragData[1]=normPos.z>=nearPlane+stepSize && normPos.z<nearPlane+2.0*stepSize ? vec4(1.0) : vec4(0.0);glFragData[2]=normPos.z>=nearPlane+2.0*stepSize && normPos.z<nearPlane+3.0*stepSize ? vec4(1.0) : vec4(0.0);glFragData[3]=normPos.z>=nearPlane+3.0*stepSize && normPos.z<nearPlane+4.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>4 glFragData[4]=normPos.z>=nearPlane+4.0*stepSize && normPos.z<nearPlane+5.0*stepSize ? vec4(1.0) : vec4(0.0);glFragData[5]=normPos.z>=nearPlane+5.0*stepSize && normPos.z<nearPlane+6.0*stepSize ? vec4(1.0) : vec4(0.0);glFragData[6]=normPos.z>=nearPlane+6.0*stepSize && normPos.z<nearPlane+7.0*stepSize ? vec4(1.0) : vec4(0.0);glFragData[7]=normPos.z>=nearPlane+7.0*stepSize && normPos.z<nearPlane+8.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>8 glFragData[8]=normPos.z>=nearPlane+8.0*stepSize && normPos.z<nearPlane+9.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>9 glFragData[9]=normPos.z>=nearPlane+9.0*stepSize && normPos.z<nearPlane+10.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>10 glFragData[10]=normPos.z>=nearPlane+10.0*stepSize && normPos.z<nearPlane+11.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>11 glFragData[11]=normPos.z>=nearPlane+11.0*stepSize && normPos.z<nearPlane+12.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>12 glFragData[12]=normPos.z>=nearPlane+12.0*stepSize && normPos.z<nearPlane+13.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>13 glFragData[13]=normPos.z>=nearPlane+13.0*stepSize && normPos.z<nearPlane+14.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>14 glFragData[14]=normPos.z>=nearPlane+14.0*stepSize && normPos.z<nearPlane+15.0*stepSize ? vec4(1.0) : vec4(0.0); #endif #if MAX_DRAW_BUFFERS>15 glFragData[15]=normPos.z>=nearPlane+15.0*stepSize && normPos.z<nearPlane+16.0*stepSize ? vec4(1.0) : vec4(0.0); #endif }`; // Sideeffect if (!ShaderStore.ShadersStore[name]) { ShaderStore.ShadersStore[name] = shader; } const includes = [mrtFragmentDeclaration]; for (const inc of includes) { if (!ShaderStore.IncludesShadersStore[inc.name]) { ShaderStore.IncludesShadersStore[inc.name] = inc.shader; } } /** @internal */ const iblVoxelGridPixelShader = { name, shader }; export { iblVoxelGridPixelShader }; //# sourceMappingURL=iblVoxelGrid.fragment-t94-_O0A.esm.js.map