2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
16 #ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
17 #define BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
20 class btVertexBufferDescriptor
32 bool m_hasVertexPositions;
42 btVertexBufferDescriptor()
44 m_hasVertexPositions = false;
52 virtual ~btVertexBufferDescriptor()
57 virtual bool hasVertexPositions() const
59 return m_hasVertexPositions;
62 virtual bool hasNormals() const
68 * Return the type of the vertex buffer descriptor.
70 virtual BufferTypes getBufferType() const = 0;
73 * Return the vertex offset in floats from the base pointer.
75 virtual int getVertexOffset() const
77 return m_vertexOffset;
81 * Return the vertex stride in number of floats between vertices.
83 virtual int getVertexStride() const
85 return m_vertexStride;
89 * Return the vertex offset in floats from the base pointer.
91 virtual int getNormalOffset() const
93 return m_normalOffset;
97 * Return the vertex stride in number of floats between vertices.
99 virtual int getNormalStride() const
101 return m_normalStride;
106 class btCPUVertexBufferDescriptor : public btVertexBufferDescriptor
109 float *m_basePointer;
113 * vertexBasePointer is pointer to beginning of the buffer.
114 * vertexOffset is the offset in floats to the first vertex.
115 * vertexStride is the stride in floats between vertices.
117 btCPUVertexBufferDescriptor( float *basePointer, int vertexOffset, int vertexStride )
119 m_basePointer = basePointer;
120 m_vertexOffset = vertexOffset;
121 m_vertexStride = vertexStride;
122 m_hasVertexPositions = true;
126 * vertexBasePointer is pointer to beginning of the buffer.
127 * vertexOffset is the offset in floats to the first vertex.
128 * vertexStride is the stride in floats between vertices.
130 btCPUVertexBufferDescriptor( float *basePointer, int vertexOffset, int vertexStride, int normalOffset, int normalStride )
132 m_basePointer = basePointer;
134 m_vertexOffset = vertexOffset;
135 m_vertexStride = vertexStride;
136 m_hasVertexPositions = true;
138 m_normalOffset = normalOffset;
139 m_normalStride = normalStride;
143 virtual ~btCPUVertexBufferDescriptor()
149 * Return the type of the vertex buffer descriptor.
151 virtual BufferTypes getBufferType() const
157 * Return the base pointer in memory to the first vertex.
159 virtual float *getBasePointer() const
161 return m_basePointer;
165 #endif // #ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H