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 | #ifndef __D3D9PIXELBUFFER_H__
|
---|
26 | #define __D3D9PIXELBUFFER_H__
|
---|
27 |
|
---|
28 | #include "OgreD3D9Prerequisites.h"
|
---|
29 | #include "OgreHardwarePixelBuffer.h"
|
---|
30 |
|
---|
31 | #include <d3d9.h>
|
---|
32 | #include <d3dx9.h>
|
---|
33 | namespace Ogre {
|
---|
34 |
|
---|
35 | class D3D9HardwarePixelBuffer: public HardwarePixelBuffer
|
---|
36 | {
|
---|
37 | protected:
|
---|
38 | /// Lock a box
|
---|
39 | PixelBox lockImpl(const Image::Box lockBox, LockOptions options);
|
---|
40 |
|
---|
41 | /// Unlock a box
|
---|
42 | void unlockImpl(void);
|
---|
43 |
|
---|
44 | /// D3DDevice pointer
|
---|
45 | IDirect3DDevice9 *mpDev;
|
---|
46 |
|
---|
47 | /// Surface abstracted by this buffer
|
---|
48 | IDirect3DSurface9 *mSurface;
|
---|
49 | /// Volume abstracted by this buffer
|
---|
50 | IDirect3DVolume9 *mVolume;
|
---|
51 | /// Temporary surface in main memory if direct locking of mSurface is not possible
|
---|
52 | IDirect3DSurface9 *mTempSurface;
|
---|
53 | /// Temporary volume in main memory if direct locking of mVolume is not possible
|
---|
54 | IDirect3DVolume9 *mTempVolume;
|
---|
55 |
|
---|
56 | // Mipmapping
|
---|
57 | bool mDoMipmapGen;
|
---|
58 | bool mHWMipmaps;
|
---|
59 | IDirect3DBaseTexture9 *mMipTex;
|
---|
60 | public:
|
---|
61 | D3D9HardwarePixelBuffer(HardwareBuffer::Usage usage);
|
---|
62 |
|
---|
63 | /// Call this to associate a D3D surface or volume with this pixel buffer
|
---|
64 | void bind(IDirect3DDevice9 *dev, IDirect3DSurface9 *mSurface);
|
---|
65 | void bind(IDirect3DDevice9 *dev, IDirect3DVolume9 *mVolume);
|
---|
66 |
|
---|
67 | /// @copydoc HardwarePixelBuffer::blit
|
---|
68 | void blit(HardwarePixelBuffer *src, const Image::Box &srcBox, const Image::Box &dstBox);
|
---|
69 |
|
---|
70 | /// @copydoc HardwarePixelBuffer::blitFromMemory
|
---|
71 | void blitFromMemory(const PixelBox &src, const Image::Box &dstBox);
|
---|
72 |
|
---|
73 | /// @copydoc HardwarePixelBuffer::blitToMemory
|
---|
74 | void blitToMemory(const Image::Box &srcBox, const PixelBox &dst);
|
---|
75 |
|
---|
76 | /// Internal function to update mipmaps on update of level 0
|
---|
77 | void _genMipmaps();
|
---|
78 |
|
---|
79 | /// Function to set mipmap generation
|
---|
80 | void _setMipmapping(bool doMipmapGen, bool HWMipmaps, IDirect3DBaseTexture9 *mipTex);
|
---|
81 |
|
---|
82 | ~D3D9HardwarePixelBuffer();
|
---|
83 | };
|
---|
84 | };
|
---|
85 | #endif
|
---|