Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/include/OgreDefaultHardwareBufferManager.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

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