OgreGLDefaultHardwareBufferManager.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-2013 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 __GLDefaultHardwareBufferManager_H__
30 #define __GLDefaultHardwareBufferManager_H__
31 
32 #include "OgreGLPrerequisites.h"
36 
37 namespace Ogre {
38 
41  {
42  protected:
43  unsigned char* mData;
45  void* lockImpl(size_t offset, size_t length, LockOptions options);
47  void unlockImpl(void);
48 
49  public:
50  GLDefaultHardwareVertexBuffer(size_t vertexSize, size_t numVertices, HardwareBuffer::Usage usage);
51  GLDefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices,
52  HardwareBuffer::Usage usage);
55  void readData(size_t offset, size_t length, void* pDest);
57 
58  void writeData(size_t offset, size_t length, const void* pSource,
59  bool discardWholeBuffer = false);
61  void* lock(size_t offset, size_t length, LockOptions options);
63  void unlock(void);
64 
65  //void* getDataPtr(void) const { return (void*)mData; }
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  GLDefaultHardwareIndexBuffer(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);
89  void unlock(void);
90 
91  void* getDataPtr(size_t offset) const { return (void*)(mData + offset); }
92  };
93 
102  {
103  public:
108  createVertexBuffer(size_t vertexSize, size_t numVerts,
109  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
112  createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
113  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
115  RenderToVertexBufferSharedPtr createRenderToVertexBuffer();
118  createUniformBuffer(size_t sizeBytes, HardwareBuffer::Usage usage,bool useShadowBuffer, const String& name = "");
119  HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes,
121  bool useShadowBuffer = false, const String& name = "");
122  };
123 
126  {
127  public:
130  {
131 
132  }
134  {
135  OGRE_DELETE mImpl;
136  }
137  };
138 }
139 
140 #endif
Shared pointer implementation used to share index buffers.
Specialisation of HardwareBufferManager to emulate hardware buffers.
#define OGRE_DELETE
Specialisation of HardwareBuffer for a vertex buffer.
Singleton wrapper for hardware buffer manager.
GLDefaultHardwareBufferManagerBase as a Singleton.
Specialisation of HardwareBuffer for vertex index buffers, still abstract.
#define OGRE_NEW
Specialisation of HardwareVertexBuffer for emulation.
Shared pointer implementation used to share counter buffers.
Combination of HBU_DYNAMIC, HBU_WRITE_ONLY and HBU_DISCARDABLE.
Shared pointer implementation used to share vertex buffers.
Base definition of a hardware buffer manager.
#define _OgreGLExport
Usage
Enums describing buffer usage; not mutually exclusive.
Specialisation of HardwareIndexBuffer for emulation.
_StringBase String
LockOptions
Locking options.
Reference-counted shared pointer, used for objects where implicit destruction is required.
Shared pointer implementation used to share uniform buffers.

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Mar 18 2014 19:15:25