Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/Direct3D9/include/OgreD3D9Mappings.h @ 1

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