Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

D3d_fx.cpp File Reference

#include <Windows.h>
#include <stdio.h>
#include <DDraw.h>
#include <D3D.h>
#include "D3DDrv.h"
#include "DCommon.h"
#include "Render.h"
#include "Scene.h"
#include "D3D_FX.h"
#include "D3D_Main.h"
#include "D3D_Err.h"

Go to the source code of this file.

Functions

void D3DSetTexHandle (D3DTEXTUREHANDLE TexHandle)
void D3DSetTexture (int32 Stage, LPDIRECT3DTEXTURE2 Texture)
void D3DBilinearFilter (D3DTEXTUREFILTER Min, D3DTEXTUREFILTER Mag)
void D3DTexturedPolyOld (void *Pnts, int32 NumPoints)
void D3DTexturedPoly (void *Pnts, int32 NumPoints)
void D3DViewport (int32 x, int32 y, int32 width, int32 height)
void D3DDepthRange (float zNear, float zFar)
void D3DBlendFunc (D3DBLEND SFunc, D3DBLEND DFunc)
void D3DBlendEnable (BOOL Enable)
void D3DTexWrap (DWORD Stage, BOOL Wrap)
void D3DZWriteEnable (BOOL Enable)
void D3DZFunc (D3DCMPFUNC Func)
void D3DZEnable (BOOL Enable)
void D3DPolygonMode (D3DFILLMODE Mode)

Variables

D3DTEXTUREHANDLE OldTexHandle = NULL
LPDIRECT3DTEXTURE2 OldTexture [8]
D3DBLEND OldSFunc = D3DBLEND_ONE
D3DBLEND OldDFunc = D3DBLEND_ONE
BOOL OldBlend = FALSE
BOOL OldWrap = FALSE


Function Documentation

void D3DBilinearFilter D3DTEXTUREFILTER  Min,
D3DTEXTUREFILTER  Mag
 

Definition at line 68 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, App_Info::CanDoMultiTexture, and App_Info::lpD3DDevice.

00069 {
00070         AppInfo.lpD3DDevice->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFN_LINEAR);
00071         AppInfo.lpD3DDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_LINEAR);
00072 
00073         if (AppInfo.CanDoMultiTexture)
00074         {
00075                 AppInfo.lpD3DDevice->SetTextureStageState(1, D3DTSS_MINFILTER, D3DTFN_LINEAR);
00076                 AppInfo.lpD3DDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, D3DTFG_LINEAR);
00077         }
00078 }

void D3DBlendEnable BOOL  Enable  ) 
 

Definition at line 160 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, and OldBlend.

00161 {
00162         if (OldBlend == Enable)
00163                 return;
00164 
00165         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, Enable);
00166 
00167         OldBlend = Enable;
00168 }

void D3DBlendFunc D3DBLEND  SFunc,
D3DBLEND  DFunc
 

Definition at line 141 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, OldDFunc, and OldSFunc.

00142 {
00143         if (SFunc != OldSFunc)
00144         {
00145                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, SFunc);
00146                 OldSFunc = SFunc;
00147         }
00148         if (DFunc != OldDFunc)
00149         {
00150                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, DFunc);
00151                 OldDFunc = DFunc;
00152         }
00153 
00154 }

void D3DDepthRange float  zNear,
float  zFar
 

Definition at line 126 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DViewport.

00127 {
00128     D3DVIEWPORT2 vport;
00129     vport.dwSize = sizeof(D3DVIEWPORT2);
00130     AppInfo.lpD3DViewport->GetViewport2(&vport);
00131     vport.dvMinZ = (D3DVALUE)(((-1.0) * (zFar + zNear)) / (zFar - zNear));
00132     vport.dvMaxZ = (D3DVALUE)(((-1.0) * (zFar + zNear - 2.0)) / (zFar - zNear));
00133     AppInfo.lpD3DViewport->SetViewport2(&vport);
00134 }

void D3DPolygonMode D3DFILLMODE  Mode  ) 
 

Definition at line 208 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

00209 {
00210         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID);
00211 }

void D3DSetTexHandle D3DTEXTUREHANDLE  TexHandle  ) 
 

Definition at line 42 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, and OldTexHandle.

00043 {
00044         if (TexHandle == OldTexHandle)
00045                 return;
00046 
00047         OldTexHandle = TexHandle;
00048 
00049         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_TEXTUREHANDLE, TexHandle);
00050 }

void D3DSetTexture int32  Stage,
LPDIRECT3DTEXTURE2  Texture
 

Definition at line 56 of file D3D8Drv/D3d_fx.cpp.

