OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGL3PlusDefaultHardwareBufferManager.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __GL3PlusDefaultHardwareBufferManager_H__
30 #define __GL3PlusDefaultHardwareBufferManager_H__
31 
38 
39 namespace Ogre {
42  {
43  protected:
44  unsigned char* mData;
46  void* lockImpl(size_t offset, size_t length, LockOptions options);
48  void unlockImpl(void);
49 
50  public:
51  GL3PlusDefaultHardwareVertexBuffer(size_t vertexSize, size_t numVertices,
52  HardwareBuffer::Usage usage);
53  GL3PlusDefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices,
54  HardwareBuffer::Usage usage);
57  void readData(size_t offset, size_t length, void* pDest);
59  void writeData(size_t offset, size_t length, const void* pSource,
60  bool discardWholeBuffer = false);
62  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
64  void unlock(void);
65 
66  void* getDataPtr(size_t offset) const { return (void*)(mData + offset); }
67  };
68 
71  {
72  protected:
73  unsigned char* mData;
75  void* lockImpl(size_t offset, size_t length, LockOptions options);
77  void unlockImpl(void);
78  public:
79  GL3PlusDefaultHardwareIndexBuffer(IndexType idxType, size_t numIndexes, HardwareBuffer::Usage usage);
82  void readData(size_t offset, size_t length, void* pDest);
84  void writeData(size_t offset, size_t length, const void* pSource,
85  bool discardWholeBuffer = false);
87  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
89  void unlock(void);
90 
91  void* getDataPtr(size_t offset) const { return (void*)(mData + offset); }
92  };
93 
96  {
97  protected:
98  unsigned char* mData;
100  void* lockImpl(size_t offset, size_t length, LockOptions options);
102  void unlockImpl(void);
103 
104  public:
105  GL3PlusDefaultHardwareUniformBuffer(size_t bufferSize, HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name);
107  HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name);
110  void readData(size_t offset, size_t length, void* pDest);
112  void writeData(size_t offset, size_t length, const void* pSource,
113  bool discardWholeBuffer = false);
115  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
117  void unlock(void);
118 
119  void* getDataPtr(size_t offset) const { return (void*)(mData + offset); }
120  };
121 
124  {
125  protected:
126  unsigned char* mData;
128  void* lockImpl(size_t offset, size_t length, LockOptions options);
130  void unlockImpl(void);
131 
132  public:
137  void readData(size_t offset, size_t length, void* pDest);
139  void writeData(size_t offset, size_t length, const void* pSource,
140  bool discardWholeBuffer = false);
142  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
144  void unlock(void);
145 
146  void* getDataPtr(size_t offset) const { return (void*)(mData + offset); }
147  };
148 
157  {
158  public:
163  createVertexBuffer(size_t vertexSize, size_t numVerts,
164  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
167  createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
168  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
171  createUniformBuffer(size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name = "");
174  createCounterBuffer(size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name = "");
176  RenderToVertexBufferSharedPtr createRenderToVertexBuffer(void);
177  };
178 
181  {
182  public:
185  {
186 
187  }
189  {
190  OGRE_DELETE mImpl;
191  }
192  };
193 }
194 
195 #endif
Singleton wrapper for hardware buffer manager.
Shared pointer implementation used to share uniform buffers.
Specialisation of HardwareBuffer for vertex index buffers, still abstract.
Specialisation of HardwareBuffer for a counter buffer.
Shared pointer implementation used to share vertex buffers.
Specialisation of HardwareBufferManager to emulate hardware buffers.
Specialisation of HardwareCounterBuffer for emulation.
Specialisation of HardwareUniformBuffer for emulation.
Shared pointer implementation used to share index buffers.
LockOptions
Locking options.
Base definition of a hardware buffer manager.
Specialisation of HardwareBuffer for a uniform buffer.
Usage
Enums describing buffer usage; not mutually exclusive.
UploadOptions
Device load options The following enum is used to controls how data is loaded to devices in a multi d...
#define OGRE_DELETE
GL3PlusDefaultHardwareBufferManagerBase as a Singleton.
#define _OgreGL3PlusExport
#define OGRE_NEW
Shared pointer implementation used to share counter buffers.
Specialisation of HardwareBuffer for a vertex buffer.
Specialisation of HardwareVertexBuffer for emulation.
Reference-counted shared pointer, used for objects where implicit destruction is required.
_StringBase String
Definition: OgreCommon.h:53
Specialisation of HardwareIndexBuffer for emulation.