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

Scene.cpp File Reference

#include <Windows.h>
#include <stdio.h>
#include "D3DDrv7x.h"
#include "DCommon.h"
#include "Scene.h"
#include "Render.h"
#include "GSpan.h"
#include "D3DCache.h"
#include "D3D_Fx.h"
#include "D3D_Main.h"
#include "PCache.h"
#include "D3D_Err.h"
#include "THandle.h"

Go to the source code of this file.

Defines

#define SUPER_FLUSH

Functions

BOOL DRIVERCC BeginScene (BOOL Clear, BOOL ClearZ, RECT *WorldRect)
BOOL DRIVERCC EndScene (void)
BOOL DRIVERCC BeginWorld (void)
BOOL DRIVERCC EndWorld (void)
BOOL DRIVERCC BeginMeshes (void)
BOOL DRIVERCC EndMeshes (void)
BOOL DRIVERCC BeginModels (void)
BOOL DRIVERCC EndModels (void)

Variables

int32 RenderMode
uint32 CurrentLRU
BOOL GlobalMeshHack


Define Documentation

#define SUPER_FLUSH
 

Definition at line 47 of file D3D7xDrv/Scene.cpp.


Function Documentation

BOOL DRIVERCC BeginMeshes void   ) 
 

Definition at line 178 of file D3D7xDrv/Scene.cpp.

00179 {
00180         GlobalMeshHack = TRUE;
00181         RenderMode = RENDER_MESHES;
00182         return TRUE;
00183 }

BOOL DRIVERCC BeginModels void   ) 
 

Definition at line 207 of file D3D7xDrv/Scene.cpp.

00208 {
00209         RenderMode = RENDER_MODELS;
00210         return TRUE;
00211 }

BOOL DRIVERCC BeginScene BOOL  Clear,
BOOL  ClearZ,
RECT WorldRect
 

Definition at line 53 of file D3D7xDrv/Scene.cpp.

00054 {
00055         HRESULT Result;
00056 
00057         CurrentLRU++;
00058 
00059         if (!AppInfo.lpD3DDevice)
00060         {
00061                 D3DMain_Log("BeginScene:  No D3D Device!.");
00062                 return FALSE;
00063         }
00064 
00065         // Make sure we clear the cache info structure...
00066         memset(&CacheInfo, 0, sizeof(DRV_CacheInfo));
00067 
00068         if (!THandle_CheckCache())
00069                 return GE_FALSE;
00070 
00071         //      Watch for inactive app or minimize
00072         if(AppInfo.RenderingIsOK)
00073         {
00074                 if (!Main_ClearBackBuffer(Clear, ClearZ))
00075                 {
00076                         D3DMain_Log("D3DClearBuffers failed.");
00077                         return FALSE;
00078                 }
00079                 
00080                 D3DDRV.NumRenderedPolys = 0;
00081                 
00082                 Result = AppInfo.lpD3DDevice->BeginScene();
00083 
00084                 if (Result != D3D_OK)
00085                 {
00086                         D3DMain_Log("BeginScene:  D3D BeginScene Failed.\n%s.", D3DErrorToString(Result));
00087                         return FALSE;
00088                 }
00089 
00090                 D3DBilinearFilter(D3DFILTER_LINEAR, D3DFILTER_LINEAR);
00091                 D3DPolygonMode (D3DFILL_SOLID);
00092                 
00093                 D3DZWriteEnable (TRUE);
00094                 D3DZEnable(TRUE);
00095                 D3DZFunc(D3DCMP_LESSEQUAL);
00096 
00097                 D3DBlendFunc (D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
00098                 D3DBlendEnable(TRUE);
00099 
00100                 if (AppInfo.FogEnable)
00101                 {
00102                         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE , TRUE);
00103                         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR , ((DWORD)AppInfo.FogR<<16)|((DWORD)AppInfo.FogG<<8)|(DWORD)AppInfo.FogB);
00104                 }
00105                 else
00106                 {
00107                         AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE , FALSE);
00108                 }
00109         }
00110 
00111         return TRUE;
00112 }

BOOL DRIVERCC BeginWorld void   ) 
 

Definition at line 141 of file D3D7xDrv/Scene.cpp.

00142 {
00143         #ifdef USE_SPANS
00144                 if(AppInfo.RenderingIsOK)
00145                 {
00146                         ResetSpans(ClientWindow.Height);
00147                 }
00148         #endif
00149 
00150         RenderMode = RENDER_WORLD;
00151         return TRUE;
00152 }

