WuhuIslandTesting/Library/PackageCache/com.unity.splines@1.0.1/Samples~/Shader/InterpolateSpline.compute
2025-01-07 02:06:59 +01:00

16 lines
509 B
Text

#include "Packages/com.unity.splines/Shader/Spline.cginc"
#pragma kernel GetPositions
SplineInfo info = float4(0,0,0,0);
StructuredBuffer<BezierCurve> curves;
StructuredBuffer<float> curveLengths;
RWStructuredBuffer<float3> positions;
float positionsCount;
[numthreads(64,1,1)]
void GetPositions (uint id : SV_DispatchThreadID)
{
float curve = SplineToCurveT(info, curveLengths, id/(positionsCount - 1));
positions[id] = EvaluatePosition(curves[floor(curve) % GetKnotCount(info)], frac(curve));
}