UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

53 lines 1.5 kB
// Do not edit. import { ShaderStore } from "../Engines/shaderStore.js"; import "./ShadersInclude/clipPlaneFragmentDeclaration.js"; import "./ShadersInclude/packingFunctions.js"; import "./ShadersInclude/clipPlaneFragment.js"; const name = "depthPixelShader"; const shader = `#ifdef ALPHATEST varying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>; #endif #include<clipPlaneFragmentDeclaration> varying vDepthMetric: f32; #ifdef PACKED #include<packingFunctions> #endif #ifdef STORE_CAMERASPACE_Z varying vViewPos: vec4f; #endif #define CUSTOM_FRAGMENT_DEFINITIONS @fragment fn main(input: FragmentInputs)->FragmentOutputs { #include<clipPlaneFragment> #ifdef ALPHATEST if (textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV).a<0.4) {discard;} #endif #ifdef STORE_CAMERASPACE_Z #ifdef PACKED fragmentOutputs.color=pack(input.vViewPos.z); #else fragmentOutputs.color= vec4f(input.vViewPos.z,0.0,0.0,1.0); #endif #else #ifdef NONLINEARDEPTH #ifdef PACKED fragmentOutputs.color=pack(input.position.z); #else fragmentOutputs.color= vec4f(input.position.z,0.0,0.0,0.0); #endif #else #ifdef PACKED fragmentOutputs.color=pack(input.vDepthMetric); #else fragmentOutputs.color= vec4f(input.vDepthMetric,0.0,0.0,1.0); #endif #endif #endif }`; // Sideeffect if (!ShaderStore.ShadersStoreWGSL[name]) { ShaderStore.ShadersStoreWGSL[name] = shader; } /** @internal */ export const depthPixelShaderWGSL = { name, shader }; //# sourceMappingURL=depth.fragment.js.map