[657] | 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 __D3D9MAPPINGS_H__
|
---|
| 26 | #define __D3D9MAPPINGS_H__
|
---|
| 27 |
|
---|
| 28 | #include "OgreD3D9Prerequisites.h"
|
---|
| 29 | #include "OgreCommon.h"
|
---|
| 30 | #include "OgreLight.h"
|
---|
| 31 | #include "OgreMaterial.h"
|
---|
| 32 | #include "OgreRenderSystem.h"
|
---|
| 33 | #include "OgreHardwareBuffer.h"
|
---|
| 34 | #include "OgreHardwareIndexBuffer.h"
|
---|
| 35 |
|
---|
| 36 | #include "OgreNoMemoryMacros.h"
|
---|
| 37 | #include <d3d9.h>
|
---|
| 38 | #include <d3dx9.h>
|
---|
| 39 | #include <dxerr9.h>
|
---|
| 40 | #include "OgreMemoryMacros.h"
|
---|
| 41 |
|
---|
| 42 | namespace Ogre
|
---|
| 43 | {
|
---|
| 44 | class D3D9Mappings
|
---|
| 45 | {
|
---|
| 46 | public:
|
---|
| 47 | /// enum identifying D3D9 tex. types
|
---|
| 48 | enum eD3DTexType
|
---|
| 49 | {
|
---|
| 50 | /// standard texture
|
---|
| 51 | D3D_TEX_TYPE_NORMAL,
|
---|
| 52 | /// cube texture
|
---|
| 53 | D3D_TEX_TYPE_CUBE,
|
---|
| 54 | /// volume texture
|
---|
| 55 | D3D_TEX_TYPE_VOLUME,
|
---|
| 56 | /// just to have it...
|
---|
| 57 | D3D_TEX_TYPE_NONE
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | /// enum identifying D3D9 filter usage type
|
---|
| 61 | enum eD3DFilterUsage
|
---|
| 62 | {
|
---|
| 63 | /// min filter
|
---|
| 64 | D3D_FUSAGE_MIN,
|
---|
| 65 | /// mag filter
|
---|
| 66 | D3D_FUSAGE_MAG,
|
---|
| 67 | /// mip filter
|
---|
| 68 | D3D_FUSAGE_MIP
|
---|
| 69 | };
|
---|
| 70 |
|
---|
| 71 | /// return a D3D9 equivalent for a Ogre ShadeOptions value
|
---|
| 72 | static DWORD get(ShadeOptions so);
|
---|
| 73 | /// return a D3D9 equivalent for a Ogre LightTypes value
|
---|
| 74 | static D3DLIGHTTYPE get(Ogre::Light::LightTypes lightType);
|
---|
| 75 | /// return a D3D9 equivalent for a Ogre TexCoordCalsMethod value
|
---|
| 76 | static DWORD get(TexCoordCalcMethod m, const D3DCAPS9& caps);
|
---|
| 77 | /// return a D3D9 equivalent for a Ogre TextureAddressingMode value
|
---|
| 78 | static D3DTEXTUREADDRESS get(TextureUnitState::TextureAddressingMode tam);
|
---|
| 79 | /// return a D3D9 equivalent for a Ogre LayerBlendType value
|
---|
| 80 | static D3DTEXTURESTAGESTATETYPE get(LayerBlendType lbt);
|
---|
| 81 | /// return a D3D9 equivalent for a Ogre LayerBlendOperationEx value
|
---|
| 82 | static DWORD get(LayerBlendOperationEx lbo, const D3DCAPS9& devCaps);
|
---|
| 83 | /// return a D3D9 equivalent for a Ogre LayerBlendSource value
|
---|
| 84 | static DWORD get(LayerBlendSource lbs);
|
---|
| 85 | /// return a D3D9 equivalent for a Ogre SceneBlendFactor value
|
---|
| 86 | static D3DBLEND get(SceneBlendFactor sbf);
|
---|
| 87 | /// return a D3D9 equivalent for a Ogre CompareFunction value
|
---|
| 88 | static DWORD get(CompareFunction cf);
|
---|
| 89 | /// return a D3D9 equivalent for a Ogre CillingMode value
|
---|
| 90 | static DWORD get(CullingMode cm, bool flip);
|
---|
| 91 | /// return a D3D9 equivalent for a Ogre FogMode value
|
---|
| 92 | static D3DFOGMODE get(FogMode fm);
|
---|
| 93 | /// return a D3D9 equivalent for a Ogre SceneDetailLevel value
|
---|
| 94 | static D3DFILLMODE get(SceneDetailLevel level);
|
---|
| 95 | /// return a D3D9 equivalent for a Ogre StencilOperation value
|
---|
| 96 | static DWORD get(StencilOperation op, bool invert = false);
|
---|
| 97 | /// return a D3D9 state type for Ogre FilterType value
|
---|
| 98 | static D3DSAMPLERSTATETYPE get(FilterType ft);
|
---|
| 99 | /// return a D3D9 filter option for Ogre FilterType & FilterOption value
|
---|
| 100 | static DWORD get(FilterType ft, FilterOptions fo, const D3DCAPS9& devCaps, eD3DTexType texType);
|
---|
| 101 | /// return the D3DtexType equivalent of a Ogre tex. type
|
---|
| 102 | static eD3DTexType get(TextureType ogreTexType);
|
---|
| 103 | /// return the combination of D3DUSAGE values for Ogre buffer usage
|
---|
| 104 | static DWORD get(HardwareBuffer::Usage usage);
|
---|
| 105 | /// Get lock options
|
---|
| 106 | static DWORD get(HardwareBuffer::LockOptions options, HardwareBuffer::Usage usage);
|
---|
| 107 | /// Get index type
|
---|
| 108 | static D3DFORMAT get(HardwareIndexBuffer::IndexType itype);
|
---|
| 109 | /// Get vertex data type
|
---|
| 110 | static D3DDECLTYPE get(VertexElementType vType);
|
---|
| 111 | /// Get vertex semantic
|
---|
| 112 | static D3DDECLUSAGE get(VertexElementSemantic sem);
|
---|
| 113 | // Convert matrix to D3D style
|
---|
| 114 | static D3DXMATRIX makeD3DXMatrix( const Matrix4& mat );
|
---|
| 115 | // Convert matrix from D3D style
|
---|
| 116 | static Matrix4 D3D9Mappings::convertD3DXMatrix( const D3DXMATRIX& mat );
|
---|
| 117 |
|
---|
| 118 | };
|
---|
| 119 | }
|
---|
| 120 | #endif
|
---|