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.

81 lines (76 loc) 2.8 kB
import { S as ShaderStore } from './index-FzOfPXLV.esm.js'; // Do not edit. const name$3 = "prePassDeclaration"; const shader$3 = `#ifdef PREPASS #ifdef PREPASS_LOCAL_POSITION varying vPosition : vec3f; #endif #ifdef PREPASS_DEPTH varying vViewPos: vec3f; #endif #ifdef PREPASS_NORMALIZED_VIEW_DEPTH varying vNormViewDepth: f32; #endif #if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f; #endif #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStoreWGSL[name$3]) { ShaderStore.IncludesShadersStoreWGSL[name$3] = shader$3; } // Do not edit. const name$2 = "oitDeclaration"; const shader$2 = `#ifdef ORDER_INDEPENDENT_TRANSPARENCY #define MAX_DEPTH 99999.0 var oitDepthSamplerSampler: sampler;var oitDepthSampler: texture_2d<f32>;var oitFrontColorSamplerSampler: sampler;var oitFrontColorSampler: texture_2d<f32>; #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStoreWGSL[name$2]) { ShaderStore.IncludesShadersStoreWGSL[name$2] = shader$2; } // Do not edit. const name$1 = "depthPrePass"; const shader$1 = `#ifdef DEPTHPREPASS fragmentOutputs.color= vec4f(0.,0.,0.,1.0);return fragmentOutputs; #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStoreWGSL[name$1]) { ShaderStore.IncludesShadersStoreWGSL[name$1] = shader$1; } // Do not edit. const name = "oitFragment"; const shader = `#ifdef ORDER_INDEPENDENT_TRANSPARENCY var fragDepth: f32=fragmentInputs.position.z; #ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS var halfFloat: u32=pack2x16float( vec2f(fragDepth));var full: vec2f=unpack2x16float(halfFloat);fragDepth=full.x; #endif var fragCoord: vec2i=vec2i(fragmentInputs.position.xy);var lastDepth: vec2f=textureLoad(oitDepthSampler,fragCoord,0).rg;var lastFrontColor: vec4f=textureLoad(oitFrontColorSampler,fragCoord,0);fragmentOutputs.depth=vec2f(-MAX_DEPTH);fragmentOutputs.frontColor=lastFrontColor;fragmentOutputs.backColor= vec4f(0.0); #ifdef USE_REVERSE_DEPTHBUFFER var furthestDepth: f32=-lastDepth.x;var nearestDepth: f32=lastDepth.y; #else var nearestDepth: f32=-lastDepth.x;var furthestDepth: f32=lastDepth.y; #endif var alphaMultiplier: f32=1.0-lastFrontColor.a; #ifdef USE_REVERSE_DEPTHBUFFER if (fragDepth>nearestDepth || fragDepth<furthestDepth) { #else if (fragDepth<nearestDepth || fragDepth>furthestDepth) { #endif return fragmentOutputs;} #ifdef USE_REVERSE_DEPTHBUFFER if (fragDepth<nearestDepth && fragDepth>furthestDepth) { #else if (fragDepth>nearestDepth && fragDepth<furthestDepth) { #endif fragmentOutputs.depth=vec2f(-fragDepth,fragDepth);return fragmentOutputs;} #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStoreWGSL[name]) { ShaderStore.IncludesShadersStoreWGSL[name] = shader; } //# sourceMappingURL=oitFragment-DBax_G7o.esm.js.map