备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
//Functionality to sample the water's displacement pre-pass buffer
uniform bool _WaterDisplacementPrePassAvailable;
uniform float3 _WaterDisplacementCoords;
//XY: Bounds min
//Z: Bounds size
uniform Texture2D _WaterDisplacementBuffer;
#ifndef UNITY_CORE_SAMPLERS_INCLUDED
SamplerState sampler_LinearClamp;
#endif
//Position, relative to rendering bounds (normalized 0-1)
float2 WorldToDisplacementUV(float3 positionWS)
{
return (positionWS.xz - _WaterDisplacementCoords.xy) / _WaterDisplacementCoords.z;
}
float SampleDisplacementBuffer(float2 uv)
{
if(_WaterDisplacementPrePassAvailable == false) return 0;
const float height = _WaterDisplacementBuffer.SampleLevel(sampler_LinearClamp, uv, 0).r;
//Need to figure out how to determine if a void is hit
//if(height == 0.0f) return -1000;
return height;
}
//Main function
float SampleWaterHeight(float3 positionWS)
{
return SampleDisplacementBuffer(WorldToDisplacementUV(positionWS));
}
//Shader Graph
void SampleWaterHeight_float(float3 positionWS, out float height)
{
#if defined(SHADERGRAPH_PREVIEW)
height = 0;
#else
height = SampleWaterHeight(positionWS);
#endif
}