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.

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 38 of file WireFrame/Scene.cpp.


Function Documentation

BOOL DRIVERCC BeginMeshes void   ) 
 

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

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

00168 {
00169         GlobalMeshHack = TRUE;
00170         RenderMode = RENDER_MESHES;
00171         return TRUE;
00172 }

BOOL DRIVERCC BeginModels void   ) 
 

Definition at line 194 of file WireFrame/Scene.cpp.

References DRIVERCC, RENDER_MODELS, RenderMode, and TRUE.

00195 {
00196         RenderMode = RENDER_MODELS;
00197         return TRUE;
00198 }

BOOL DRIVERCC BeginScene BOOL  Clear,
BOOL  ClearZ,
RECT WorldRect
 

Definition at line 44 of file WireFrame/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.

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

BOOL DRIVERCC BeginWorld void   ) 
 

Definition at line 132 of file WireFrame/Scene.cpp.

References AppInfo, ClientWindow, DRIVERCC, DRV_Window::Height, RENDER_WORLD, App_Info::RenderingIsOK, RenderMode, ResetSpans(), and TRUE.

00133 {
00134         #ifdef USE_SPANS
00135                 if(AppInfo.RenderingIsOK)
00136                 {
00137                         ResetSpans(ClientWindow.Height);
00138                 }
00139         #endif
00140 
00141         RenderMode = RENDER_WORLD;
00142         return TRUE;
00143 }

BOOL DRIVERCC EndMeshes void   ) 
 

Definition at line 174 of file WireFrame/Scene.cpp.

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

00175 {
00176         RenderMode = RENDER_NONE;
00177 
00178         if(AppInfo.RenderingIsOK)
00179         {
00180                 PCache_FlushMiscPolys();
00181                 PCache_FlushWorldPolys();
00182 
00183         #ifdef SUPER_FLUSH
00184                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);
00185                 AppInfo.lpD3DDevice->EndScene();
00186                 AppInfo.lpD3DDevice->BeginScene();
00187         #endif
00188 
00189                 GlobalMeshHack = FALSE;
00190         }
00191         return TRUE;
00192 }

BOOL DRIVERCC EndModels void   ) 
 

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

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

00201 {
00202         RenderMode = RENDER_NONE;
00203 
00204         if(AppInfo.RenderingIsOK)
00205         {
00206                 PCache_FlushWorldPolys();
00207                 PCache_FlushMiscPolys();
00208 
00209         #ifdef SUPER_FLUSH
00210                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);
00211                 AppInfo.lpD3DDevice->EndScene();
00212                 AppInfo.lpD3DDevice->BeginScene();
00213         #endif
00214 
00215         }
00216         return TRUE;
00217 }

BOOL DRIVERCC EndScene void   ) 
 

Definition at line 105 of file WireFrame/Scene.cpp.

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

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

BOOL DRIVERCC EndWorld void   ) 
 

Definition at line 145 of file WireFrame/Scene.cpp.

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

00146 {
00147         RenderMode = RENDER_NONE;
00148 
00149         if(AppInfo.RenderingIsOK)
00150         {
00151                 PCache_FlushWorldPolys();
00152                 PCache_FlushMiscPolys();
00153 
00154                 assert(AppInfo.lpD3DDevice);
00155         #ifdef SUPER_FLUSH
00156                 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);
00157                 AppInfo.lpD3DDevice->EndScene();
00158                 AppInfo.lpD3DDevice->BeginScene();
00159         #endif
00160 
00161         }
00162         return TRUE;
00163 }


Variable Documentation

uint32 CurrentLRU
 

Definition at line 42 of file WireFrame/Scene.cpp.

BOOL GlobalMeshHack
 

Definition at line 165 of file WireFrame/Scene.cpp.

int32 RenderMode
 

Definition at line 40 of file WireFrame/Scene.cpp.


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