3 cbuffer UpdatePositionsFromVelocitiesCB : register( b0 )
12 StructuredBuffer<float4> g_vertexVelocities : register( t0 );
14 RWStructuredBuffer<float4> g_vertexPreviousPositions : register( u0 );
15 RWStructuredBuffer<float4> g_vertexCurrentPosition : register( u1 );
18 [numthreads(128, 1, 1)]
20 UpdatePositionsFromVelocitiesKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex )
22 int vertexID = DTid.x;
23 if( vertexID < numNodes )
25 float3 previousPosition = g_vertexPreviousPositions[vertexID].xyz;
26 float3 velocity = g_vertexVelocities[vertexID].xyz;
28 float3 newPosition = previousPosition + velocity*solverSDT;
30 g_vertexCurrentPosition[vertexID] = float4(newPosition, 0.f);
31 g_vertexPreviousPositions[vertexID] = float4(newPosition, 0.f);