OgreDefaultHardwareBufferManager.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __DefaultHardwareBufferManager_H__
#define __DefaultHardwareBufferManager_H__
#include "OgrePrerequisites.h"
#include "OgreHardwareBufferManager.h"
#include "OgreHardwareCounterBuffer.h"
#include "OgreHardwareIndexBuffer.h"
#include "OgreHardwareUniformBuffer.h"
#include "OgreHardwareVertexBuffer.h"
namespace Ogre {
class _OgreExport DefaultHardwareVertexBuffer : public HardwareVertexBuffer
{
protected:
unsigned char* mData;
void* lockImpl(size_t offset, size_t length, LockOptions options);
void unlockImpl(void);
public:
DefaultHardwareVertexBuffer(size_t vertexSize, size_t numVertices, HardwareBuffer::Usage usage);
DefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices,
HardwareBuffer::Usage usage);
~DefaultHardwareVertexBuffer();
void readData(size_t offset, size_t length, void* pDest);
void writeData(size_t offset, size_t length, const void* pSource,
bool discardWholeBuffer = false);
void* lock(size_t offset, size_t length, LockOptions options);
void unlock(void);
};
class _OgreExport DefaultHardwareIndexBuffer : public HardwareIndexBuffer
{
protected:
unsigned char* mData;
void* lockImpl(size_t offset, size_t length, LockOptions options);
void unlockImpl(void);
public:
DefaultHardwareIndexBuffer(IndexType idxType, size_t numIndexes, HardwareBuffer::Usage usage);
~DefaultHardwareIndexBuffer();
void readData(size_t offset, size_t length, void* pDest);
void writeData(size_t offset, size_t length, const void* pSource,
bool discardWholeBuffer = false);
void* lock(size_t offset, size_t length, LockOptions options);
void unlock(void);
};
class _OgreExport DefaultHardwareUniformBuffer : public HardwareUniformBuffer
{
protected:
unsigned char* mData;
void* lockImpl(size_t offset, size_t length, LockOptions options);
void unlockImpl(void);
//bool updateStructure(const Any& renderSystemInfo);
public:
DefaultHardwareUniformBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
~DefaultHardwareUniformBuffer();
void readData(size_t offset, size_t length, void* pDest);
void writeData(size_t offset, size_t length, const void* pSource,
bool discardWholeBuffer = false);
void* lock(size_t offset, size_t length, LockOptions options);
void unlock(void);
};
class _OgreExport DefaultHardwareCounterBuffer : public HardwareCounterBuffer
{
protected:
unsigned char* mData;
void* lockImpl(size_t offset, size_t length, LockOptions options);
void unlockImpl(void);
//bool updateStructure(const Any& renderSystemInfo);
public:
DefaultHardwareCounterBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
~DefaultHardwareCounterBuffer();
void readData(size_t offset, size_t length, void* pDest);
void writeData(size_t offset, size_t length, const void* pSource,
bool discardWholeBuffer = false);
void* lock(size_t offset, size_t length, LockOptions options);
void unlock(void);
};
class _OgreExport DefaultHardwareBufferManagerBase : public HardwareBufferManagerBase
{
public:
DefaultHardwareBufferManagerBase();
~DefaultHardwareBufferManagerBase();
HardwareVertexBufferSharedPtr
createVertexBuffer(size_t vertexSize, size_t numVerts,
HardwareBuffer::Usage usage, bool useShadowBuffer = false);
HardwareIndexBufferSharedPtr
createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
HardwareBuffer::Usage usage, bool useShadowBuffer = false);
RenderToVertexBufferSharedPtr createRenderToVertexBuffer();
HardwareUniformBufferSharedPtr createUniformBuffer(size_t sizeBytes,
HardwareBuffer::Usage usage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
bool useShadowBuffer = false, const String& name = "");
HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes,
HardwareBuffer::Usage usage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
bool useShadowBuffer = false, const String& name = "");
};
class _OgreExport DefaultHardwareBufferManager : public HardwareBufferManager
{
public:
DefaultHardwareBufferManager()
: HardwareBufferManager(OGRE_NEW DefaultHardwareBufferManagerBase())
{
}
~DefaultHardwareBufferManager()
{
OGRE_DELETE mImpl;
}
};
}
#endif
Ogre::DefaultHardwareIndexBuffer::mData
unsigned char * mData
Definition: OgreDefaultHardwareBufferManager.h:78
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::DefaultHardwareVertexBuffer::mData
unsigned char * mData
Definition: OgreDefaultHardwareBufferManager.h:51
Ogre::HardwareIndexBufferSharedPtr
Shared pointer implementation used to share index buffers.
Definition: OgreHardwareIndexBuffer.h:79
Ogre::DefaultHardwareUniformBuffer
Specialisation of HardwareUniformBuffer for emulation.
Definition: OgreDefaultHardwareBufferManager.h:99
OGRE_DELETE
#define OGRE_DELETE
Definition: OgreMemoryAllocatorConfig.h:474
Ogre::DefaultHardwareVertexBuffer
Specialisation of HardwareVertexBuffer for emulation.
Definition: OgreDefaultHardwareBufferManager.h:48
OgreHardwareIndexBuffer.h
Ogre::DefaultHardwareCounterBuffer
Specialisation of HardwareCounterBuffer for emulation.
Definition: OgreDefaultHardwareBufferManager.h:125
Ogre::HardwareBufferManager
Singleton wrapper for hardware buffer manager.
Definition: OgreHardwareBufferManager.h:429
Ogre::DefaultHardwareBufferManager::~DefaultHardwareBufferManager
~DefaultHardwareBufferManager()
Definition: OgreDefaultHardwareBufferManager.h:191
Ogre::HardwareIndexBuffer
Specialisation of HardwareBuffer for vertex index buffers, still abstract.
Definition: OgreHardwareIndexBuffer.h:46
Ogre::DefaultHardwareBufferManagerBase
Specialisation of HardwareBufferManagerBase to emulate hardware buffers.
Definition: OgreDefaultHardwareBufferManager.h:157
OGRE_NEW
#define OGRE_NEW
Definition: OgreMemoryAllocatorConfig.h:473
OgreHardwareBufferManager.h
Ogre::DefaultHardwareBufferManager::DefaultHardwareBufferManager
DefaultHardwareBufferManager()
Definition: OgreDefaultHardwareBufferManager.h:186
Ogre::HardwareCounterBufferSharedPtr
Shared pointer implementation used to share counter buffers.
Definition: OgreHardwareCounterBuffer.h:68
Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE
Combination of HBU_DYNAMIC, HBU_WRITE_ONLY and HBU_DISCARDABLE.
Definition: OgreHardwareBuffer.h:116
Ogre::HardwareCounterBuffer
Specialisation of HardwareBuffer for a counter buffer.
Definition: OgreHardwareCounterBuffer.h:49
Ogre::HardwareUniformBuffer
Specialisation of HardwareBuffer for a uniform buffer.
Definition: OgreHardwareUniformBuffer.h:49
Ogre::HardwareVertexBufferSharedPtr
Shared pointer implementation used to share vertex buffers.
Definition: OgreHardwareVertexBuffer.h:86
OgrePrerequisites.h
Ogre::HardwareBufferManagerBase
Base definition of a hardware buffer manager.
Definition: OgreHardwareBufferManager.h:113
Ogre::DefaultHardwareBufferManager
DefaultHardwareBufferManager as a Singleton.
Definition: OgreDefaultHardwareBufferManager.h:183
Ogre::HardwareBuffer::Usage
Usage
Enums describing buffer usage; not mutually exclusive.
Definition: OgreHardwareBuffer.h:79
OgreHardwareVertexBuffer.h
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::HardwareIndexBuffer::IndexType
IndexType
Definition: OgreHardwareIndexBuffer.h:49
Ogre::DefaultHardwareUniformBuffer::mData
unsigned char * mData
Definition: OgreDefaultHardwareBufferManager.h:102
Ogre::HardwareBuffer::LockOptions
LockOptions
Locking options.
Definition: OgreHardwareBuffer.h:121
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::SharedPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Definition: OgrePrerequisites.h:310
Ogre::DefaultHardwareIndexBuffer
Specialisation of HardwareIndexBuffer for emulation.
Definition: OgreDefaultHardwareBufferManager.h:75
OgreHardwareCounterBuffer.h
OgreHardwareUniformBuffer.h
Ogre::HardwareUniformBufferSharedPtr
Shared pointer implementation used to share uniform buffers.
Definition: OgreHardwareUniformBuffer.h:68
Ogre::DefaultHardwareCounterBuffer::mData
unsigned char * mData
Definition: OgreDefaultHardwareBufferManager.h:128

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.