Merge pull request #1874 from John3/readmeUpdate
[Torque-3d.git] / Engine / lib / bullet / src / BulletMultiThreaded / GpuSoftBodySolvers / DX11 / HLSL / UpdatePositionsFromVelocities.hlsl
blobe816b1e14e0828934c699664bdf69fc3543198d2
1 MSTRINGIFY(
3 cbuffer UpdatePositionsFromVelocitiesCB : register( b0 )
5         int numNodes;
6         float solverSDT;
7         int padding1;
8         int padding2;
9 };
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)]
19 void 
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 )
24         {       
25                 float3 previousPosition = g_vertexPreviousPositions[vertexID].xyz;
26                 float3 velocity = g_vertexVelocities[vertexID].xyz;
27                 
28                 float3 newPosition = previousPosition + velocity*solverSDT;
29                 
30                 g_vertexCurrentPosition[vertexID] = float4(newPosition, 0.f);
31                 g_vertexPreviousPositions[vertexID] = float4(newPosition, 0.f);
32         }