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 (geFloat zNear, geFloat 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 65 of file WireFrame/D3d_fx.cpp.

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

Referenced by BeginScene().

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

void D3DBlendEnable BOOL  Enable  ) 
 

Definition at line 157 of file WireFrame/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, and OldBlend.

Referenced by BeginScene(), PCache_FlushMiscPolys(), and RenderWorldPolys().

00158 {
00159         if (OldBlend == Enable)
00160                 return;
00161 
00162         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, Enable);
00163 
00164         OldBlend = Enable;
00165 }

void D3DBlendFunc D3DBLEND  SFunc,
D3DBLEND  DFunc
 

Definition at line 138 of file WireFrame/D3d_fx.cpp.

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

Referenced by BeginScene(), PCache_FlushMiscPolys(), RenderGouraudPoly(), and RenderWorldPolys().

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

void D3DDepthRange geFloat  zNear,
geFloat  zFar
 

Definition at line 123 of file WireFrame/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DViewport.

Referenced by D3DMain_InitD3D().

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

void D3DPolygonMode D3DFILLMODE  Mode  ) 
 

Definition at line 205 of file WireFrame/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

Referenced by BeginScene().

00206 {
00207         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FILLMODE, Mode);
00208 }

void D3DSetTexHandle D3DTEXTUREHANDLE  TexHandle  ) 
 

Definition at line 39 of file WireFrame/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, and OldTexHandle.

00040 {
00041         if (TexHandle == OldTexHandle)
00042                 return;
00043 
00044         OldTexHandle = TexHandle;
00045 
00046         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_TEXTUREHANDLE, TexHandle);
00047 }

void D3DSetTexture int32  Stage,
LPDIRECT3DTEXTURE2  Texture
 

Definition at line 53 of file WireFrame/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, and OldTexture.

Referenced by CreateLightmapTHandle(), PCache_FlushMiscPolys(), RenderGouraudPoly(), SetupLMap(), and SetupTexture().

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

void D3DTexturedPoly void *  Pnts,
int32  NumPoints
 

Definition at line 88 of file WireFrame/D3d_fx.cpp.

References AppInfo, D3DMain_Log(), App_Info::lpD3DDevice, and NULL.

Referenced by PCache_FlushMiscPolys(), and RenderWorldPolys().

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

void D3DTexturedPolyOld void *  Pnts,
int32  NumPoints
 

Definition at line 80 of file WireFrame/D3d_fx.cpp.

References AppInfo, D3DMain_Log(), App_Info::lpD3DDevice, and NULL.

Referenced by RenderGouraudPoly().

00081 {
00082         AppInfo.lpD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX, Pnts, NumPoints, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT | D3DDP_DONOTCLIP);
00083 }       

void D3DTexWrap DWORD  Stage,
BOOL  Wrap
 

Definition at line 169 of file WireFrame/D3d_fx.cpp.

References AppInfo, App_Info::lpD3DDevice, and OldWrap.

Referenced by PCache_FlushMiscPolys(), and RenderWorldPolys().

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

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

Definition at line 102 of file WireFrame/D3d_fx.cpp.

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

Referenced by D3DMain_InitD3D().

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

void D3DZEnable BOOL  Enable  ) 
 

Definition at line 200 of file WireFrame/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

Referenced by BeginScene(), and PCache_FlushMiscPolys().

00201 {
00202         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, Enable);
00203 }

void D3DZFunc D3DCMPFUNC  Func  ) 
 

Definition at line 195 of file WireFrame/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

Referenced by BeginScene().

00196 {
00197         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, Func);
00198 }

void D3DZWriteEnable BOOL  Enable  ) 
 

Definition at line 190 of file WireFrame/D3d_fx.cpp.

References AppInfo, and App_Info::lpD3DDevice.

Referenced by BeginScene(), and PCache_FlushMiscPolys().

00191 {
00192         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, Enable);
00193 }


Variable Documentation

BOOL OldBlend = FALSE [static]
 

Definition at line 153 of file WireFrame/D3d_fx.cpp.

Referenced by D3DBlendEnable().

D3DBLEND OldDFunc = D3DBLEND_ONE [static]
 

Definition at line 134 of file WireFrame/D3d_fx.cpp.

Referenced by D3DBlendFunc().

D3DBLEND OldSFunc = D3DBLEND_ONE [static]
 

Definition at line 133 of file WireFrame/D3d_fx.cpp.

Referenced by D3DBlendFunc().

D3DTEXTUREHANDLE OldTexHandle = NULL [static]
 

Definition at line 35 of file WireFrame/D3d_fx.cpp.

Referenced by D3DSetTexHandle().

LPDIRECT3DTEXTURE2 OldTexture[8] [static]
 

Definition at line 49 of file WireFrame/D3d_fx.cpp.

BOOL OldWrap = FALSE [static]
 

Definition at line 167 of file WireFrame/D3d_fx.cpp.

Referenced by D3DTexWrap().


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