aboutsummaryrefslogtreecommitdiff
path: root/tests/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC/UpdatePositionsFromVelocities.cl
blob: a3c9451868fb6c60b6d183bddffc0cbcb3a87eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
MSTRINGIFY(

//#define float3 float4

__kernel void 
UpdatePositionsFromVelocitiesKernel( 
	const int numNodes,
	const float solverSDT,
	__global float4 * g_vertexVelocities,
	__global float4 * g_vertexPreviousPositions,
	__global float4 * g_vertexCurrentPosition)
{
	int vertexID = get_global_id(0);
	if( vertexID < numNodes )
	{	
		float3 previousPosition = g_vertexPreviousPositions[vertexID].xyz;
		float3 velocity         = g_vertexVelocities[vertexID].xyz;
		
		float3 newPosition      = previousPosition + velocity*solverSDT;
		
		g_vertexCurrentPosition[vertexID]   = (float4)(newPosition, 0.f);
		g_vertexPreviousPositions[vertexID] = (float4)(newPosition, 0.f);
	}
}

);