mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-19 19:35:26 +00:00
52 lines
1.2 KiB
HLSL
52 lines
1.2 KiB
HLSL
//*****************************************************************************
|
|
// Torque -- HLSL procedural shader
|
|
//*****************************************************************************
|
|
|
|
// Dependencies:
|
|
#include "core/rendering/shaders/torque.hlsl"
|
|
|
|
// Features:
|
|
// Vert Position
|
|
// Eye Space Depth (Out)
|
|
// Visibility
|
|
|
|
struct ConnectData
|
|
{
|
|
float4 vpos : SV_Position;
|
|
float4 wsEyeVec : TEXCOORD0;
|
|
};
|
|
|
|
|
|
struct Fragout
|
|
{
|
|
float4 col : SV_Target0;
|
|
};
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Main
|
|
//-----------------------------------------------------------------------------
|
|
Fragout main( ConnectData IN,
|
|
uniform float3 vEye : register(C1),
|
|
uniform float4 oneOverFarplane : register(C2),
|
|
uniform float visibility : register(C0)
|
|
)
|
|
{
|
|
Fragout OUT;
|
|
|
|
// Vert Position
|
|
|
|
// Eye Space Depth (Out)
|
|
#ifndef CUBE_SHADOW_MAP
|
|
float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
|
|
#else
|
|
float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
|
|
#endif
|
|
OUT.col = float4(eyeSpaceDepth.rrr,1);
|
|
|
|
// Visibility
|
|
fizzle( IN.vpos.xy, visibility );
|
|
|
|
|
|
return OUT;
|
|
}
|