Bullet Collision Detection & Physics Library
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 
19 
21 {
22 public:
24  {
28  };
29 
30 protected:
31 
34 
37 
40 
41 public:
43  {
44  m_hasVertexPositions = false;
45  m_hasNormals = false;
46  m_vertexOffset = 0;
47  m_vertexStride = 0;
48  m_normalOffset = 0;
49  m_normalStride = 0;
50  }
51 
53  {
54 
55  }
56 
57  virtual bool hasVertexPositions() const
58  {
59  return m_hasVertexPositions;
60  }
61 
62  virtual bool hasNormals() const
63  {
64  return m_hasNormals;
65  }
66 
70  virtual BufferTypes getBufferType() const = 0;
71 
75  virtual int getVertexOffset() const
76  {
77  return m_vertexOffset;
78  }
79 
83  virtual int getVertexStride() const
84  {
85  return m_vertexStride;
86  }
87 
91  virtual int getNormalOffset() const
92  {
93  return m_normalOffset;
94  }
95 
99  virtual int getNormalStride() const
100  {
101  return m_normalStride;
102  }
103 };
104 
105 
107 {
108 protected:
110 
111 public:
117  btCPUVertexBufferDescriptor( float *basePointer, int vertexOffset, int vertexStride )
118  {
119  m_basePointer = basePointer;
120  m_vertexOffset = vertexOffset;
121  m_vertexStride = vertexStride;
122  m_hasVertexPositions = true;
123  }
124 
130  btCPUVertexBufferDescriptor( float *basePointer, int vertexOffset, int vertexStride, int normalOffset, int normalStride )
131  {
132  m_basePointer = basePointer;
133 
134  m_vertexOffset = vertexOffset;
135  m_vertexStride = vertexStride;
136  m_hasVertexPositions = true;
137 
138  m_normalOffset = normalOffset;
139  m_normalStride = normalStride;
140  m_hasNormals = true;
141  }
142 
144  {
145 
146  }
147 
151  virtual BufferTypes getBufferType() const
152  {
153  return CPU_BUFFER;
154  }
155 
159  virtual float *getBasePointer() const
160  {
161  return m_basePointer;
162  }
163 };
164 
165 #endif // #ifndef BT_SOFT_BODY_SOLVER_VERTEX_BUFFER_H
btVertexBufferDescriptor::m_hasVertexPositions
bool m_hasVertexPositions
Definition: btSoftBodySolverVertexBuffer.h:32
btVertexBufferDescriptor::btVertexBufferDescriptor
btVertexBufferDescriptor()
Definition: btSoftBodySolverVertexBuffer.h:42
btVertexBufferDescriptor::m_vertexOffset
int m_vertexOffset
Definition: btSoftBodySolverVertexBuffer.h:35
btCPUVertexBufferDescriptor::~btCPUVertexBufferDescriptor
virtual ~btCPUVertexBufferDescriptor()
Definition: btSoftBodySolverVertexBuffer.h:143
btVertexBufferDescriptor::hasVertexPositions
virtual bool hasVertexPositions() const
Definition: btSoftBodySolverVertexBuffer.h:57
btCPUVertexBufferDescriptor::getBasePointer
virtual float * getBasePointer() const
Return the base pointer in memory to the first vertex.
Definition: btSoftBodySolverVertexBuffer.h:159
btVertexBufferDescriptor::hasNormals
virtual bool hasNormals() const
Definition: btSoftBodySolverVertexBuffer.h:62
btCPUVertexBufferDescriptor::m_basePointer
float * m_basePointer
Definition: btSoftBodySolverVertexBuffer.h:109
btVertexBufferDescriptor::m_vertexStride
int m_vertexStride
Definition: btSoftBodySolverVertexBuffer.h:36
btVertexBufferDescriptor::m_normalStride
int m_normalStride
Definition: btSoftBodySolverVertexBuffer.h:39
btVertexBufferDescriptor::BufferTypes
BufferTypes
Definition: btSoftBodySolverVertexBuffer.h:23
btVertexBufferDescriptor
Definition: btSoftBodySolverVertexBuffer.h:20
btVertexBufferDescriptor::getVertexStride
virtual int getVertexStride() const
Return the vertex stride in number of floats between vertices.
Definition: btSoftBodySolverVertexBuffer.h:83
btVertexBufferDescriptor::DX11_BUFFER
@ DX11_BUFFER
Definition: btSoftBodySolverVertexBuffer.h:26
btVertexBufferDescriptor::m_normalOffset
int m_normalOffset
Definition: btSoftBodySolverVertexBuffer.h:38
btVertexBufferDescriptor::~btVertexBufferDescriptor
virtual ~btVertexBufferDescriptor()
Definition: btSoftBodySolverVertexBuffer.h:52
btVertexBufferDescriptor::getNormalOffset
virtual int getNormalOffset() const
Return the vertex offset in floats from the base pointer.
Definition: btSoftBodySolverVertexBuffer.h:91
btVertexBufferDescriptor::OPENGL_BUFFER
@ OPENGL_BUFFER
Definition: btSoftBodySolverVertexBuffer.h:27
btCPUVertexBufferDescriptor
Definition: btSoftBodySolverVertexBuffer.h:106
btCPUVertexBufferDescriptor::getBufferType
virtual BufferTypes getBufferType() const
Return the type of the vertex buffer descriptor.
Definition: btSoftBodySolverVertexBuffer.h:151
btVertexBufferDescriptor::getVertexOffset
virtual int getVertexOffset() const
Return the vertex offset in floats from the base pointer.
Definition: btSoftBodySolverVertexBuffer.h:75
btVertexBufferDescriptor::m_hasNormals
bool m_hasNormals
Definition: btSoftBodySolverVertexBuffer.h:33
btVertexBufferDescriptor::CPU_BUFFER
@ CPU_BUFFER
Definition: btSoftBodySolverVertexBuffer.h:25
btCPUVertexBufferDescriptor::btCPUVertexBufferDescriptor
btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride)
vertexBasePointer is pointer to beginning of the buffer.
Definition: btSoftBodySolverVertexBuffer.h:117
btVertexBufferDescriptor::getBufferType
virtual BufferTypes getBufferType() const =0
Return the type of the vertex buffer descriptor.
btVertexBufferDescriptor::getNormalStride
virtual int getNormalStride() const
Return the vertex stride in number of floats between vertices.
Definition: btSoftBodySolverVertexBuffer.h:99
btCPUVertexBufferDescriptor::btCPUVertexBufferDescriptor
btCPUVertexBufferDescriptor(float *basePointer, int vertexOffset, int vertexStride, int normalOffset, int normalStride)
vertexBasePointer is pointer to beginning of the buffer.
Definition: btSoftBodySolverVertexBuffer.h:130