Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/Direct3D9/include/OgreD3D9HardwarePixelBuffer.h @ 6

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

=hoffentlich gehts jetzt

File size: 3.7 KB
RevLine 
[5]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#ifndef __D3D9PIXELBUFFER_H__
30#define __D3D9PIXELBUFFER_H__
31
32#include "OgreD3D9Prerequisites.h"
33#include "OgreHardwarePixelBuffer.h"
34
35#include <d3d9.h>
36#include <d3dx9.h>
37namespace Ogre {
38
39        class D3D9HardwarePixelBuffer: public HardwarePixelBuffer
40        {
41        protected:
42                /// Lock a box
43                PixelBox lockImpl(const Image::Box lockBox,  LockOptions options);
44
45                /// Unlock a box
46                void unlockImpl(void);
47
48                /// Create (or update) render textures for slices
49                void createRenderTextures(bool update);
50                /// Destroy render textures for slices
51                void destroyRenderTextures();
52               
53                /// D3DDevice pointer
54                IDirect3DDevice9 *mpDev;
55               
56                /// Surface abstracted by this buffer
57                IDirect3DSurface9 *mSurface;
58                /// Volume abstracted by this buffer
59                IDirect3DVolume9 *mVolume;
60                /// Temporary surface in main memory if direct locking of mSurface is not possible
61                IDirect3DSurface9 *mTempSurface;
62                /// Temporary volume in main memory if direct locking of mVolume is not possible
63                IDirect3DVolume9 *mTempVolume;
64               
65                /// Mipmapping
66                bool mDoMipmapGen;
67                bool mHWMipmaps;
68                IDirect3DBaseTexture9 *mMipTex;
69
70                /// Render targets
71                typedef std::vector<RenderTexture*> SliceTRT;
72        SliceTRT mSliceTRT;
73        public:
74                D3D9HardwarePixelBuffer(HardwareBuffer::Usage usage);
75               
76                /// Call this to associate a D3D surface or volume with this pixel buffer
77                void bind(IDirect3DDevice9 *dev, IDirect3DSurface9 *mSurface, bool update);
78                void bind(IDirect3DDevice9 *dev, IDirect3DVolume9 *mVolume, bool update);
79               
80                /// @copydoc HardwarePixelBuffer::blit
81        void blit(const HardwarePixelBufferSharedPtr &src, const Image::Box &srcBox, const Image::Box &dstBox);
82               
83                /// @copydoc HardwarePixelBuffer::blitFromMemory
84                void blitFromMemory(const PixelBox &src, const Image::Box &dstBox);
85               
86                /// @copydoc HardwarePixelBuffer::blitToMemory
87                void blitToMemory(const Image::Box &srcBox, const PixelBox &dst);
88               
89                /// Internal function to update mipmaps on update of level 0
90                void _genMipmaps();
91               
92                /// Function to set mipmap generation
93                void _setMipmapping(bool doMipmapGen, bool HWMipmaps, IDirect3DBaseTexture9 *mipTex);
94               
95                ~D3D9HardwarePixelBuffer();
96
97                /// Get rendertarget for z slice
98                RenderTexture *getRenderTarget(size_t zoffset);
99
100                /// Accessor for surface
101                IDirect3DSurface9 *getSurface() { return mSurface; }
102
103                /// Notify TextureBuffer of destruction of render target
104        virtual void _clearSliceRTT(size_t zoffset)
105        {
106            mSliceTRT[zoffset] = 0;
107        }
108        };
109};
110#endif
Note: See TracBrowser for help on using the repository browser.