2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans https://bulletphysics.org
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
19 class btVertexBufferDescriptor
30 bool m_hasVertexPositions;
40 btVertexBufferDescriptor()
42 m_hasVertexPositions = false;
50 virtual ~btVertexBufferDescriptor()
54 virtual bool hasVertexPositions() const
56 return m_hasVertexPositions;
59 virtual bool hasNormals() const
65 * Return the type of the vertex buffer descriptor.
67 virtual BufferTypes getBufferType() const = 0;
70 * Return the vertex offset in floats from the base pointer.
72 virtual int getVertexOffset() const
74 return m_vertexOffset;
78 * Return the vertex stride in number of floats between vertices.
80 virtual int getVertexStride() const
82 return m_vertexStride;
86 * Return the vertex offset in floats from the base pointer.
88 virtual int getNormalOffset() const
90 return m_normalOffset;
94 * Return the vertex stride in number of floats between vertices.
96 virtual int getNormalStride() const
98 return m_normalStride;
102 class btCPUVertexBufferDescriptor : public btVertexBufferDescriptor
105 float *m_basePointer;
109 * vertexBasePointer is pointer to beginning of the buffer.
110 * vertexOffset is the offset in floats to the first vertex.
111 * vertexStride is the stride in floats between vertices.
113 btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride)
115 m_basePointer = basePointer;
116 m_vertexOffset = vertexOffset;
117 m_vertexStride = vertexStride;
118 m_hasVertexPositions = true;
122 * vertexBasePointer is pointer to beginning of the buffer.
123 * vertexOffset is the offset in floats to the first vertex.
124 * vertexStride is the stride in floats between vertices.
126 btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride, int normalOffset, int normalStride)
128 m_basePointer = basePointer;
130 m_vertexOffset = vertexOffset;
131 m_vertexStride = vertexStride;
132 m_hasVertexPositions = true;
134 m_normalOffset = normalOffset;
135 m_normalStride = normalStride;
139 virtual ~btCPUVertexBufferDescriptor()
144 * Return the type of the vertex buffer descriptor.
146 virtual BufferTypes getBufferType() const
152 * Return the base pointer in memory to the first vertex.
154 virtual float *getBasePointer() const
156 return m_basePointer;
160 #endif // #ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H