Synchronize changes from branches/GpuClothAMD to trunk

Main improvements are: GPU cloth collision detection against a capsule shape
,OpenCL-OpenGL interoperability (keeping data buffers on GPU), and bug fixes
Thanks to Lee Howes
This commit is contained in:
erwin.coumans
2011-02-27 09:07:07 +00:00
parent ec1bd45f4f
commit d52f58edd8
37 changed files with 3267 additions and 2481 deletions

View File

@@ -1,6 +1,6 @@
#define STRINGIFY(A) #A
#ifdef USE_AMD_OPENCL
//use most up-to-date AMD Radeon drivers to make point sprites work
//see also http://forums.amd.com/devforum/messageview.cfm?catid=392&threadid=129431
// vertex shader
const char *vertexShader = STRINGIFY(
uniform float pointRadius; // point size in world space
@@ -14,35 +14,7 @@ void main()
posEye = vec3(gl_ModelViewMatrix * vec4(gl_Vertex.xyz, 1.0));
float dist = length(posEye);
gl_PointSize = pointRadius * (pointScale / dist);
// gl_PointSize = 4.0;
//hack around latest AMD graphics cards having troubles with point sprite rendering
//the problem is still unresolved on the 5870 card, and results in a black screen
//see also http://forums.amd.com/devforum/messageview.cfm?catid=392&threadid=129431
gl_TexCoord = gl_MultiTexCoord0;
gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
gl_FrontColor = gl_Color;
}
);
#else
// vertex shader
const char *vertexShader = STRINGIFY(
uniform float pointRadius; // point size in world space
uniform float pointScale; // scale to calculate size in pixels
uniform float densityScale;
uniform float densityOffset;
varying vec3 posEye;
void main()
{
// calculate window-space point size
posEye = vec3(gl_ModelViewMatrix * vec4(gl_Vertex.xyz, 1.0));
float dist = length(posEye);
gl_PointSize = pointRadius * (pointScale / dist);
// gl_PointSize = 4.0;
//hack around latest AMD graphics cards having troubles with point sprite rendering
//the problem is still unresolved on the 5870 card, and results in a black screen
//see also http://forums.amd.com/devforum/messageview.cfm?catid=392&threadid=129431
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
@@ -51,7 +23,7 @@ void main()
}
);
#endif
// pixel shader for rendering points as shaded spheres
const char *spherePixelShader = STRINGIFY(