00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 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. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 00014 */ 00015 00016 #ifndef BT_SOFT_BODY_SOLVER_OUTPUT_CL_TO_GL_H 00017 #define BT_SOFT_BODY_SOLVER_OUTPUT_CL_TO_GL_H 00018 00019 #include "btSoftBodySolver_OpenCL.h" 00020 00025 class btSoftBodySolverOutputCLtoGL : public btSoftBodySolverOutput 00026 { 00027 protected: 00028 cl_command_queue m_cqCommandQue; 00029 cl_context m_cxMainContext; 00030 CLFunctions clFunctions; 00031 00032 cl_kernel outputToVertexArrayWithNormalsKernel; 00033 cl_kernel outputToVertexArrayWithoutNormalsKernel; 00034 00035 bool m_shadersInitialized; 00036 00037 virtual bool checkInitialized(); 00038 virtual bool buildShaders(); 00039 void releaseKernels(); 00040 public: 00041 btSoftBodySolverOutputCLtoGL(cl_command_queue cqCommandQue, cl_context cxMainContext) : 00042 m_cqCommandQue( cqCommandQue ), 00043 m_cxMainContext( cxMainContext ), 00044 clFunctions(cqCommandQue, cxMainContext), 00045 outputToVertexArrayWithNormalsKernel( 0 ), 00046 outputToVertexArrayWithoutNormalsKernel( 0 ), 00047 m_shadersInitialized( false ) 00048 { 00049 } 00050 00051 virtual ~btSoftBodySolverOutputCLtoGL() 00052 { 00053 releaseKernels(); 00054 } 00055 00057 virtual void copySoftBodyToVertexBuffer( const btSoftBody * const softBody, btVertexBufferDescriptor *vertexBuffer ); 00058 }; 00059 00060 00061 00062 #endif // #ifndef BT_SOFT_BODY_SOLVER_OUTPUT_CL_TO_GL_H