added OpenCL cloth demo, contributed by AMD.
updated GpuSoftBodySolvers updated DirectCompute cloth demo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2010 Advanced Micro Devices
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -13,6 +13,8 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef BT_DIRECT_COMPUTE_SUPPORT_HPP
|
||||
#define BT_DIRECT_COMPUTE_SUPPORT_HPP
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2010 Advanced Micro Devices
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
class cap
|
||||
{
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2010 Advanced Micro Devices
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
class piece_of_cloth
|
||||
{
|
||||
@@ -171,7 +189,8 @@ public:
|
||||
|
||||
pd3dImmediateContext->PSSetShaderResources(0,1,&texture2D_view);
|
||||
|
||||
pd3dImmediateContext->DrawIndexed( (width*3*2+2 + height*width*3*2), 0, ( UINT )pSubset->VertexStart );
|
||||
//pd3dImmediateContext->DrawIndexed( (width*3*2+2 + height*width*3*2), 0, ( UINT )pSubset->VertexStart );
|
||||
pd3dImmediateContext->DrawIndexed( ((height-1)*(width-1)*3*2), 0, ( UINT )pSubset->VertexStart );
|
||||
}
|
||||
|
||||
SAFE_RELEASE(pd3dImmediateContext);
|
||||
@@ -246,7 +265,7 @@ public:
|
||||
|
||||
|
||||
//unsigned int indices[] = {0,1,2, 1,3,2};
|
||||
unsigned int* indices = new unsigned int[width*3*2+2 + height*width*3*2];
|
||||
unsigned int* indices = new unsigned int[(height-1)*(width-1)*3*2];
|
||||
|
||||
for(int y = 0; y < height-1; y++)
|
||||
{
|
||||
@@ -265,7 +284,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bufferDesc.ByteWidth = sizeof(unsigned int)*(width*3*2+2 + height*width*3*2);
|
||||
|
||||
bufferDesc.ByteWidth = sizeof(unsigned int)*((height-1)*(width-1)*3*2);
|
||||
bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
|
||||
InitData.pSysMem = indices;
|
||||
|
||||
@@ -32,18 +32,15 @@ class btDX11SIMDAwareSoftBodySolver;
|
||||
#include "BulletSoftBody/btSoftBodySolvers.h"
|
||||
#include "BulletSoftBody/btDefaultSoftBodySolver.h"
|
||||
#include "BulletMultiThreaded/GpuSoftBodySolvers/CPU/btSoftBodySolver_CPU.h"
|
||||
//#include "BulletSoftBody/Solvers/CPU/btAcceleratedSoftBody_CPUVertexSolver.h"
|
||||
#include "BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.h"
|
||||
//#include "BulletSoftBody/Solvers/DX11/btAcceleratedSoftBody_DX11SIMDAwareSolver.h"
|
||||
//#include "BulletSoftBody/btAcceleratedSoftBody_DXVertexBuffers.h"
|
||||
#include "BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.h"
|
||||
|
||||
#include "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h"
|
||||
|
||||
//#define USE_SIMDAWARE_SOLVER
|
||||
#define USE_GPU_SOLVER
|
||||
//#define USE_VERTEX_SOLVER
|
||||
#define USE_SIMDAWARE_SOLVER
|
||||
//#define USE_GPU_SOLVER
|
||||
#define USE_GPU_COPY
|
||||
const int numFlags = 2;
|
||||
const int numFlags = 5;
|
||||
const int clothWidth = 40;
|
||||
const int clothHeight = 60;//60;
|
||||
float _windAngle = 1.0;//0.4;
|
||||
@@ -206,6 +203,7 @@ btSoftRigidDynamicsWorld* m_dynamicsWorld;
|
||||
btDefaultSoftBodySolver *g_defaultSolver = NULL;
|
||||
btCPUSoftBodySolver *g_cpuSolver = NULL;
|
||||
btDX11SoftBodySolver *g_dx11Solver = NULL;
|
||||
btDX11SIMDAwareSoftBodySolver *g_dx11SIMDSolver = NULL;
|
||||
|
||||
btSoftBodySolver *g_solver = NULL;
|
||||
|
||||
@@ -454,12 +452,17 @@ void initBullet(void)
|
||||
#ifdef USE_GPU_SOLVER
|
||||
g_dx11Solver = new btDX11SoftBodySolver( g_pd3dDevice, DXUTGetD3D11DeviceContext() );
|
||||
g_solver = g_dx11Solver;
|
||||
#else
|
||||
#ifdef USE_SIMDAWARE_SOLVER
|
||||
g_dx11SIMDSolver = new btDX11SIMDAwareSoftBodySolver( g_pd3dDevice, DXUTGetD3D11DeviceContext() );
|
||||
g_solver = g_dx11SIMDSolver;
|
||||
#else
|
||||
g_cpuSolver = new btCPUSoftBodySolver;
|
||||
g_solver = g_cpuSolver;
|
||||
//g_defaultSolver = new btDefaultSoftBodySolver;
|
||||
//g_solver = g_defaultSolver;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1260,6 +1263,9 @@ void CALLBACK OnD3D11DestroyDevice( void* pUserContext )
|
||||
delete g_cpuSolver;
|
||||
if( g_dx11Solver )
|
||||
delete g_dx11Solver;
|
||||
if( g_dx11SIMDSolver )
|
||||
delete g_dx11SIMDSolver;
|
||||
|
||||
|
||||
for(int i=0; i< m_collisionShapes.size(); i++)
|
||||
delete m_collisionShapes[i];
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2010 Advanced Micro Devices
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
class cylinder
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user