OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreDefaultHardwareBufferManager.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 __DefaultHardwareBufferManager_H__
30 #define __DefaultHardwareBufferManager_H__
31 
32 #include "OgrePrerequisites.h"
38 
39 namespace Ogre {
47  class _OgreExport DefaultHardwareVertexBuffer : public HardwareVertexBuffer
49  {
50  protected:
51  unsigned char* mData;
53  void* lockImpl(size_t offset, size_t length, LockOptions options);
55  void unlockImpl(void);
56  public:
57  DefaultHardwareVertexBuffer(size_t vertexSize, size_t numVertices, HardwareBuffer::Usage usage);
58  DefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices,
59  HardwareBuffer::Usage usage);
62  void readData(size_t offset, size_t length, void* pDest);
64  void writeData(size_t offset, size_t length, const void* pSource,
65  bool discardWholeBuffer = false);
67  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
69  void unlock(void);
70 
71 
72  };
73 
76  {
77  protected:
78  unsigned char* mData;
80  void* lockImpl(size_t offset, size_t length, LockOptions options);
82  void unlockImpl(void);
83  public:
84  DefaultHardwareIndexBuffer(IndexType idxType, size_t numIndexes, HardwareBuffer::Usage usage);
87  void readData(size_t offset, size_t length, void* pDest);
89  void writeData(size_t offset, size_t length, const void* pSource,
90  bool discardWholeBuffer = false);
92  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
94  void unlock(void);
95 
96  };
97 
100  {
101  protected:
102  unsigned char* mData;
104  void* lockImpl(size_t offset, size_t length, LockOptions options);
106  void unlockImpl(void);
108  //bool updateStructure(const Any& renderSystemInfo);
109 
110  public:
111  DefaultHardwareUniformBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
114  void readData(size_t offset, size_t length, void* pDest);
116  void writeData(size_t offset, size_t length, const void* pSource,
117  bool discardWholeBuffer = false);
119  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
121  void unlock(void);
122  };
123 
126  {
127  protected:
128  unsigned char* mData;
130  void* lockImpl(size_t offset, size_t length, LockOptions options);
132  void unlockImpl(void);
134  //bool updateStructure(const Any& renderSystemInfo);
135 
136  public:
137  DefaultHardwareCounterBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
140  void readData(size_t offset, size_t length, void* pDest);
142  void writeData(size_t offset, size_t length, const void* pSource,
143  bool discardWholeBuffer = false);
145  void* lock(size_t offset, size_t length, LockOptions options, UploadOptions uploadOpt = HBU_DEFAULT);
147  void unlock(void);
148  };
149 
158  {
159  public:
164  createVertexBuffer(size_t vertexSize, size_t numVerts,
165  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
168  createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
169  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
171  RenderToVertexBufferSharedPtr createRenderToVertexBuffer();
173  HardwareUniformBufferSharedPtr createUniformBuffer(size_t sizeBytes,
175  bool useShadowBuffer = false, const String& name = "");
177  HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes,
179  bool useShadowBuffer = false, const String& name = "");
180  };
181 
184  {
185  public:
188  {
189 
190  }
192  {
193  OGRE_DELETE mImpl;
194  }
195  };
196 
200 }
201 
202 #endif
#define _OgreExport
Definition: OgrePlatform.h:255
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 HardwareVertexBuffer for emulation.
Specialisation of HardwareBuffer for a counter buffer.
Shared pointer implementation used to share vertex buffers.
Specialisation of HardwareIndexBuffer for emulation.
Specialisation of HardwareUniformBuffer for emulation.
Specialisation of HardwareCounterBuffer for emulation.
DefaultHardwareBufferManager as a Singleton.
Combination of HBU_DYNAMIC, HBU_WRITE_ONLY and HBU_DISCARDABLE.
Shared pointer implementation used to share index buffers.
LockOptions
Locking options.
Base definition of a hardware buffer manager.
Specialisation of HardwareBufferManagerBase to emulate hardware buffers.
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
#define OGRE_NEW
Shared pointer implementation used to share counter buffers.
Reference-counted shared pointer, used for objects where implicit destruction is required.
_StringBase String
Definition: OgreCommon.h:53