~ubuntu-branches/ubuntu/saucy/emscripten/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/UpdatePositions.cl

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
MSTRINGIFY(
 
2
 
 
3
__kernel void 
 
4
updateVelocitiesFromPositionsWithoutVelocitiesKernel( 
 
5
        const int numNodes,
 
6
        const float isolverdt,
 
7
        __global float4 * g_vertexPositions,
 
8
        __global float4 * g_vertexPreviousPositions,
 
9
        __global int * g_vertexClothIndices,
 
10
        __global float * g_clothDampingFactor,
 
11
        __global float4 * g_vertexVelocities,
 
12
        __global float4 * g_vertexForces GUID_ARG)
 
13
 
 
14
{
 
15
        int nodeID = get_global_id(0);
 
16
        if( nodeID < numNodes )
 
17
        {       
 
18
                float4 position = g_vertexPositions[nodeID];
 
19
                float4 previousPosition = g_vertexPreviousPositions[nodeID];
 
20
                float4 velocity = g_vertexVelocities[nodeID];
 
21
                int clothIndex = g_vertexClothIndices[nodeID];
 
22
                float dampingFactor = g_clothDampingFactor[clothIndex];
 
23
                float velocityCoefficient = (1.f - dampingFactor);
 
24
                
 
25
                float4 difference = position - previousPosition;
 
26
                                
 
27
                velocity = difference*velocityCoefficient*isolverdt;            
 
28
                
 
29
                g_vertexVelocities[nodeID] = velocity;
 
30
                g_vertexForces[nodeID] = (float4)(0.f, 0.f, 0.f, 0.f);                                                          
 
31
        }
 
32
}
 
33
 
 
34
);
 
 
b'\\ No newline at end of file'