Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DxVbo.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010, The Barbarian Group
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
6  the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and
9  the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
11  the following disclaimer in the documentation and/or other materials provided with the distribution.
12 
13  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
14  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
15  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
16  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
17  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
19  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20  POSSIBILITY OF SUCH DAMAGE.
21 */
22 
23 #pragma once
24 
25 #include "cinder/dx/dx.h"
26 #include "cinder/TriMesh.h"
27 
28 #include <vector>
29 #include <utility>
30 #include <d3d11.h>
31 
32 namespace cinder { namespace dx {
33 
34 class Vbo {
35  public:
36  Vbo(bool createBuffer = false);
37 
38  //void bind();
39  //void unbind();
40 
41  void bufferData( size_t size, const void *data, D3D11_USAGE usage, D3D11_BIND_FLAG bindFlags, D3D11_CPU_ACCESS_FLAG cpuAccess);
42  void bufferSubData( ptrdiff_t offset, size_t size, const void *data );
43 
44  uint8_t* map( D3D11_MAP access );
45  void unmap();
46 
47  D3D11_BIND_FLAG getTarget() const { return mObj->mTarget; }
48  ID3D11Buffer* getId() const { return mObj->mId; }
49 
50  protected:
51  struct Obj {
52  Obj();
53  ~Obj();
54 
55  D3D11_BIND_FLAG mTarget;
56  ID3D11Buffer *mId;
57  };
58 
59  std::shared_ptr<Obj> mObj;
60 
61  public:
63  typedef std::shared_ptr<Obj> Vbo::*unspecified_bool_type;
65  operator unspecified_bool_type() const { return ( mObj.get() == 0 ) ? 0 : &Vbo::mObj; }
66  void reset() { mObj.reset(); }
68 };
69 
70 class VboMesh {
71  public:
72  enum { NONE, STATIC, DYNAMIC };
74  enum { ATTR_MAX_TEXTURE_UNIT = 3 };
75 
76  struct Layout {
77  Layout() { initAttributes(); }
78 
80  bool isDefaults() const { for( int a = 0; a < ATTR_TOTAL; ++a ) if( mAttributes[a] != NONE ) return false; return true; }
81 
82  bool hasNormals() const { return hasDynamicNormals() || hasStaticNormals(); }
83  bool hasStaticNormals() const { return mAttributes[ATTR_NORMALS] == STATIC; }
84  bool hasDynamicNormals() const { return mAttributes[ATTR_NORMALS] == DYNAMIC; }
87 
88  bool hasColorsRGB() const { return hasDynamicColorsRGB() || hasStaticColorsRGB(); }
93 
94  bool hasColorsRGBA() const { return hasDynamicColorsRGBA() || hasStaticColorsRGBA(); }
99 
100  bool hasTexCoords2d( size_t unit = 0 ) const { return hasDynamicTexCoords2d( unit ) || hasStaticTexCoords2d( unit ); }
101  bool hasStaticTexCoords2d( size_t unit = 0 ) const { return mAttributes[ATTR_TEXCOORDS2D_0 + unit] == STATIC; }
102  bool hasDynamicTexCoords2d( size_t unit = 0 ) const { return mAttributes[ATTR_TEXCOORDS2D_0 + unit] == DYNAMIC; }
106  bool hasStaticTexCoords() const;
108  bool hasDynamicTexCoords() const;
110  bool hasTexCoords( size_t unit ) const { return ( mAttributes[ATTR_TEXCOORDS2D_0 + unit] != NONE ) || ( mAttributes[ATTR_TEXCOORDS3D_0 + unit] != NONE ); }
111 
112  bool hasTexCoords3d( size_t unit = 0 ) const { return hasDynamicTexCoords3d( unit ) || hasStaticTexCoords3d( unit ); }
113  bool hasStaticTexCoords3d( size_t unit = 0 ) const { return mAttributes[ATTR_TEXCOORDS3D_0 + unit] == STATIC; }
114  bool hasDynamicTexCoords3d( size_t unit = 0 ) const { return mAttributes[ATTR_TEXCOORDS3D_0 + unit] == DYNAMIC; }
117 
118  bool hasIndices() const { return hasStaticIndices() || hasDynamicIndices(); }
119  bool hasStaticIndices() const { return mAttributes[ATTR_INDICES] == STATIC; }
120  bool hasDynamicIndices() const { return mAttributes[ATTR_INDICES] == DYNAMIC; }
123 
124  bool hasPositions() const { return hasStaticPositions() || hasDynamicPositions(); }
129 
134  void addDynamicCustomFloat() { mCustomDynamic.push_back( std::make_pair( CUSTOM_ATTR_FLOAT, 0 ) ); }
135  void addDynamicCustomVec2f() { mCustomDynamic.push_back( std::make_pair( CUSTOM_ATTR_FLOAT2, 0 ) ); }
136  void addDynamicCustomVec3f() { mCustomDynamic.push_back( std::make_pair( CUSTOM_ATTR_FLOAT3, 0 ) ); }
137  void addDynamicCustomVec4f() { mCustomDynamic.push_back( std::make_pair( CUSTOM_ATTR_FLOAT4, 0 ) ); }
138 
140  std::vector<std::pair<CustomAttr,size_t> > mCustomDynamic, mCustomStatic; // pair of <types,offset>
141 
142  private:
143  void initAttributes() { for( int a = 0; a < ATTR_TOTAL; ++a ) mAttributes[a] = NONE; }
144  };
145 
147 
148  protected:
149  struct Obj {
150  Obj();
151  ~Obj();
152 
154 
161  D3D11_PRIMITIVE_TOPOLOGY mPrimitiveType;
163  //std::vector<GLint> mCustomStaticLocations;
164  //std::vector<GLint> mCustomDynamicLocations;
165  ID3D11InputLayout* mInputLayout;
166  bool mUseQuads;
167  };
168 
169  public:
170  class VertexIter;
171 
172  VboMesh() {}
173  explicit VboMesh( const TriMesh &triMesh, Layout layout = Layout() );
174  explicit VboMesh( const TriMesh2d &triMesh, Layout layout = Layout() );
175  /*** Creates a VboMesh with \a numVertices vertices and \a numIndices indices. Dynamic data is stored interleaved and static data is planar. **/
176  VboMesh( size_t numVertices, size_t numIndices, Layout layout, D3D11_PRIMITIVE_TOPOLOGY primitiveType );
177  VboMesh( size_t numVertices, size_t numIndices, Layout layout, bool useQuads );
178  /*** Creates a VboMesh with \a numVertices vertices and \a numIndices indices. Accepts pointers to preexisting buffers, which may be NULL to request allocation **/
179  VboMesh( size_t numVertices, size_t numIndices, Layout layout, D3D11_PRIMITIVE_TOPOLOGY primitiveType, Vbo *indexBuffer, Vbo *staticBuffer, Vbo *dynamicBuffer );
180  VboMesh( size_t numVertices, size_t numIndices, Layout layout, GLenum primitiveType, Vbo *indexBuffer, Vbo *staticBuffer, Vbo *dynamicBuffer );
181 
182  size_t getNumIndices() const { return mObj->mNumIndices; }
183  size_t getNumVertices() const { return mObj->mNumVertices; }
184  D3D11_PRIMITIVE_TOPOLOGY getPrimitiveType() const { return mObj->mPrimitiveType; }
185 
186  const Layout& getLayout() const { return mObj->mLayout; }
187 
188  void bindIndexBuffer() const;
189  //void enableClientStates() const;
190  //void disableClientStates() const;
191  void bindAllData() const;
192  //static void unbindBuffers();
193 
194  void bufferIndices( const std::vector<uint32_t> &indices );
195  void bufferPositions( const std::vector<Vec3f> &positions );
196  void bufferPositions( const Vec3f *positions, size_t count );
197  void bufferNormals( const std::vector<Vec3f> &normals );
198  void bufferTexCoords2d( size_t unit, const std::vector<Vec2f> &texCoords );
199  void bufferTexCoords3d( size_t unit, const std::vector<Vec3f> &texCoords );
200  void bufferColorsRGB( const std::vector<Color> &colors );
201  void bufferColorsRGBA( const std::vector<ColorA> &colors );
202  class VertexIter mapVertexBuffer();
203 
204  Vbo& getIndexVbo() const { return mObj->mBuffers[INDEX_BUFFER]; }
205  Vbo& getStaticVbo() const { return mObj->mBuffers[STATIC_BUFFER]; }
206  Vbo& getDynamicVbo() const { return mObj->mBuffers[DYNAMIC_BUFFER]; }
207 
208  //void setCustomStaticLocation( size_t internalIndex, GLuint location ) { mObj->mCustomStaticLocations[internalIndex] = location; }
209  //void setCustomDynamicLocation( size_t internalIndex, GLuint location ) { mObj->mCustomDynamicLocations[internalIndex] = location; }
210 
211  size_t getTexCoordOffset( size_t unit ) const { return mObj->mTexCoordOffset[unit]; }
212  void setTexCoordOffset( size_t unit, size_t aTexCoordOffset ) { mObj->mTexCoordOffset[unit] = aTexCoordOffset; }
213 
215  typedef std::shared_ptr<Obj> VboMesh::*unspecified_bool_type;
217  operator unspecified_bool_type() const { return ( mObj.get() == 0 ) ? 0 : &VboMesh::mObj; }
218  void reset() { mObj.reset(); }
220 
221  class VertexIter {
222  public:
223  VertexIter( const VboMesh &mesh );
224 
225  void setPosition( const Vec3f &v ) { *(reinterpret_cast<Vec3f*>( &mPtr[mPositionOffset] )) = v; }
226  void setPosition( float x, float y, float z ) { *(reinterpret_cast<Vec3f*>( &mPtr[mPositionOffset] )) = Vec3f( x, y, z ); }
227  void setNormal( const Vec3f &n ) { *(reinterpret_cast<Vec3f*>( &mPtr[mNormalOffset] )) = n; }
228  void setColorRGB( const Color &n ) { *(reinterpret_cast<Color*>( &mPtr[mColorRGBOffset] )) = n; }
229  void setColorRGBA( const ColorA &n ) { *(reinterpret_cast<ColorA*>( &mPtr[mColorRGBAOffset] )) = n; }
230  void setTexCoord2d0( const Vec2f &t ) { *(reinterpret_cast<Vec2f*>( &mPtr[mTexCoordOffset[0]] )) = t; }
231  void setTexCoord3d0( const Vec3f &t ) { *(reinterpret_cast<Vec3f*>( &mPtr[mTexCoordOffset[0]] )) = t; }
232  void setTexCoord2d1( const Vec2f &t ) { *(reinterpret_cast<Vec2f*>( &mPtr[mTexCoordOffset[1]] )) = t; }
233  void setTexCoord3d1( const Vec3f &t ) { *(reinterpret_cast<Vec3f*>( &mPtr[mTexCoordOffset[1]] )) = t; }
234  void setTexCoord2d2( const Vec2f &t ) { *(reinterpret_cast<Vec2f*>( &mPtr[mTexCoordOffset[2]] )) = t; }
235  void setTexCoord3d2( const Vec3f &t ) { *(reinterpret_cast<Vec3f*>( &mPtr[mTexCoordOffset[2]] )) = t; }
236  void setCustomFloat( size_t index, float v ) { *(reinterpret_cast<float*>( &mPtr[mObj->mCustomOffsets[index]] )) = v; }
237  void setCustomVec2f( size_t index, const Vec2f &v ) { *(reinterpret_cast<Vec2f*>( &mPtr[mObj->mCustomOffsets[index]] )) = v; }
238  void setCustomVec3f( size_t index, const Vec3f &v ) { *(reinterpret_cast<Vec3f*>( &mPtr[mObj->mCustomOffsets[index]] )) = v; }
239  void setCustomVec4f( size_t index, const Vec4f &v ) { *(reinterpret_cast<Vec4f*>( &mPtr[mObj->mCustomOffsets[index]] )) = v; }
240 
241  void operator++() { mPtr += mStride; }
242  bool isDone() const { return mPtr < mDataEnd; }
243 
245  size_t getIndex() const { return ( mPtr - mData ) / mStride; }
247  size_t getStride() const { return mStride; }
249  void* getPointer() const { return reinterpret_cast<void*>( mPtr ); }
251  Vec3f* getPositionPointer() const { return reinterpret_cast<Vec3f*>( &mPtr[mPositionOffset] ); }
252 
253 // VertexIter( const VertexIter &other ) { set( other ); }
254 // VertexIter& operator=( const VertexIter &other ) { set( other ); return *this; }
255 
256  protected:
257  void set( const VertexIter &other );
258 
259  struct Obj {
260  public:
261  Obj( const VboMesh &mesh );
262  ~Obj();
263 
264  uint8_t *mData, *mDataEnd;
265  std::vector<size_t> mCustomOffsets;
267  };
268 
269  std::shared_ptr<Obj> mObj;
270  uint8_t *mPtr;
271  uint8_t *mData, *mDataEnd; // we cache these from the Obj to reduce dereferencing
275  uint8_t mStride;
276  };
277 
278  protected:
279  void initializeBuffers( bool staticDataPlanar );
280 
281  std::shared_ptr<Obj> mObj;
282 };
283 
284 class VboExc : public std::exception {
285  public:
286  virtual const char* what() const throw() { return "OpenGL Vbo exception"; }
287 };
288 
289 class VboInvalidTargetExc : public VboExc {
290  public:
291  virtual const char* what() const throw() { return "OpenGL Vbo exception: Invalid Target"; }
292 };
293 
294 class VboFailedMapExc : public VboExc {
295  public:
296  virtual const char* what() const throw() { return "OpenGL Vbo exception: Map failure"; }
297 };
298 
299 class VboFailedUnmapExc : public VboExc {
300  public:
301  virtual const char* what() const throw() { return "OpenGL Vbo exception: Unmap failure"; }
302 };
303 
304 } } // namespace cinder::gl
D3D11_BIND_FLAG getTarget() const
Definition: DxVbo.h:47
Definition: DxVbo.h:73
Definition: DxVbo.h:146
void setCustomVec4f(size_t index, const Vec4f &v)
Definition: DxVbo.h:239
void bufferSubData(ptrdiff_t offset, size_t size, const void *data)
Definition: DxVbo.cpp:113
void bufferTexCoords3d(size_t unit, const std::vector< Vec3f > &texCoords)
Definition: DxVbo.cpp:1038
GLenum GLint GLint y
Definition: GLee.h:987
void setNormal(const Vec3f &n)
Definition: DxVbo.h:227
void setPosition(const Vec3f &v)
Definition: DxVbo.h:225
Definition: DxVbo.h:299
Definition: DxVbo.h:73
void initializeBuffers(bool staticDataPlanar)
Definition: DxVbo.cpp:377
bool hasDynamicTexCoords3d(size_t unit=0) const
Definition: DxVbo.h:114
size_t mPositionOffset
Definition: DxVbo.h:156
Definition: DxVbo.h:73
bool hasColorsRGBA() const
Definition: DxVbo.h:94
void setStaticColorsRGB()
Definition: DxVbo.h:91
virtual const char * what() const
Definition: DxVbo.h:301
size_t mNormalOffset
Definition: DxVbo.h:157
void addDynamicCustomFloat()
Definition: DxVbo.h:134
size_t mPositionOffset
Definition: DxVbo.h:272
Definition: DxVbo.h:146
void setStaticTexCoords2d(size_t unit=0)
Definition: DxVbo.h:103
size_t mNumVertices
Definition: DxVbo.h:153
bool hasTexCoords(size_t unit) const
Definition: DxVbo.h:110
Layout mLayout
Definition: DxVbo.h:162
size_t getNumIndices() const
Definition: DxVbo.h:182
bool mUseQuads
Definition: DxVbo.h:166
void setCustomVec2f(size_t index, const Vec2f &v)
Definition: DxVbo.h:237
void setTexCoord3d1(const Vec3f &t)
Definition: DxVbo.h:233
bool hasDynamicNormals() const
Definition: DxVbo.h:84
void reset()
Emulates shared_ptr-like behavior.
Definition: DxVbo.h:218
void bufferPositions(const std::vector< Vec3f > &positions)
Definition: DxVbo.cpp:889
void setTexCoord2d1(const Vec2f &t)
Definition: DxVbo.h:232
ID3D11Buffer * getId() const
Definition: DxVbo.h:48
VboMesh()
Definition: DxVbo.h:172
uint8_t * mData
Definition: DxVbo.h:271
Definition: DxVbo.h:51
VertexIter(const VboMesh &mesh)
Definition: DxVbo.cpp:1202
void setTexCoordOffset(size_t unit, size_t aTexCoordOffset)
Definition: DxVbo.h:212
Obj()
Definition: DxVbo.cpp:161
virtual const char * what() const
Definition: DxVbo.h:291
void setStaticPositions()
Definition: DxVbo.h:127
void setTexCoord2d0(const Vec2f &t)
Definition: DxVbo.h:230
bool hasStaticNormals() const
Definition: DxVbo.h:83
bool hasStaticColorsRGBA() const
Definition: DxVbo.h:95
void reset()
Emulates shared_ptr-like behavior.
Definition: DxVbo.h:66
GLuint index
Definition: GLee.h:2259
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:1011
Definition: DxVbo.h:284
void setTexCoord3d2(const Vec3f &t)
Definition: DxVbo.h:235
size_t mNormalOffset
Definition: DxVbo.h:272
Definition: DxVbo.h:70
ID3D11InputLayout * mInputLayout
Definition: DxVbo.h:165
size_t getStride() const
Definition: DxVbo.h:247
class VertexIter mapVertexBuffer()
Definition: DxVbo.cpp:1182
std::shared_ptr< Obj > mObj
Definition: DxVbo.h:269
void setDynamicPositions()
Definition: DxVbo.h:128
void addDynamicCustomVec4f()
Definition: DxVbo.h:137
void bufferColorsRGB(const std::vector< Color > &colors)
Definition: DxVbo.cpp:1086
void operator++()
Definition: DxVbo.h:241
bool isDone() const
Definition: DxVbo.h:242
size_t getTexCoordOffset(size_t unit) const
Definition: DxVbo.h:211
bool hasDynamicColorsRGB() const
Definition: DxVbo.h:90
Vbo mBuffers[TOTAL_BUFFERS]
Definition: DxVbo.h:155
Vbo & getIndexVbo() const
Definition: DxVbo.h:204
bool hasTexCoords2d(size_t unit=0) const
Definition: DxVbo.h:100
bool hasDynamicTexCoords() const
Definition: DxVbo.cpp:152
~Obj()
Definition: DxVbo.cpp:72
Vbo & getDynamicVbo() const
Definition: DxVbo.h:206
~Obj()
Definition: DxVbo.cpp:165
void setDynamicNormals()
Definition: DxVbo.h:86
Definition: DxVbo.h:149
uint8_t * mData
Definition: DxVbo.h:264
void setStaticColorsRGBA()
Definition: DxVbo.h:97
size_t mStaticStride
Definition: DxVbo.h:160
uint8_t mStride
Definition: DxVbo.h:275
std::vector< std::pair< CustomAttr, size_t > > mCustomStatic
Definition: DxVbo.h:140
const Layout & getLayout() const
Definition: DxVbo.h:186
size_t mColorRGBAOffset
Definition: DxVbo.h:273
Definition: DxVbo.h:221
Definition: DxVbo.h:289
std::shared_ptr< Obj > mObj
Definition: DxVbo.h:281
Vec3< float > Vec3f
Definition: Vector.h:1317
void set(const VertexIter &other)
Definition: DxVbo.cpp:1187
bool hasPositions() const
Definition: DxVbo.h:124
uint8_t * map(D3D11_MAP access)
Definition: DxVbo.cpp:130
void bindIndexBuffer() const
Definition: DxVbo.cpp:855
void bufferColorsRGBA(const std::vector< ColorA > &colors)
Definition: DxVbo.cpp:1134
void setColorRGBA(const ColorA &n)
Definition: DxVbo.h:229
Vbo & getStaticVbo() const
Definition: DxVbo.h:205
Definition: DxVbo.h:72
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: GLee.h:963
CustomAttr
Definition: DxVbo.h:130
Obj(const VboMesh &mesh)
Definition: DxVbo.cpp:1220
void bufferNormals(const std::vector< Vec3f > &normals)
Definition: DxVbo.cpp:942
bool hasStaticTexCoords3d(size_t unit=0) const
Definition: DxVbo.h:113
std::vector< size_t > mCustomOffsets
Definition: DxVbo.h:265
ID3D11Buffer * mId
Definition: DxVbo.h:56
void addDynamicCustomVec3f()
Definition: DxVbo.h:136
GLintptr GLsizeiptr GLbitfield access
Definition: GLee.h:5533
void bufferIndices(const std::vector< uint32_t > &indices)
Definition: DxVbo.cpp:867
bool hasDynamicIndices() const
Definition: DxVbo.h:120
void setDynamicColorsRGBA()
Definition: DxVbo.h:98
void unmap()
Definition: DxVbo.cpp:137
GLenum GLint x
Definition: GLee.h:987
void * getPointer() const
Definition: DxVbo.h:249
bool hasStaticPositions() const
Definition: DxVbo.h:125
GLintptr offset
Definition: GLee.h:2095
GLuint GLuint GLsizei count
Definition: GLee.h:963
size_t mColorRGBAOffset
Definition: DxVbo.h:158
void bufferTexCoords2d(size_t unit, const std::vector< Vec2f > &texCoords)
Definition: DxVbo.cpp:990
GLenum GLsizei n
Definition: GLee.h:5780
Vbo(bool createBuffer=false)
Definition: DxVbo.cpp:77
bool hasIndices() const
Definition: DxVbo.h:118
std::shared_ptr< Obj > Vbo::* unspecified_bool_type
Emulates shared_ptr-like behavior.
Definition: DxVbo.h:64
bool hasDynamicPositions() const
Definition: DxVbo.h:126
Layout()
Definition: DxVbo.h:77
D3D11_BIND_FLAG mTarget
Definition: DxVbo.h:55
size_t mColorRGBOffset
Definition: DxVbo.h:158
Obj()
Definition: DxVbo.cpp:68
const GLdouble * v
Definition: GLee.h:1384
static int sCustomAttrSizes[TOTAL_CUSTOM_ATTR_TYPES]
Definition: DxVbo.h:131
static GLenum sCustomAttrTypes[TOTAL_CUSTOM_ATTR_TYPES]
Definition: DxVbo.h:133
GLdouble GLdouble z
Definition: GLee.h:1911
std::shared_ptr< Obj > mObj
Definition: DxVbo.h:59
void setCustomVec3f(size_t index, const Vec3f &v)
Definition: DxVbo.h:238
void setStaticIndices()
Definition: DxVbo.h:121
void setDynamicTexCoords3d(size_t unit=0)
Definition: DxVbo.h:116
size_t getNumVertices() const
Definition: DxVbo.h:183
uint8_t * mDataEnd
Definition: DxVbo.h:271
bool hasDynamicColorsRGBA() const
Definition: DxVbo.h:96
size_t getIndex() const
Definition: DxVbo.h:245
bool hasStaticTexCoords() const
Definition: DxVbo.cpp:143
std::shared_ptr< Obj > VboMesh::* unspecified_bool_type
Emulates shared_ptr-like behavior.
Definition: DxVbo.h:216
D3D11_PRIMITIVE_TOPOLOGY mPrimitiveType
Definition: DxVbo.h:161
GLboolean GLboolean GLboolean GLboolean a
Definition: GLee.h:2964
size_t mNumIndices
Definition: DxVbo.h:153
virtual const char * what() const
Definition: DxVbo.h:296
Definition: DxVbo.h:146
int int int * dx
Definition: GLee.h:17162
bool hasStaticColorsRGB() const
Definition: DxVbo.h:89
void setTexCoord2d2(const Vec2f &t)
Definition: DxVbo.h:234
int mAttributes[ATTR_TOTAL]
Definition: DxVbo.h:139
static GLint sCustomAttrNumComponents[TOTAL_CUSTOM_ATTR_TYPES]
Definition: DxVbo.h:132
Definition: DxVbo.h:76
void addDynamicCustomVec2f()
Definition: DxVbo.h:135
uint8_t * mDataEnd
Definition: DxVbo.h:264
int GLint
Definition: gldx.h:51
Definition: DxVbo.h:34
GLsizeiptr const GLvoid GLenum usage
Definition: GLee.h:2089
uint8_t * mPtr
Definition: DxVbo.h:270
size_t mDynamicStride
Definition: DxVbo.h:160
virtual const char * what() const
Definition: DxVbo.h:286
void bufferData(size_t size, const void *data, D3D11_USAGE usage, D3D11_BIND_FLAG bindFlags, D3D11_CPU_ACCESS_FLAG cpuAccess)
Definition: DxVbo.cpp:91
size_t mTexCoordOffset[ATTR_MAX_TEXTURE_UNIT+1]
Definition: DxVbo.h:159
size_t mTexCoordOffset[ATTR_MAX_TEXTURE_UNIT+1]
Definition: DxVbo.h:274
void setTexCoord3d0(const Vec3f &t)
Definition: DxVbo.h:231
bool hasColorsRGB() const
Definition: DxVbo.h:88
bool hasStaticIndices() const
Definition: DxVbo.h:119
Vec3f * getPositionPointer() const
Definition: DxVbo.h:251
std::vector< std::pair< CustomAttr, size_t > > mCustomDynamic
Definition: DxVbo.h:140
bool hasDynamicTexCoords2d(size_t unit=0) const
Definition: DxVbo.h:102
void setDynamicColorsRGB()
Definition: DxVbo.h:92
size_t mColorRGBOffset
Definition: DxVbo.h:273
void bindAllData() const
Definition: DxVbo.cpp:763
GLdouble GLdouble t
Definition: GLee.h:1426
void setStaticNormals()
Definition: DxVbo.h:85
bool hasTexCoords3d(size_t unit=0) const
Definition: DxVbo.h:112
Definition: TriMesh.h:167
bool isDefaults() const
Definition: DxVbo.h:80
Definition: DxVbo.h:294
Definition: DxVbo.h:72
void setColorRGB(const Color &n)
Definition: DxVbo.h:228
void setStaticTexCoords3d(size_t unit=0)
Definition: DxVbo.h:115
void setPosition(float x, float y, float z)
Definition: DxVbo.h:226
void setDynamicTexCoords2d(size_t unit=0)
Definition: DxVbo.h:104
bool hasStaticTexCoords2d(size_t unit=0) const
Definition: DxVbo.h:101
GLsizeiptr size
Definition: GLee.h:2089
bool hasNormals() const
Definition: DxVbo.h:82
unsigned int GLenum
Definition: gldx.h:46
Definition: TriMesh.h:66
Definition: DxVbo.h:72
void setCustomFloat(size_t index, float v)
Definition: DxVbo.h:236
~Obj()
Definition: DxVbo.cpp:1234
void setDynamicIndices()
Definition: DxVbo.h:122
D3D11_PRIMITIVE_TOPOLOGY getPrimitiveType() const
Definition: DxVbo.h:184
Vbo mVbo
Definition: DxVbo.h:266