00057 {
00058         if (Texture == OldTexture[Stage])
00059                 return;
00060 
00061         OldTexture[Stage] = Texture;
00062 
00063         AppInfo.lpD3DDevice->SetTexture(Stage, Texture);
00064 }

void D3DTexturedPoly void *  Pnts,
int32  NumPoints
 

Definition at line 91 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

00092 {
00093         AppInfo.lpD3DDevice->DrawPrimitive(     D3DPT_TRIANGLEFAN, 
00094                                                                                 //D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX2, 
00095                                                                                 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2, 
00096                                                                                 Pnts, 
00097                                                                                 NumPoints, 
00098                                                                                 D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT | D3DDP_DONOTCLIP);
00099                                                                                 //D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTCLIP);
00100 }       

void D3DTexturedPolyOld void *  Pnts,
int32  NumPoints
 

Definition at line 83 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

00084 {
00085         AppInfo.lpD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX, Pnts, NumPoints, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT | D3DDP_DONOTCLIP);
00086 }       

void D3DTexWrap DWORD  Stage,
BOOL  Wrap
 

Definition at line 172 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, and OldWrap.

00173 {
00174         if (OldWrap == Wrap)
00175                 return;
00176 
00177         OldWrap = Wrap;
00178 
00179         if (Wrap)
00180         {
00181                 AppInfo.lpD3DDevice->SetTextureStageState(Stage, D3DTSS_ADDRESS, D3DTADDRESS_WRAP);
00182                 AppInfo.lpD3DDevice->SetTextureStageState(Stage, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP);
00183                 AppInfo.lpD3DDevice->SetTextureStageState(Stage, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP);
00184         }
00185         else
00186         {
00187                 AppInfo.lpD3DDevice->SetTextureStageState(Stage, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP);
00188                 AppInfo.lpD3DDevice->SetTextureStageState(Stage, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
00189                 AppInfo.lpD3DDevice->SetTextureStageState(Stage, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
00190         }
00191 }

void D3DViewport int32  x,
int32  y,
int32  width,
int32  height
 

Definition at line 105 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, height, App_Info::lpD3DViewport, App_Info::OldHeight, width, and y.

00106 {
00107         D3DVIEWPORT2 vport;
00108 
00109         return;
00110 
00111     vport.dwSize = sizeof(D3DVIEWPORT2);
00112     AppInfo.lpD3DViewport->GetViewport2(&vport);
00113     vport.dwX = x;
00114     vport.dwY = AppInfo.OldHeight - (y + height);
00115     vport.dwWidth = width;
00116     vport.dwHeight = height;
00117     vport.dvClipX = -1.0f;
00118     vport.dvClipY = 1.0f;
00119     vport.dvClipWidth = (float)width /2.0f;
00120     vport.dvClipHeight = (float)height/2.0f;
00121     AppInfo.lpD3DViewport->SetViewport2(&vport);
00122 }

void D3DZEnable BOOL  Enable  ) 
 

Definition at line 203 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

00204 {
00205         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, Enable);
00206 }

void D3DZFunc D3DCMPFUNC  Func  ) 
 

Definition at line 198 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

00199 {
00200         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, Func);
00201 }

void D3DZWriteEnable BOOL  Enable  ) 
 

Definition at line 193 of file D3D8Drv/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

00194 {
00195         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, Enable);
00196 }


Variable Documentation

BOOL OldBlend = FALSE [static]
 

Definition at line 156 of file D3D8Drv/D3d_fx.cpp.

Referenced by D3DBlendEnable().

D3DBLEND OldDFunc = D3DBLEND_ONE [static]
 

Definition at line 137 of file D3D8Drv/D3d_fx.cpp.

Referenced by D3DBlendFunc().

D3DBLEND OldSFunc = D3DBLEND_ONE [static]
 

Definition at line 136 of file D3D8Drv/D3d_fx.cpp.

Referenced by D3DBlendFunc().

D3DTEXTUREHANDLE OldTexHandle = NULL [static]
 

Definition at line 38 of file D3D8Drv/D3d_fx.cpp.

Referenced by D3DSetTexHandle().

LPDIRECT3DTEXTURE2 OldTexture[8] [static]
 

Definition at line 52 of file D3D8Drv/D3d_fx.cpp.

BOOL OldWrap = FALSE [static]
 

Definition at line 170 of file D3D8Drv/D3d_fx.cpp.

Referenced by D3DTexWrap().


Generated on Tue Sep 30 12:37:14 2003 for GTestAndEngine by doxygen 1.3.2