#include <Windows.h>#include <stdio.h>#include "D3DDrv.h"#include "DCommon.h"#include "Render.h"#include "Scene.h"#include "GSpan.h"#include "D3D_Fx.h"#include "D3DCache.h"#include "D3D_Err.h"#include "THandle.h"#include "PCache.h"Go to the source code of this file.
Defines | |
| #define | SNAP_VERT(v) ( ( v ) = ( float )( ( long )( ( v ) * 16 ) ) / 16.0f ) |
Functions | |
| geBoolean DRIVERCC | RenderGouraudPoly (DRV_TLVertex *Pnts, int32 NumPoints, uint32 Flags) |
| geBoolean DRIVERCC | RenderWorldPoly (DRV_TLVertex *Pnts, int32 NumPoints, geRDriver_THandle *THandle, DRV_TexInfo *TexInfo, DRV_LInfo *LInfo, uint32 Flags) |
| geBoolean DRIVERCC | RenderMiscTexturePoly (DRV_TLVertex *Pnts, int32 NumPoints, geRDriver_THandle *THandle, uint32 Flags) |
| geBoolean DRIVERCC | DrawDecal (geRDriver_THandle *THandle, RECT *SRect, int32 x, int32 y) |
|
|
Definition at line 46 of file D3D8Drv/Render.cpp. |
|
||||||||||||||||||||
|
Definition at line 172 of file D3D8Drv/Render.cpp. References AppInfo, tagRECT::bottom, ClientWindow, D3DMain_RestoreAllSurfaces(), DRIVERCC, GE_FALSE, GE_TRUE, geBoolean, DRV_Window::Height, geRDriver_THandle::Height, int32, tagRECT::left, App_Info::lpBackBuffer, geRDriver_THandle::MipData, NULL, App_Info::RenderingIsOK, tagRECT::right, THandle_MipData::Surface, tagRECT::top, TRUE, DRV_Window::Width, geRDriver_THandle::Width, and y.
00173 {
00174 RECT SRect2, *pSRect;
00175 int32 Width, Height;
00176 HRESULT ddrval;
00177
00178 if(!AppInfo.RenderingIsOK)
00179 return TRUE;
00180
00181 if (!SRect)
00182 {
00183 SRect2.left = 0;
00184 SRect2.right = THandle->Width;
00185 SRect2.top = 0;
00186 SRect2.bottom = THandle->Height;
00187 pSRect = &SRect2;
00188 Width = (THandle->Width);
00189 Height = (THandle->Height);
00190 }
00191 else
00192 {
00193 pSRect = SRect;
00194 Width = (pSRect->right - pSRect->left)+1;
00195 Height = (pSRect->bottom - pSRect->top)+1;
00196 }
00197
00198 if (x + Width <= 0)
00199 return TRUE;
00200 if (y + Height <= 0)
00201 return TRUE;
00202
00203 if (x >= ClientWindow.Width)
00204 return TRUE;
00205
00206 if (y >= ClientWindow.Height)
00207 return TRUE;
00208
00209 if (x + Width >= (ClientWindow.Width-1))
00210 pSRect->right -= ((x + Width) - (ClientWindow.Width-1));
00211 if (y + Height >= (ClientWindow.Height-1))
00212 pSRect->bottom -= ((y + Height) - (ClientWindow.Height-1));
00213
00214 if (x < 0)
00215 {
00216 pSRect->left += -x;
00217 x=0;
00218 }
00219 if (y < 0)
00220 {
00221 pSRect->top += -y;
00222 y=0;
00223 }
00224
00225 RECT DRect;
00226
00227 Width = (pSRect->right - pSRect->left);
00228 Height = (pSRect->bottom - pSRect->top);
00229
00230 DRect.left = x;
00231 DRect.right = x+Width;
00232 DRect.top = y;
00233 DRect.bottom = y+Height;
00234
00235 ddrval= AppInfo.lpBackBuffer->Blt(&DRect, THandle->MipData[0].Surface, pSRect,
00236 (DDBLT_KEYSRC | DDBLT_WAIT), NULL);
00237
00238 if(ddrval==DDERR_SURFACELOST)
00239 {
00240 if (!D3DMain_RestoreAllSurfaces())
00241 return GE_FALSE;
00242 }
00243
00244 return GE_TRUE;
00245 }
|
|
||||||||||||||||
|
Definition at line 48 of file D3D8Drv/Render.cpp. References DRV_TLVertex::a, AppInfo, DRV_TLVertex::b, D3DBlendFunc(), D3DSetTexture(), D3DTexturedPolyOld(), DRIVERCC, DRV_RENDER_FLUSH, DRV_RENDER_POLY_NO_FOG, DWORD, FALSE, App_Info::FogEnable, App_Info::FogEnd, App_Info::FogStart, DRV_TLVertex::g, geBoolean, int32, App_Info::lpD3DDevice, NULL, PCache_FlushMiscPolys(), PCache_FlushWorldPolys(), DRV_TLVertex::r, App_Info::RenderingIsOK, TRUE, DRV_TLVertex::x, DRV_TLVertex::y, and DRV_TLVertex::z.
00049 {
00050 int32 i;
00051 DRV_TLVertex *pPnts;
00052 D3DTLVERTEX D3DPnts[30], *pD3DPnts;
00053 float ZRecip;
00054 float Alpha;
00055
00056 if(!AppInfo.RenderingIsOK)
00057 return TRUE;
00058
00059 if (Flags & DRV_RENDER_FLUSH)
00060 {
00061 if (!PCache_FlushWorldPolys())
00062 return FALSE;
00063 if (!PCache_FlushMiscPolys())
00064 return FALSE;
00065 }
00066
00067 Alpha = Pnts->a;
00068
00069 D3DBlendFunc (D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
00070
00071 D3DSetTexture(0, NULL);
00072
00073 int32 SAlpha = (int32)Alpha<<24;
00074 pPnts = Pnts;
00075 pD3DPnts = D3DPnts;
00076 for (i=0; i< NumPoints; i++)
00077 {
00078 ZRecip = 1/pPnts->z;
00079
00080 pD3DPnts->sx = pPnts->x;
00081 pD3DPnts->sy = pPnts->y;
00082 pD3DPnts->sz = (1.0f - ZRecip); // ZBUFFER
00083 pD3DPnts->rhw = ZRecip;
00084 pD3DPnts->color = SAlpha | ((int32)pPnts->r<<16) | ((int32)pPnts->g<<8) | (int32)pPnts->b;
00085
00086 if (AppInfo.FogEnable && !(Flags & DRV_RENDER_POLY_NO_FOG)) // poly fog
00087 {
00088 DWORD FogVal;
00089 float Val;
00090
00091 Val = pPnts->z;
00092
00093 if (Val > AppInfo.FogEnd)
00094 Val = AppInfo.FogEnd;
00095
00096 FogVal = (DWORD)((AppInfo.FogEnd-Val)/(AppInfo.FogEnd-AppInfo.FogStart)*255.0f);
00097
00098 if (FogVal < 0)
00099 FogVal = 0;
00100 else if (FogVal > 255)
00101 FogVal = 255;
00102
00103 pD3DPnts->specular = (FogVal<<24); // Alpha component in specular is the fog value (0...255)
00104 }
00105 else
00106 pD3DPnts->specular = 0;
00107
00108 pPnts++;
00109 pD3DPnts++;
00110 }
00111
00112 D3DTexturedPolyOld(D3DPnts, NumPoints);
00113
00114 if (Flags & DRV_RENDER_FLUSH)
00115 {
00116 AppInfo.lpD3DDevice->SetRenderState(D3DRENDERSTATE_FLUSHBATCH, 0);
00117 AppInfo.lpD3DDevice->EndScene();
00118 AppInfo.lpD3DDevice->BeginScene();
00119 }
00120
00121 return TRUE;
00122 }
|
|
||||||||||||||||||||
|
Definition at line 151 of file D3D8Drv/Render.cpp. References AppInfo, DRIVERCC, DRV_RENDER_FLUSH, geBoolean, PCache_FlushMiscPolys(), PCache_InsertMiscPoly(), App_Info::RenderingIsOK, and TRUE.
00152 {
00153 if(!AppInfo.RenderingIsOK)
00154 {
00155 return TRUE;
00156 }
00157 else if (Flags & DRV_RENDER_FLUSH)
00158 {
00159 PCache_FlushMiscPolys();
00160 }
00161
00162 PCache_InsertMiscPoly(Pnts, NumPoints, THandle, Flags);
00163
00164 if (Flags & DRV_RENDER_FLUSH)
00165 {
00166 PCache_FlushMiscPolys();
00167 }
00168
00169 return TRUE;
00170 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 124 of file D3D8Drv/Render.cpp. References AppInfo, D3DDRV, DRIVERCC, DRV_RENDER_FLUSH, FALSE, geBoolean, DRV_Driver::NumRenderedPolys, PCache_FlushWorldPolys(), PCache_InsertWorldPoly(), App_Info::RenderingIsOK, and TRUE.
00125 {
00126 if(!AppInfo.RenderingIsOK)
00127 {
00128 return TRUE;
00129 }
00130 else if (Flags & DRV_RENDER_FLUSH)
00131 {
00132 if (!PCache_FlushWorldPolys())
00133 return FALSE;
00134 }
00135
00136
00137 D3DDRV.NumRenderedPolys++;
00138
00139 // Insert the poly into the world cache, for later rendering
00140 PCache_InsertWorldPoly(Pnts, NumPoints, THandle, TexInfo, LInfo, Flags);
00141
00142 if (Flags & DRV_RENDER_FLUSH)
00143 {
00144 if (!PCache_FlushWorldPolys())
00145 return FALSE;
00146 }
00147
00148 return TRUE;
00149 }
|
1.3.2