Bullet Collision Detection & Physics Library
btSoftBodySolverVertexBuffer.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans https://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
17#define BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
18
20{
21public:
23 {
27 };
28
29protected:
32
35
38
39public:
41 {
43 m_hasNormals = false;
48 }
49
51 {
52 }
53
54 virtual bool hasVertexPositions() const
55 {
57 }
58
59 virtual bool hasNormals() const
60 {
61 return m_hasNormals;
62 }
63
67 virtual BufferTypes getBufferType() const = 0;
68
72 virtual int getVertexOffset() const
73 {
74 return m_vertexOffset;
75 }
76
80 virtual int getVertexStride() const
81 {
82 return m_vertexStride;
83 }
84
88 virtual int getNormalOffset() const
89 {
90 return m_normalOffset;
91 }
92
96 virtual int getNormalStride() const
97 {
98 return m_normalStride;
99 }
100};
101
103{
104protected:
106
107public:
113 btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride)
114 {
115 m_basePointer = basePointer;
116 m_vertexOffset = vertexOffset;
117 m_vertexStride = vertexStride;
119 }
120
126 btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride, int normalOffset, int normalStride)
127 {
128 m_basePointer = basePointer;
129
130 m_vertexOffset = vertexOffset;
131 m_vertexStride = vertexStride;
133
134 m_normalOffset = normalOffset;
135 m_normalStride = normalStride;
136 m_hasNormals = true;
137 }
138
140 {
141 }
142
147 {
148 return CPU_BUFFER;
149 }
150
154 virtual float *getBasePointer() const
155 {
156 return m_basePointer;
157 }
158};
159
160#endif // #ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride)
vertexBasePointer is pointer to beginning of the buffer.
virtual float * getBasePointer() const
Return the base pointer in memory to the first vertex.
virtual BufferTypes getBufferType() const
Return the type of the vertex buffer descriptor.
btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride, int normalOffset, int normalStride)
vertexBasePointer is pointer to beginning of the buffer.
virtual BufferTypes getBufferType() const =0
Return the type of the vertex buffer descriptor.
virtual int getNormalOffset() const
Return the vertex offset in floats from the base pointer.
virtual int getVertexOffset() const
Return the vertex offset in floats from the base pointer.
virtual int getNormalStride() const
Return the vertex stride in number of floats between vertices.
virtual int getVertexStride() const
Return the vertex stride in number of floats between vertices.