BOOL DRIVERCC EndMeshes void   ) 
 

Definition at line 185 of file D3D7xDrv/Scene.cpp.

00186 {
00187         RenderMode = RENDER_NONE;
00188 
00189         if(AppInfo.RenderingIsOK)
00190         {
00191                 PCache_FlushMiscPolys();
00192                 PCache_FlushWorldPolys();
00193 
00194         #ifdef SUPER_FLUSH
00195 /* 02/28/2001 Wendell Buckner
00196    These render states are unsupported d3d 7.0
00197                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);*/
00198                 AppInfo.lpD3DDevice->EndScene();
00199                 AppInfo.lpD3DDevice->BeginScene();
00200         #endif
00201 
00202                 GlobalMeshHack = FALSE;
00203         }
00204         return TRUE;
00205 }

BOOL DRIVERCC EndModels void   ) 
 

Definition at line 213 of file D3D7xDrv/Scene.cpp.

00214 {
00215         RenderMode = RENDER_NONE;
00216 
00217         if(AppInfo.RenderingIsOK)
00218         {
00219                 PCache_FlushWorldPolys();
00220                 PCache_FlushMiscPolys();
00221 
00222         #ifdef SUPER_FLUSH
00223 /* 02/28/2001 Wendell Buckner
00224    These render states are unsupported d3d 7.0
00225                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);*/
00226                 AppInfo.lpD3DDevice->EndScene();
00227                 AppInfo.lpD3DDevice->BeginScene();
00228         #endif
00229 
00230         }
00231         return TRUE;
00232 }

BOOL DRIVERCC EndScene void   ) 
 

Definition at line 114 of file D3D7xDrv/Scene.cpp.

00115 {
00116         HRESULT         Result;
00117 
00118         if (!AppInfo.lpD3DDevice)
00119                 return FALSE;
00120 
00121         if(AppInfo.RenderingIsOK)
00122         {
00123                 // Flush everything one last time...
00124                 PCache_FlushWorldPolys();
00125                 PCache_FlushMiscPolys();
00126 
00127                 Result = AppInfo.lpD3DDevice->EndScene();
00128 
00129                 if (Result != D3D_OK)
00130                 {
00131                         D3DMain_Log("EndScene:  D3D EndScene Failed.\n%s", D3DErrorToString(Result));
00132                         return FALSE;
00133                 }
00134 
00135                 if (!Main_ShowBackBuffer())
00136                         return FALSE;
00137         }
00138         return TRUE;
00139 }

BOOL DRIVERCC EndWorld void   ) 
 

Definition at line 154 of file D3D7xDrv/Scene.cpp.

00155 {
00156         RenderMode = RENDER_NONE;
00157 
00158         if(AppInfo.RenderingIsOK)
00159         {
00160                 PCache_FlushWorldPolys();
00161                 PCache_FlushMiscPolys();
00162 
00163                 assert(AppInfo.lpD3DDevice);
00164         #ifdef SUPER_FLUSH
00165 /* 02/28/2001 Wendell Buckner
00166    These render states are unsupported d3d 7.0
00167                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);*/
00168                 AppInfo.lpD3DDevice->EndScene();
00169                 AppInfo.lpD3DDevice->BeginScene();
00170         #endif
00171 
00172         }
00173         return TRUE;
00174 }


Variable Documentation

uint32 CurrentLRU
 

Definition at line 51 of file D3D7xDrv/Scene.cpp.

BOOL GlobalMeshHack
 

Definition at line 176 of file D3D7xDrv/Scene.cpp.

Referenced by BeginMeshes(), and EndMeshes().

int32 RenderMode
 

Definition at line 49 of file D3D7xDrv/Scene.cpp.

Referenced by AddSpan(), BeginMeshes(), BeginModels(), BeginScene(), BeginWorld(), EndMeshes(), EndModels(), EndScene(), EndWorld(), RenderWorldPoly(), RenderWorldPolys(), SoftDrv_BeginMeshes(), SoftDrv_BeginModels(), SoftDrv_BeginScene(), SoftDrv_BeginWorld(), SoftDrv_EndRenderMode(), SoftDrv_EndScene(), and SoftDrv_RenderWorldPoly().


Generated on Tue Sep 30 12:38:03 2003 for GTestAndEngine by doxygen 1.3.2