Blender  V3.3
btSoftBodySolverVertexBuffer.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
4 
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:
10 
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.
14 */
15 
16 #ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
17 #define BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
18 
20 {
21 public:
23  {
27  };
28 
29 protected:
32 
35 
38 
39 public:
41  {
42  m_hasVertexPositions = false;
43  m_hasNormals = false;
44  m_vertexOffset = 0;
45  m_vertexStride = 0;
46  m_normalOffset = 0;
47  m_normalStride = 0;
48  }
49 
51  {
52  }
53 
54  virtual bool hasVertexPositions() const
55  {
56  return m_hasVertexPositions;
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 {
104 protected:
106 
107 public:
113  btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride)
114  {
115  m_basePointer = basePointer;
116  m_vertexOffset = vertexOffset;
117  m_vertexStride = vertexStride;
118  m_hasVertexPositions = true;
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;
132  m_hasVertexPositions = true;
133 
134  m_normalOffset = normalOffset;
135  m_normalStride = normalStride;
136  m_hasNormals = true;
137  }
138 
140  {
141  }
142 
146  virtual BufferTypes getBufferType() const
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)
virtual BufferTypes getBufferType() const
btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride, int normalOffset, int normalStride)
virtual BufferTypes getBufferType() const =0