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

Scene.cpp File Reference

#include <Windows.h>
#include <stdio.h>
#include "D3DDrv.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.

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


Function Documentation

BOOL DRIVERCC BeginMeshes void   ) 
 

Definition at line 159 of file D3D8Drv/Scene.cpp.

References DRIVERCC, GlobalMeshHack, RENDER_MESHES, RenderMode, and TRUE.

00160 {
00161         GlobalMeshHack = TRUE;
00162         RenderMode = RENDER_MESHES;
00163         return TRUE;
00164 }

BOOL DRIVERCC BeginModels void   ) 
 

Definition at line 184 of file D3D8Drv/Scene.cpp.

References DRIVERCC, RENDER_MODELS, RenderMode, and TRUE.

00185 {
00186         RenderMode = RENDER_MODELS;
00187         return TRUE;
00188 }

BOOL DRIVERCC BeginScene BOOL  Clear,
BOOL  ClearZ,
RECT WorldRect
 

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

References AppInfo, CacheInfo, CurrentLRU, D3DBilinearFilter(), D3DBlendEnable(), D3DBlendFunc(), D3DDRV, D3DErrorToString(), D3DMain_Log(), D3DPolygonMode(), D3DZEnable(), D3DZFunc(), D3DZWriteEnable(), DRIVERCC, DWORD, FALSE, App_Info::FogB, App_Info::FogEnable, App_Info::FogG, App_Info::FogR, GE_FALSE, App_Info::lpD3DDevice, Main_ClearBackBuffer(), DRV_Driver::NumRenderedPolys, App_Info::RenderingIsOK, THandle_CheckCache(), and TRUE.

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

BOOL DRIVERCC BeginWorld void   ) 
 

Definition at line 135 of file D3D8Drv/Scene.cpp.

References DRIVERCC, RENDER_WORLD, RenderMode, and TRUE.

00136 {
00137         RenderMode = RENDER_WORLD;
00138         return TRUE;
00139 }

BOOL DRIVERCC EndMeshes void   ) 
 

Definition at line 166 of file D3D8Drv/Scene.cpp.

References AppInfo, DRIVERCC, FALSE, GlobalMeshHack, App_Info::lpD3DDevice, PCache_FlushMiscPolys(), PCache_FlushWorldPolys(), RENDER_NONE, App_Info::RenderingIsOK, RenderMode, and TRUE.

00167 {
00168         RenderMode = RENDER_NONE;
00169 
00170         if(AppInfo.RenderingIsOK)
00171         {
00172                 PCache_FlushMiscPolys();
00173                 PCache_FlushWorldPolys();
00174 
00175                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);
00176                 AppInfo.lpD3DDevice->EndScene();
00177                 AppInfo.lpD3DDevice->BeginScene();
00178 
00179                 GlobalMeshHack = FALSE;
00180         }
00181         return TRUE;
00182 }

BOOL DRIVERCC EndModels void   ) 
 

Definition at line 190 of file D3D8Drv/Scene.cpp.

References AppInfo, DRIVERCC, App_Info::lpD3DDevice, PCache_FlushMiscPolys(), PCache_FlushWorldPolys(), RENDER_NONE, App_Info::RenderingIsOK, RenderMode, and TRUE.

00191 {
00192         RenderMode = RENDER_NONE;
00193 
00194         if(AppInfo.RenderingIsOK)
00195         {
00196                 PCache_FlushWorldPolys();
00197                 PCache_FlushMiscPolys();
00198 
00199                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);
00200                 AppInfo.lpD3DDevice->EndScene();
00201                 AppInfo.lpD3DDevice->BeginScene();
00202 
00203         }
00204         return TRUE;
00205 }

BOOL DRIVERCC EndScene void   ) 
 

Definition at line 108 of file D3D8Drv/Scene.cpp.

References AppInfo, D3DErrorToString(), D3DMain_Log(), DRIVERCC, FALSE, App_Info::lpD3DDevice, Main_ShowBackBuffer(), PCache_FlushMiscPolys(), PCache_FlushWorldPolys(), App_Info::RenderingIsOK, and TRUE.

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

BOOL DRIVERCC EndWorld void   ) 
 

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

References AppInfo, DRIVERCC, App_Info::lpD3DDevice, PCache_FlushMiscPolys(), PCache_FlushWorldPolys(), RENDER_NONE, App_Info::RenderingIsOK, RenderMode, and TRUE.

00142 {
00143         RenderMode = RENDER_NONE;
00144 
00145         if(AppInfo.RenderingIsOK)
00146         {
00147                 PCache_FlushWorldPolys();
00148                 PCache_FlushMiscPolys();
00149 
00150                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);
00151                 AppInfo.lpD3DDevice->EndScene();
00152                 AppInfo.lpD3DDevice->BeginScene();
00153         }
00154         return TRUE;
00155 }


Variable Documentation

uint32 CurrentLRU
 

Definition at line 45 of file D3D8Drv/Scene.cpp.

BOOL GlobalMeshHack
 

Definition at line 157 of file D3D8Drv/Scene.cpp.

int32 RenderMode
 

Definition at line 43 of file D3D8Drv/Scene.cpp.


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