升级6.4.升级水,升级天气

This commit is contained in:
2026-04-05 00:26:54 +08:00
parent 63bc9b5536
commit 5f7cbfb713
635 changed files with 34718 additions and 22567 deletions

View File

@@ -4,6 +4,8 @@
// An implementation of the Jump Flood algorithm by Rong and Tan
// Source: https://www.comp.nus.edu.sg/~tants/jfa.html
#pragma exclude_renderers glcore gles3
#pragma kernel CrestInitialize
#pragma kernel CrestExecute
#pragma kernel CrestApply
@@ -27,13 +29,13 @@ float _Crest_WaterLevel;
CBUFFER_END
// Holds scene depth for initialization.
Texture2D<float2> _Crest_Source;
RWTexture2D<float2> _Crest_Target;
Texture2D<m_Float2> _Crest_Source;
RWTexture2D<m_Float2> _Crest_Target;
// Setting this to zero means that geometry at exactly the origin won't be handled
// gracefully - but it would only affect a single-pixel in the worst-case and would
// doubtfully be noticable anyway. Use infinity instead.
#define m_CrestUninitializedPosition float2(m_Crest_PositiveInfinity, m_Crest_PositiveInfinity)
#define m_CrestUninitializedPosition m_Float2Constructor(m_Crest_PositiveInfinity, m_Crest_PositiveInfinity)
#if d_Crest_Inverted
#define m_DepthCheck depth > 0.0
@@ -62,11 +64,11 @@ void Initialize(const uint3 id)
#ifndef d_Crest_Standalone
// Add height offset.
uint slice0; uint slice1; float alpha;
PosToSliceIndices(position, 0, g_Crest_LodCount - 1, g_Crest_WaterScale, slice0, slice1, alpha);
PositionToSliceIndices(position, 0, g_Crest_LodCount - 1, g_Crest_WaterScale, slice0, slice1, alpha);
depth += lerp(Cascade::MakeLevel(slice0).SampleLevel(position), Cascade::MakeLevel(slice1).SampleLevel(position), alpha);
#endif
_Crest_Target[id.xy] = m_DepthCheck ? position : m_CrestUninitializedPosition;
_Crest_Target[id.xy] = m_DepthCheck ? m_Float2FromFloat2(position) : m_CrestUninitializedPosition;
}
void Execute(const uint3 id)
@@ -111,7 +113,7 @@ void Execute(const uint3 id)
}
}
_Crest_Target[id.xy] = nearest;
_Crest_Target[id.xy] = m_Float2FromFloat2(nearest);
}
void Apply(const uint3 id)
@@ -125,7 +127,7 @@ void Apply(const uint3 id)
#ifndef d_Crest_Standalone
// Get depth including height offset.
uint slice0; uint slice1; float alpha;
PosToSliceIndices(position, 0, g_Crest_LodCount - 1, g_Crest_WaterScale, slice0, slice1, alpha);
PositionToSliceIndices(position, 0, g_Crest_LodCount - 1, g_Crest_WaterScale, slice0, slice1, alpha);
depth += lerp(Cascade::MakeLevel(slice0).SampleLevel(position), Cascade::MakeLevel(slice1).SampleLevel(position), alpha);
#endif
@@ -144,7 +146,7 @@ void Apply(const uint3 id)
result.y = distance;
_Crest_Target[id.xy] = result;
_Crest_Target[id.xy] = m_Float2FromFloat2(result);
}
m_CrestNameSpaceEnd