KeosD3D9Enum.cpp

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 
00022 #include "KeosD3D9Enum.h"
00023 
00024 namespace Keos
00025 {
00026   //=======================================================================
00027   // CD3D9Enum implementation
00028   //=======================================================================
00029 
00030   //-----------------------------------------------------------------------
00031   D3DTRANSFORMSTATETYPE CD3D9Enum::MatrixType[] =
00032     {
00033       D3DTS_WORLD,
00034       D3DTS_PROJECTION,
00035       D3DTS_TEXTURE0,
00036       D3DTS_TEXTURE1,
00037       D3DTS_TEXTURE2,
00038       D3DTS_TEXTURE3
00039     };
00040 
00041   //-----------------------------------------------------------------------
00042   D3DPRIMITIVETYPE CD3D9Enum::PrimitiveType[] =
00043     {
00044       D3DPT_TRIANGLELIST,
00045       D3DPT_TRIANGLESTRIP,
00046       D3DPT_TRIANGLEFAN,
00047       D3DPT_LINELIST,
00048       D3DPT_LINESTRIP,
00049       D3DPT_POINTLIST
00050     };
00051 
00052   //-----------------------------------------------------------------------
00053   D3DFORMAT CD3D9Enum::PixelFormat[] =
00054     {
00055       D3DFMT_L8,
00056       D3DFMT_A8L8,
00057       D3DFMT_A1R5G5B5,
00058       D3DFMT_A4R4G4B4,
00059       D3DFMT_R8G8B8,
00060       D3DFMT_A8R8G8B8,
00061       D3DFMT_DXT1,
00062       D3DFMT_DXT3,
00063       D3DFMT_DXT5
00064     };
00065 
00066   //-----------------------------------------------------------------------
00067   D3DBLEND CD3D9Enum::Blend[] =
00068     {
00069       D3DBLEND_SRCALPHA,
00070       D3DBLEND_INVSRCALPHA,
00071       D3DBLEND_DESTALPHA,
00072       D3DBLEND_INVDESTALPHA,
00073       D3DBLEND_SRCCOLOR,
00074       D3DBLEND_INVSRCCOLOR,
00075       D3DBLEND_DESTCOLOR,
00076       D3DBLEND_INVDESTCOLOR,
00077       D3DBLEND_ONE,
00078       D3DBLEND_ZERO
00079     };
00080 
00081   //-----------------------------------------------------------------------
00082   D3DTEXTUREOP CD3D9Enum::TextureOp[] =
00083     {
00084       D3DTOP_SELECTARG1,
00085       D3DTOP_ADD,
00086       D3DTOP_MODULATE,
00087       D3DTOP_SELECTARG1,
00088       D3DTOP_ADD,
00089       D3DTOP_MODULATE
00090     };
00091 
00092   //-----------------------------------------------------------------------
00093   ulong CD3D9Enum::TextureArg[] =
00094     {
00095       D3DTA_DIFFUSE,
00096       D3DTA_TEXTURE,
00097       D3DTA_CURRENT,
00098       D3DTA_TFACTOR
00099     };
00100 
00101   //-----------------------------------------------------------------------
00102   D3DRENDERSTATETYPE CD3D9Enum::RenderParameter[] =
00103     {
00104       D3DRS_ZWRITEENABLE,
00105       D3DRS_ALPHABLENDENABLE,
00106       D3DRS_LIGHTING
00107     };
00108 
00109   //-----------------------------------------------------------------------
00110   ulong CD3D9Enum::FillMode[] =
00111     {
00112       D3DFILL_POINT,
00113       D3DFILL_WIREFRAME,
00114       D3DFILL_SOLID
00115     };
00116 
00117   //-----------------------------------------------------------------------
00118   ulong CD3D9Enum::BufferFlags(ulong nFlags)
00119   {
00120     return (nFlags & BUF_DYNAMIC ? D3DUSAGE_DYNAMIC : 0);
00121   }
00122 
00123   //-----------------------------------------------------------------------
00124   ulong CD3D9Enum::LockFlags(ulong nFlags)
00125   {
00126     ulong nLockFlags = 0;
00127 
00128     if (nFlags & LOCK_READONLY)
00129       nLockFlags = D3DLOCK_READONLY;
00130 
00131     if (nFlags & LOCK_WRITEONLY)
00132     {
00133       nLockFlags = D3DLOCK_DISCARD;
00134       //LockFlags = D3DLOCK_NOOVERWRITE;
00135     }
00136 
00137     return nLockFlags;
00138   }
00139 
00140   //-----------------------------------------------------------------------
00141   D3DTRANSFORMSTATETYPE CD3D9Enum::Get(TMatrixType Value)
00142   {
00143     return MatrixType[Value];
00144   }
00145 
00146   //-----------------------------------------------------------------------
00147   D3DPRIMITIVETYPE CD3D9Enum::Get(TPrimitiveType Value)
00148   {
00149     return PrimitiveType[Value];
00150   }
00151 
00152   //-----------------------------------------------------------------------
00153   D3DFORMAT CD3D9Enum::Get(TPixelFormat Value)
00154   {
00155     return PixelFormat[Value];
00156   }
00157 
00158   //-----------------------------------------------------------------------
00159   D3DBLEND CD3D9Enum::Get(TBlend Value)
00160   {
00161     return Blend[Value];
00162   }
00163 
00164   //-----------------------------------------------------------------------
00165   D3DTEXTUREOP CD3D9Enum::Get(TTextureOp Value)
00166   {
00167     return TextureOp[Value];
00168   }
00169 
00170   //-----------------------------------------------------------------------
00171   ulong CD3D9Enum::Get(TTextureArg Value)
00172   {
00173     return TextureArg[Value];
00174   }
00175 
00176   //-----------------------------------------------------------------------
00177   D3DRENDERSTATETYPE CD3D9Enum::Get(TRenderParameter Value)
00178   {
00179     return RenderParameter[Value];
00180   }
00181 
00182   //-----------------------------------------------------------------------
00183   ulong CD3D9Enum::Get(TFillMode Value)
00184   {
00185     return FillMode[Value];
00186   }
00187 
00188 } // namespace Keos

Generated on Fri Mar 9 14:29:03 2007 for Keos by  doxygen 1.5.1-p1