btSoftBodySolverVertexBuffer_DX11.h

Go to the documentation of this file.
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_VERTEX_BUFFER_DX11_H
00017 #define BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_DX11_H 
00018 
00019 
00020 #include "BulletSoftBody/btSoftBodySolverVertexBuffer.h"
00021 
00022 #include <windows.h>
00023 #include <crtdbg.h>
00024 #include <d3d11.h>
00025 #include <d3dx11.h>
00026 #include <d3dcompiler.h>
00027 
00028 class btDX11VertexBufferDescriptor : public btVertexBufferDescriptor
00029 {
00030 protected:
00032         ID3D11DeviceContext* m_context;
00034         ID3D11Buffer* m_vertexBuffer;
00036         ID3D11UnorderedAccessView*  m_vertexBufferUAV;
00037 
00038 
00039 public:
00046         btDX11VertexBufferDescriptor( ID3D11DeviceContext* context, ID3D11Buffer* buffer, ID3D11UnorderedAccessView *UAV, int vertexOffset, int vertexStride )
00047         {
00048                 m_context = context;
00049                 m_vertexBuffer = buffer;
00050                 m_vertexBufferUAV = UAV;
00051                 m_vertexOffset = vertexOffset;
00052                 m_vertexStride = vertexStride;
00053                 m_hasVertexPositions = true;
00054         }
00055 
00064         btDX11VertexBufferDescriptor( ID3D11DeviceContext* context, ID3D11Buffer* buffer, ID3D11UnorderedAccessView *UAV, int vertexOffset, int vertexStride, int normalOffset, int normalStride )
00065         {
00066                 m_context = context;
00067                 m_vertexBuffer = buffer;
00068                 m_vertexBufferUAV = UAV;
00069                 m_vertexOffset = vertexOffset;
00070                 m_vertexStride = vertexStride;
00071                 m_hasVertexPositions = true;
00072                 
00073                 m_normalOffset = normalOffset;
00074                 m_normalStride = normalStride;
00075                 m_hasNormals = true;
00076         }
00077 
00078         virtual ~btDX11VertexBufferDescriptor()
00079         {
00080 
00081         }
00082 
00086         virtual BufferTypes getBufferType() const
00087         {
00088                 return DX11_BUFFER;
00089         }
00090 
00091         virtual ID3D11DeviceContext* getContext() const
00092         {
00093                 return m_context;
00094         }
00095 
00096         virtual ID3D11Buffer* getbtDX11Buffer() const
00097         {
00098                 return m_vertexBuffer;
00099         }
00100 
00101         virtual ID3D11UnorderedAccessView* getDX11UAV() const
00102         {
00103                 return m_vertexBufferUAV;
00104         }               
00105 };
00106 
00107 #endif // #ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_DX11_H