OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGLES2DefaultHardwareBufferManager.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 __GLES2DefaultHardwareBufferManager_H__
30 #define __GLES2DefaultHardwareBufferManager_H__
31 
32 #include "OgreGLES2Prerequisites.h"
37 
38 namespace Ogre {
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  GLES2DefaultHardwareVertexBuffer(size_t vertexSize, size_t numVertices,
51  HardwareBuffer::Usage usage);
52  GLES2DefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices,
53  HardwareBuffer::Usage usage);
56  void readData(size_t offset, size_t length, void* pDest);
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(size_t offset) const { return (void*)(mData + offset); }
66  };
67 
70  {
71  protected:
72  unsigned char* mData;
74  void* lockImpl(size_t offset, size_t length, LockOptions options);
76  void unlockImpl(void);
77 
78  public:
79  GLES2DefaultHardwareIndexBuffer(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 
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  GLES2DefaultHardwareUniformBuffer(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);
117  void unlock(void);
118 
119  void* getDataPtr(size_t offset) const { return (void*)(mData + offset); }
120  };
121 
130  {
131  public:
136  createVertexBuffer(size_t vertexSize, size_t numVerts,
137  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
140  createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
141  HardwareBuffer::Usage usage, bool useShadowBuffer = false);
143  RenderToVertexBufferSharedPtr createRenderToVertexBuffer(void);
144 
146  createUniformBuffer(size_t sizeBytes, HardwareBuffer::Usage usage,bool useShadowBuffer, const String& name = "");
147 
150  bool useShadowBuffer = false, const String& name = "")
151  {
153  "GLES2 does not support atomic counter buffers",
154  "GLES2DefaultHardwareBufferManagerBase::createCounterBuffer");
155  }
156  };
157 
160  {
161  public:
164  {
165 
166  }
168  {
169  OGRE_DELETE mImpl;
170  }
171  };
172 }
173 
174 #endif
Singleton wrapper for hardware buffer manager.
Shared pointer implementation used to share uniform buffers.
HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes, HardwareBuffer::Usage usage=HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, bool useShadowBuffer=false, const String &name="")
Create counter buffer.
#define _OgreGLES2Export
Specialisation of HardwareIndexBuffer for emulation.
Specialisation of HardwareBuffer for vertex index buffers, still abstract.
Shared pointer implementation used to share vertex buffers.
Specialisation of HardwareVertexBuffer for emulation.
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 HardwareBuffer for a uniform buffer.
Usage
Enums describing buffer usage; not mutually exclusive.
Specialisation of HardwareBufferManager to emulate hardware buffers.
#define OGRE_DELETE
#define OGRE_EXCEPT(code, desc, src)
#define OGRE_NEW
GLES2DefaultHardwareBufferManagerBase as a Singleton.
Shared pointer implementation used to share counter buffers.
Specialisation of HardwareBuffer for a vertex buffer.
Reference-counted shared pointer, used for objects where implicit destruction is required.
_StringBase String
Specialisation of HardwareUniformBuffer for emulation.