Files
2026-07-13 13:13:17 +08:00

83 lines
1.6 KiB
HLSL

#include "shared/hash-functions.hlsl"
// #include "shared/noise-functions.hlsl"
#include "shared/point.hlsl"
#include "shared/quat-functions.hlsl"
#include "shared/bias-functions.hlsl"
/*{ADDITIONAL_INCLUDES}*/
cbuffer Params : register(b0)
{
}
cbuffer Params : register(b1)
{
/*{FLOAT_PARAMS}*/
}
cbuffer Params : register(b2)
{
int WriteTo;
}
StructuredBuffer<Point> SourcePoints : t0;
RWStructuredBuffer<Point> ResultPoints : u0;
sampler ClampedSampler : register(s0);
//=== Additional Resources ==========================================
/*{RESOURCES(t1)}*/
//=== Global functions ==============================================
/*{GLOBALS}*/
//=== Field functions ===============================================
/*{FIELD_FUNCTIONS}*/
//-------------------------------------------------------------------
float4 GetField(float4 p)
{
float4 f = 1;
/*{FIELD_CALL}*/
return f;
}
inline float GetDistance(float3 p3)
{
return GetField(float4(p3.xyz, 0)).w;
}
//===================================================================
static const float NoisePhase = 0;
[numthreads(64, 1, 1)] void main(uint3 i : SV_DispatchThreadID)
{
uint numStructs, stride;
SourcePoints.GetDimensions(numStructs, stride);
if (i.x >= numStructs)
return;
Point p = SourcePoints[i.x];
if (isnan(p.Scale.x))
{
ResultPoints[i.x] = p;
return;
}
float3 pos = p.Position;
float4 f = GetField(float4(pos, 0));
if (WriteTo == 1)
{
p.FX1 = f.w;
}
else if (WriteTo == 2)
{
p.FX2 = f.w;
}
ResultPoints[i.x] = p;
}