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-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef __DefaultHardwareBufferManager_H__
|
---|
27 | #define __DefaultHardwareBufferManager_H__
|
---|
28 |
|
---|
29 | #include "OgrePrerequisites.h"
|
---|
30 | #include "OgreHardwareBufferManager.h"
|
---|
31 | #include "OgreHardwareVertexBuffer.h"
|
---|
32 | #include "OgreHardwareIndexBuffer.h"
|
---|
33 |
|
---|
34 | namespace Ogre {
|
---|
35 |
|
---|
36 | /// Specialisation of HardwareVertexBuffer for emulation
|
---|
37 | class _OgreExport DefaultHardwareVertexBuffer : public HardwareVertexBuffer
|
---|
38 | {
|
---|
39 | protected:
|
---|
40 | unsigned char* mpData;
|
---|
41 | /** See HardwareBuffer. */
|
---|
42 | void* lockImpl(size_t offset, size_t length, LockOptions options);
|
---|
43 | /** See HardwareBuffer. */
|
---|
44 | void unlockImpl(void);
|
---|
45 | public:
|
---|
46 | DefaultHardwareVertexBuffer(size_t vertexSize, size_t numVertices,
|
---|
47 | HardwareBuffer::Usage usage);
|
---|
48 | ~DefaultHardwareVertexBuffer();
|
---|
49 | /** See HardwareBuffer. */
|
---|
50 | void readData(size_t offset, size_t length, void* pDest);
|
---|
51 | /** See HardwareBuffer. */
|
---|
52 | void writeData(size_t offset, size_t length, const void* pSource,
|
---|
53 | bool discardWholeBuffer = false);
|
---|
54 | /** Override HardwareBuffer to turn off all shadowing. */
|
---|
55 | void* lock(size_t offset, size_t length, LockOptions options);
|
---|
56 | /** Override HardwareBuffer to turn off all shadowing. */
|
---|
57 | void unlock(void);
|
---|
58 |
|
---|
59 |
|
---|
60 | };
|
---|
61 |
|
---|
62 | /// Specialisation of HardwareIndexBuffer for emulation
|
---|
63 | class _OgreExport DefaultHardwareIndexBuffer : public HardwareIndexBuffer
|
---|
64 | {
|
---|
65 | protected:
|
---|
66 | unsigned char* mpData;
|
---|
67 | /** See HardwareBuffer. */
|
---|
68 | void* lockImpl(size_t offset, size_t length, LockOptions options);
|
---|
69 | /** See HardwareBuffer. */
|
---|
70 | void unlockImpl(void);
|
---|
71 | public:
|
---|
72 | DefaultHardwareIndexBuffer(IndexType idxType, size_t numIndexes, HardwareBuffer::Usage usage);
|
---|
73 | ~DefaultHardwareIndexBuffer();
|
---|
74 | /** See HardwareBuffer. */
|
---|
75 | void readData(size_t offset, size_t length, void* pDest);
|
---|
76 | /** See HardwareBuffer. */
|
---|
77 | void writeData(size_t offset, size_t length, const void* pSource,
|
---|
78 | bool discardWholeBuffer = false);
|
---|
79 | /** Override HardwareBuffer to turn off all shadowing. */
|
---|
80 | void* lock(size_t offset, size_t length, LockOptions options);
|
---|
81 | /** Override HardwareBuffer to turn off all shadowing. */
|
---|
82 | void unlock(void);
|
---|
83 |
|
---|
84 | };
|
---|
85 |
|
---|
86 | /** Specialisation of HardwareBufferManager to emulate hardware buffers.
|
---|
87 | @remarks
|
---|
88 | You might want to instantiate this class if you want to utilise
|
---|
89 | classes like MeshSerializer without having initialised the
|
---|
90 | rendering system (which is required to create a 'real' hardware
|
---|
91 | buffer manager.
|
---|
92 | */
|
---|
93 | class _OgreExport DefaultHardwareBufferManager : public HardwareBufferManager
|
---|
94 | {
|
---|
95 | public:
|
---|
96 | DefaultHardwareBufferManager();
|
---|
97 | ~DefaultHardwareBufferManager();
|
---|
98 | /// Creates a vertex buffer
|
---|
99 | HardwareVertexBufferSharedPtr
|
---|
100 | createVertexBuffer(size_t vertexSize, size_t numVerts,
|
---|
101 | HardwareBuffer::Usage usage, bool useShadowBuffer = false);
|
---|
102 | /// Create a hardware vertex buffer
|
---|
103 | HardwareIndexBufferSharedPtr
|
---|
104 | createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes,
|
---|
105 | HardwareBuffer::Usage usage, bool useShadowBuffer = false);
|
---|
106 |
|
---|
107 | };
|
---|
108 |
|
---|
109 |
|
---|
110 | }
|
---|
111 |
|
---|
112 | #endif
|
---|