#include "DCommon.h"Go to the source code of this file.
|
|
Definition at line 29 of file OpenGl/Render.h.
00030 {
00031 RENDER_UNKNOWN_MODE,
00032 RENDER_MISC_TEX_POLY_MODE,
00033 RENDER_MISC_GOURAD_POLY_MODE,
00034 RENDER_LINES_POLY_MODE,
00035 RENDER_WORLD_TRANSPARENT_POLY_MODE,
00036 RENDER_WORLD_POLY_MODE,
00037 RENDER_LIGHTMAP_POLY_MODE,
00038 RENDER_LIGHTMAP_FOG_POLY_MODE,
00039 RENDER_DECAL_MODE,
00040 };
|
|
|
Definition at line 178 of file D3D7xDrv/Scene.cpp.
00179 {
00180 GlobalMeshHack = TRUE;
00181 RenderMode = RENDER_MESHES;
00182 return TRUE;
00183 }
|
|
|
Definition at line 207 of file D3D7xDrv/Scene.cpp.
00208 {
00209 RenderMode = RENDER_MODELS;
00210 return TRUE;
00211 }
|
|
||||||||||||||||
|
Definition at line 1285 of file GlideDrv/Render.c. References CacheInfo, CurrentLRU, DoWireFrame, DRIVERCC, g_FogB, g_FogEnable, g_FogG, g_FogR, GE_FALSE, GE_TRUE, geBoolean, GLIDEDRV, GTHandle_CheckTextures(), DRV_Driver::NumRenderedPolys, TRUE, and uint32.
01286 {
01287 memset(&CacheInfo, 0, sizeof(DRV_CacheInfo));
01288
01289 #ifdef ENABLE_WIREFRAME
01290 {
01291 uint32 KeyState1, KeyState2;
01292
01293 #pragma message("Glide : WireFrame enabled!")
01294 KeyState1 = GetAsyncKeyState(VK_CONTROL) & 0x8001;
01295 KeyState2 = GetAsyncKeyState(VK_F8) & 0x8001;
01296 if (KeyState1 && KeyState2)
01297 {
01298 DoWireFrame ^= 1;
01299 }
01300 }
01301
01302 if (DoWireFrame)
01303 {
01304 Clear = GE_TRUE;
01305 ClearZ = GE_TRUE;
01306 }
01307 #endif
01308
01309 if (!GTHandle_CheckTextures())
01310 return GE_FALSE;
01311
01312 // FIXME: Make clear zbuffer and frame buffer seperate
01313 if (Clear)
01314 grColorMask(FXTRUE, FXFALSE);
01315 else
01316 grColorMask(FXFALSE, FXFALSE);
01317
01318
01319 if (g_FogEnable)
01320 grBufferClear(((uint32)g_FogB<<16)|((uint32)g_FogG<<8)|(uint32)g_FogR, 0, GR_ZDEPTHVALUE_FARTHEST);
01321 else
01322 grBufferClear(0, 0, GR_ZDEPTHVALUE_FARTHEST);
01323
01324 grColorMask(FXTRUE, FXTRUE);
01325
01326 GLIDEDRV.NumRenderedPolys = 0;
01327
01328 CurrentLRU++;
01329
01330 return TRUE;
01331 }
|
|
|
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 }
|
|
||||||||||||||||||||
|
Definition at line 248 of file D3D7xDrv/Render.cpp.
00249 {
00250 RECT SRect2, *pSRect;
00251 int32 Width, Height;
00252 HRESULT ddrval;
00253
00254 if(!AppInfo.RenderingIsOK)
00255 return TRUE;
00256
00257 if (!SRect)
00258 {
00259 SRect2.left = 0;
00260 SRect2.right = THandle->Width;
00261 SRect2.top = 0;
00262 SRect2.bottom = THandle->Height;
00263 pSRect = &SRect2;
00264 Width = (THandle->Width);
00265 Height = (THandle->Height);
00266 }
00267 else
00268 {
00269 pSRect = SRect;
00270 Width = (pSRect->right - pSRect->left)+1;
00271 Height = (pSRect->bottom - pSRect->top)+1;
00272 }
00273
00274 if (x + Width <= 0)
00275 return TRUE;
00276 if (y + Height <= 0)
00277 return TRUE;
00278
00279 if (x >= ClientWindow.Width)
00280 return TRUE;
00281
00282 if (y >= ClientWindow.Height)
00283 return TRUE;
00284
00285 if (x + Width >= (ClientWindow.Width-1))
00286 pSRect->right -= ((x + Width) - (ClientWindow.Width-1));
00287 if (y + Height >= (ClientWindow.Height-1))
00288 pSRect->bottom -= ((y + Height) - (ClientWindow.Height-1));
00289
00290 if (x < 0)
00291 {
00292 pSRect->left += -x;
00293 x=0;
00294 }
00295 if (y < 0)
00296 {
00297 pSRect->top += -y;
00298 y=0;
00299 }
00300
00301 #if 0
00302
00303 /* 01/24/2002 Wendell Buckner
00304 Change flags for speed...
00305 AppInfo.lpBackBuffer->BltFast(x, y, THandle->MipData[0].Surface, pSRect, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT);*/
00306 AppInfo.lpBackBuffer->BltFast(x, y, THandle->MipData[0].Surface, pSRect, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_DONOTWAIT );
00307
00308 #else
00309 RECT DRect;
00310
00311 Width = (pSRect->right - pSRect->left);
00312 Height = (pSRect->bottom - pSRect->top);
00313
00314 DRect.left = x;
00315 DRect.right = x+Width;
00316 DRect.top = y;
00317 DRect.bottom = y+Height;
00318
00319 /* 01/24/2002 Wendell Buckner
00320 Change flags for speed...
00321 ddrval= AppInfo.lpBackBuffer->Blt(&DRect, THandle->MipData[0].Surface, pSRect,
00322 (DDBLT_KEYSRC | DDBLT_WAIT), NULL);*/
00323 ddrval= AppInfo.lpBackBuffer->Blt(&DRect, THandle->MipData[0].Surface, pSRect,
00324 (DDBLT_KEYSRC | DDBLT_DONOTWAIT | DDBLT_ASYNC ), NULL);
00325
00326 if(ddrval==DDERR_SURFACELOST)
00327 {
00328 if (!D3DMain_RestoreAllSurfaces())
00329 return GE_FALSE;
00330 }
00331 //AppInfo.lpBackBuffer->Blt(&DRect, Decals[Handle].Surface, pSRect, (DDBLT_WAIT), NULL);
00332 #endif
00333
00334 return GE_TRUE;
00335 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||||||
|
Definition at line 713 of file GlideDrv/Render.c. References DRV_TLVertex::a, DRV_TLVertex::b, DRIVERCC, DRV_RENDER_ALPHA, DRV_TLVertex::g, GE_TRUE, geBoolean, geFloat, GLIDEDRV, int32, DRV_Driver::NumRenderedPolys, OGLDRV, DRV_TLVertex::r, RENDER_MAX_PNTS, RENDER_MISC_GOURAD_POLY_MODE, Render_SetHardwareMode(), SNAP_VERT, TRUE, DRV_TLVertex::x, DRV_TLVertex::y, and DRV_TLVertex::z. Referenced by Render_WorldPoly().
00714 {
00715 int32 i;
00716 GrVertex vrtx[RENDER_MAX_PNTS];
00717 geFloat Alpha = Pnts->a;
00718
00719 for (i = 0; i< NumPoints; i++)
00720 {
00721 geFloat ZRecip;
00722
00723 vrtx[i].r = Pnts->r;
00724 vrtx[i].g = Pnts->g;
00725 vrtx[i].b = Pnts->b;
00726 vrtx[i].a = Alpha;
00727
00728 // set the SOW, TOW, and OOW values for a 1 TMU configuration TMU0
00729 ZRecip = (1.0f/(Pnts->z));
00730 vrtx[i].ooz = (65535.0f) * ZRecip;
00731 vrtx[i].oow = ZRecip;
00732 vrtx[i].tmuvtx[0].oow = ZRecip;
00733
00734 vrtx[i].x = SNAP_VERT(Pnts->x);
00735 vrtx[i].y = SNAP_VERT(Pnts->y);
00736
00737 Pnts++;
00738 }
00739
00740 Render_SetHardwareMode(RENDER_MISC_GOURAD_POLY_MODE, Flags);
00741
00742 grDrawPolygonVertexList( NumPoints, vrtx);
00743
00744 GLIDEDRV.NumRenderedPolys++;
00745
00746 return TRUE;
00747 }
|
|
||||||||||||||||||||
|
Definition at line 1023 of file GlideDrv/Render.c. References DRV_TLVertex::a, DRV_TLVertex::b, boundTexture, DoWireFrame, DRIVERCC, DRV_RENDER_ALPHA, DRV_RENDER_NO_ZMASK, geRDriver_THandle::Flags, DRV_TLVertex::g, GE_TRUE, geBoolean, geFloat, geRDriver_THandle::Height, int32, NULL, geRDriver_THandle::OneOverLogSize_255, DRV_TLVertex::r, Render_LinesPoly(), RENDER_MAX_PNTS, RENDER_MISC_TEX_POLY_MODE, Render_SetHardwareMode(), SetupTexture(), SNAP_VERT, geRDriver_THandle::TextureID, THANDLE_UPDATE, THandle_Update(), TRUE, DRV_TLVertex::u, DRV_TLVertex::v, geRDriver_THandle::Width, DRV_TLVertex::x, DRV_TLVertex::y, and DRV_TLVertex::z.
01024 {
01025 int32 i;
01026 GrVertex vrtx[RENDER_MAX_PNTS];
01027 DRV_TLVertex *pPnt = Pnts;
01028 geFloat Alpha, Width_255, Height_255;
01029
01030 #ifdef ENABLE_WIREFRAME
01031 if ( DoWireFrame )
01032 return (Render_LinesPoly(Pnts, NumPoints));
01033 #endif
01034
01035 assert( Pnts != NULL );
01036 assert( NumPoints < RENDER_MAX_PNTS );
01037 assert( THandle != NULL );
01038
01039 {
01040 geFloat OneOverLogSize;
01041
01042 OneOverLogSize = THandle->OneOverLogSize_255;
01043
01044 Width_255 = (geFloat)THandle->Width * OneOverLogSize;
01045 Height_255 = (geFloat)THandle->Height * OneOverLogSize;
01046 }
01047
01048 Alpha = Pnts->a;
01049
01050 for (i = 0; i< NumPoints; i++)
01051 {
01052 geFloat ZRecip;
01053
01054 vrtx[i].a = Alpha;
01055 vrtx[i].r = pPnt->r;
01056 vrtx[i].g = pPnt->g;
01057 vrtx[i].b = pPnt->b;
01058 // set the SOW, TOW, and OOW values for a 1 TMU configuration TMU0
01059 ZRecip = (1.0f/(pPnt->z)); // 1/2 frame in this divide.
01060 vrtx[i].ooz = (65535.0f) * ZRecip;
01061 vrtx[i].oow = ZRecip;
01062 vrtx[i].tmuvtx[0].oow = ZRecip;
01063
01064 vrtx[i].tmuvtx[0].sow = pPnt->u * Width_255 * ZRecip;
01065 vrtx[i].tmuvtx[0].tow = pPnt->v * Height_255 * ZRecip;
01066
01067 vrtx[i].x = SNAP_VERT(pPnt->x);
01068 vrtx[i].y = SNAP_VERT(pPnt->y);
01069
01070 pPnt++;
01071 }
01072
01073 SetupTexture(THandle);
01074
01075 Render_SetHardwareMode(RENDER_MISC_TEX_POLY_MODE, Flags);
01076
01077 grDrawPolygonVertexList( NumPoints, vrtx);
01078 //grAADrawPolygonVertexList( NumPoints, vrtx);
01079
01080 //GLIDEDRV.NumRenderedPolys++;
01081
01082 return TRUE;
01083 }
|
|
||||||||||||
|
Definition at line 187 of file GlideDrv/Render.c. References ColorCombine_Gouraud, ColorCombine_TextureGouraud, DRV_RENDER_CLAMP_UV, DRV_RENDER_NO_ZMASK, DRV_RENDER_NO_ZWRITE, g_BoardInfo, g_FogEnable, GMain_BoardInfo::NumTMU, RENDER_DECAL_MODE, Render_HardwareFlags, Render_HardwareMode, RENDER_LIGHTMAP_FOG_POLY_MODE, RENDER_LIGHTMAP_POLY_MODE, RENDER_LINES_POLY_MODE, RENDER_MISC_GOURAD_POLY_MODE, RENDER_MISC_TEX_POLY_MODE, Render_SetColorCombine(), Render_SetTexCombine(), RENDER_WORLD_POLY_MODE, RENDER_WORLD_POLY_MODE_NO_LIGHTMAP, RENDER_WORLD_TRANSPARENT_POLY_MODE, TexCombine_PassThrough, TexCombine_SimultaneousPass, TexCombine_SinglePassGouraud, TexCombine_SinglePassTexture, and TMU. Referenced by Render_DrawDecal(), Render_GouraudPoly(), Render_LinesPoly(), Render_MiscTexturePoly(), Render_WorldPoly(), and RenderLightmapPoly().
00188 {
00189 if (NewFlags != Render_HardwareFlags) // See if the flags gave changed,,,
00190 {
00191 if (NewFlags & DRV_RENDER_NO_ZMASK)
00192 grDepthBufferFunction(GR_CMP_ALWAYS);
00193 else if (Render_HardwareFlags & DRV_RENDER_NO_ZMASK)
00194 grDepthBufferFunction( GR_CMP_GEQUAL );
00195
00196 if (NewFlags & DRV_RENDER_NO_ZWRITE)
00197 grDepthMask(FXFALSE);
00198 else if (Render_HardwareFlags & DRV_RENDER_NO_ZWRITE)
00199 grDepthMask(FXTRUE);
00200
00201 if (NewFlags & DRV_RENDER_CLAMP_UV)
00202 grTexClampMode(TMU[0], GR_TEXTURECLAMP_CLAMP,GR_TEXTURECLAMP_CLAMP);
00203 else if (Render_HardwareFlags & DRV_RENDER_CLAMP_UV)
00204 grTexClampMode(TMU[0], GR_TEXTURECLAMP_WRAP,GR_TEXTURECLAMP_WRAP);
00205 }
00206
00207 // Make these flags recent
00208 Render_HardwareFlags = NewFlags;
00209
00210 if (NewMode == Render_HardwareMode)// && NewFlags == Render_HardwareFlags)
00211 return; // Nothing to change
00212
00213 if (Render_HardwareMode == RENDER_DECAL_MODE)
00214 grChromakeyMode(GR_CHROMAKEY_DISABLE); // Restore chroma key mode
00215
00216 // sets up hardware mode
00217 switch (NewMode)
00218 {
00219 case (RENDER_MISC_TEX_POLY_MODE):
00220 {
00221 grTexMipMapMode( TMU[0], GR_MIPMAP_NEAREST, FXFALSE); // Bug fix thanks to Bobtree
00222
00223 Render_SetColorCombine(ColorCombine_TextureGouraud);
00224 Render_SetTexCombine(TexCombine_SinglePassTexture);
00225
00226 grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA,
00227 GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
00228
00229 if (g_FogEnable)
00230 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA);
00231 grFogMode(GR_FOG_WITH_TABLE);
00232
00233 break;
00234 }
00235
00236 case (RENDER_MISC_GOURAD_POLY_MODE):
00237 {
00238 Render_SetColorCombine(ColorCombine_Gouraud);
00239 Render_SetTexCombine(TexCombine_SinglePassGouraud);
00240
00241 grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA,
00242 GR_BLEND_ONE, GR_BLEND_ONE);
00243
00244 if (g_FogEnable)
00245 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA);
00246 grFogMode(GR_FOG_WITH_TABLE);
00247
00248 break;
00249 }
00250
00251 case (RENDER_LINES_POLY_MODE):
00252 {
00253 Render_SetColorCombine(ColorCombine_Gouraud);
00254 Render_SetTexCombine(TexCombine_SinglePassGouraud);
00255
00256 grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA,
00257 GR_BLEND_ONE, GR_BLEND_ONE);
00258
00259 if (g_FogEnable)
00260 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA);
00261 grFogMode(GR_FOG_WITH_TABLE);
00262
00263 break;
00264 }
00265
00266 case (RENDER_WORLD_POLY_MODE_NO_LIGHTMAP):
00267 {
00268 Render_SetColorCombine(ColorCombine_TextureGouraud);
00269 Render_SetTexCombine(TexCombine_SinglePassTexture);
00270
00271 grTexMipMapMode( TMU[0], GR_MIPMAP_NEAREST, FXFALSE);
00272
00273 grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO,
00274 GR_BLEND_ONE, GR_BLEND_ZERO);
00275
00276 if (g_FogEnable)
00277 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA);
00278 grFogMode(GR_FOG_WITH_TABLE);
00279
00280 break;
00281 }
00282
00283 case (RENDER_WORLD_POLY_MODE):
00284 {
00285 Render_SetColorCombine(ColorCombine_TextureGouraud);
00286 Render_SetTexCombine(TexCombine_SinglePassTexture);
00287
00288 grTexMipMapMode( TMU[0], GR_MIPMAP_NEAREST, FXFALSE);
00289
00290 grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO,
00291 GR_BLEND_ONE, GR_BLEND_ZERO);
00292
00293 if (g_FogEnable)
00294 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA | GR_FOG_ADD2);
00295 grFogMode(GR_FOG_WITH_TABLE | GR_FOG_ADD2);
00296
00297 break;
00298 }
00299
00300 case (RENDER_WORLD_TRANSPARENT_POLY_MODE):
00301 {
00302 Render_SetColorCombine(ColorCombine_TextureGouraud);
00303 Render_SetTexCombine(TexCombine_SinglePassTexture);
00304
00305 grTexMipMapMode( TMU[0], GR_MIPMAP_NEAREST, FXFALSE); // Bug fix thanks to Bobtree
00306
00307 grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA,
00308 GR_BLEND_SRC_COLOR, GR_BLEND_DST_COLOR);
00309
00310 if (g_FogEnable)
00311 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA);
00312 grFogMode(GR_FOG_WITH_TABLE);
00313
00314 break;
00315 }
00316
00317 // NOTE - IF this card has 2 TMU's, world polys AND lightmap polys will be piped through here
00318 // Notice how Simultaneous mode is turned on when 2 TMU's are detected... -JP
00319 case(RENDER_LIGHTMAP_POLY_MODE):
00320 {
00321 grTexMipMapMode( TMU[1], GR_MIPMAP_DISABLE, FXFALSE );
00322
00323
00324 if (g_BoardInfo.NumTMU >= 2)
00325 {
00326 Render_SetColorCombine(ColorCombine_TextureGouraud);
00327
00328 grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA,
00329 GR_BLEND_SRC_COLOR, GR_BLEND_DST_COLOR);
00330
00331 if (g_FogEnable)
00332 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA);
00333 grFogMode(GR_FOG_WITH_TABLE);
00334
00335 Render_SetTexCombine(TexCombine_SimultaneousPass);
00336
00337 grTexMipMapMode( TMU[0], GR_MIPMAP_NEAREST, FXFALSE);
00338 }
00339 else
00340 {
00341 Render_SetColorCombine(ColorCombine_TextureGouraud);
00342
00343 // Singlepass mode if there is onle 1 TMU
00344 Render_SetTexCombine(TexCombine_SinglePassTexture);
00345
00346 // Modulate the texture with the framebuffer
00347 if (g_FogEnable)
00348 {
00349 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA | GR_FOG_MULT2);
00350 grFogMode(GR_FOG_WITH_TABLE | GR_FOG_MULT2);
00351
00352 grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_PREFOG_COLOR,
00353 GR_BLEND_ONE, GR_BLEND_ZERO);
00354 }
00355 else
00356 {
00357 grAlphaBlendFunction( GR_BLEND_DST_COLOR, GR_BLEND_ZERO,
00358 GR_BLEND_ONE, GR_BLEND_ZERO);
00359 }
00360
00361 // Force clamping to be on if this card only has one TMU
00362 grTexClampMode(TMU[0], GR_TEXTURECLAMP_CLAMP,GR_TEXTURECLAMP_CLAMP);
00363 Render_HardwareFlags |= DRV_RENDER_CLAMP_UV;
00364 }
00365
00366 break;
00367 }
00368
00369 case(RENDER_LIGHTMAP_FOG_POLY_MODE):
00370 {
00371 grTexMipMapMode( TMU[1], GR_MIPMAP_DISABLE, FXFALSE );
00372
00373 Render_SetColorCombine(ColorCombine_TextureGouraud);
00374
00375 if (g_BoardInfo.NumTMU >= 2)
00376 {
00377 Render_SetTexCombine(TexCombine_PassThrough);
00378 grTexMipMapMode(TMU[0], GR_MIPMAP_NEAREST, FXFALSE);
00379 }
00380 else
00381 {
00382 Render_SetTexCombine(TexCombine_SinglePassTexture);
00383 }
00384
00385 if (g_FogEnable)
00386 //grFogMode(GR_FOG_WITH_ITERATED_ALPHA);
00387 grFogMode(GR_FOG_DISABLE);
00388
00389 grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ONE,
00390 GR_BLEND_ONE, GR_BLEND_ONE);
00391
00392 break;
00393 }
00394
00395 case (RENDER_DECAL_MODE):
00396 {
00397 grLfbConstantDepth(0xffff);
00398 grLfbConstantAlpha(0xff);
00399 grChromakeyMode(GR_CHROMAKEY_ENABLE);
00400 grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO,
00401 GR_BLEND_ONE, GR_BLEND_ZERO);
00402
00403 break;
00404 }
00405
00406 default:
00407 {
00408 assert(0);
00409 }
00410 }
00411
00412 Render_HardwareMode = NewMode;
00413 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 795 of file GlideDrv/Render.c. References DRV_TLVertex::a, DRV_TLVertex::b, boundTexture, DoWireFrame, DRV_TexInfo::DrawScaleU, DRV_TexInfo::DrawScaleV, DRIVERCC, DRV_POLYMODE_GOURAUD, DRV_POLYMODE_LINES, DRV_POLYMODE_NORMAL, DRV_RENDER_ALPHA, geRDriver_THandle::Flags, DRV_TLVertex::g, g_BoardInfo, GE_TRUE, geBoolean, geFloat, GLIDEDRV, geRDriver_THandle::Height, int32, geRDriver_THandle::LogSize, DRV_LInfo::MinU, DRV_LInfo::MinV, multitexture, NULL, DRV_Driver::NumRenderedPolys, GMain_BoardInfo::NumTMU, OGLDRV, geRDriver_THandle::OneOverLogSize_255, PolyMode, DRV_TLVertex::r, Render_GouraudPoly(), Render_LinesPoly(), RENDER_MAX_PNTS, Render_SetHardwareMode(), RENDER_WORLD_POLY_MODE, RENDER_WORLD_POLY_MODE_NO_LIGHTMAP, RENDER_WORLD_TRANSPARENT_POLY_MODE, Render_WorldPolyMultitexture(), Render_WorldPolyRegular(), RenderLightmapPoly(), DRV_Driver::SetupLightmap, SetupTexture(), DRV_TexInfo::ShiftU, DRV_TexInfo::ShiftV, SNAP_VERT, geRDriver_THandle::TextureID, DRV_LInfo::THandle, THandle_DownloadLightmap(), THANDLE_UPDATE, THandle_Update(), THANDLE_UPDATE_LM, TMU, TRUE, DRV_TLVertex::u, v, DRV_TLVertex::v, geRDriver_THandle::Width, DRV_TLVertex::x, DRV_TLVertex::y, and DRV_TLVertex::z.
00796 {
00797 GrVertex Vrtx[RENDER_MAX_PNTS], *pVrtx;
00798 geFloat OneOverSize_255;
00799 geFloat ShiftU, ShiftV, ScaleU, ScaleV;
00800 DRV_TLVertex *pPnts;
00801 int32 i;
00802 geFloat Alpha;
00803
00804 assert(Pnts);
00805 assert(TexInfo);
00806
00807 #ifdef ENABLE_WIREFRAME
00808 if ( DoWireFrame )
00809 return (Render_LinesPoly(Pnts, NumPoints));
00810 #endif
00811
00812 #if 0
00813 switch (PolyMode)
00814 {
00815 case DRV_POLYMODE_NORMAL:
00816 break; // Use this function
00817 case DRV_POLYMODE_GOURAUD:
00818 return (Render_GouraudPoly(Pnts, NumPoints, 0));
00819 case DRV_POLYMODE_LINES:
00820 return (Render_LinesPoly(Pnts, NumPoints));
00821 }
00822 #endif
00823
00824 GLIDEDRV.NumRenderedPolys++;
00825
00826 OneOverSize_255 = THandle->OneOverLogSize_255;
00827
00828 // Get how much to shift U, and V for the Texture
00829 ShiftU = TexInfo->ShiftU;
00830 ShiftV = TexInfo->ShiftV;
00831 ScaleU = 1.0f/TexInfo->DrawScaleU;
00832 ScaleV = 1.0f/TexInfo->DrawScaleV;
00833
00834 pPnts = Pnts;
00835
00836 pVrtx = Vrtx;
00837
00838 #if 0
00839 // Fix the uv's to be as close to the origin as possible, without affecting their appearance...
00840 //if (pPnts->u > 1000.0f || pPnts->v > 1000.0f)
00841 {
00842 geFloat OneOverLogSize;
00843
00844 OneOverLogSize = 1.0f / (geFloat)THandle->LogSize;
00845
00846 ShiftU -= (geFloat)(((int32)(pPnts->u*ScaleU/THandle->Width))*THandle->Width);
00847 ShiftV -= (geFloat)(((int32)(pPnts->v*ScaleV/THandle->Height))*THandle->Height);
00848 }
00849 #endif
00850
00851 Alpha = Pnts->a;
00852
00853 for (i = 0; i< NumPoints; i++)
00854 {
00855 geFloat ZRecip;
00856
00857 pVrtx->a = Alpha;
00858
00859 pVrtx->r = pPnts->r;
00860 pVrtx->g = pPnts->g;
00861 pVrtx->b = pPnts->b;
00862
00863 ZRecip = (1.0f/(pPnts->z));
00864 pVrtx->ooz = 65535.0f * ZRecip;
00865 pVrtx->oow = ZRecip;
00866
00867 pVrtx->tmuvtx[0].oow = ZRecip;
00868 pVrtx->tmuvtx[1].oow = ZRecip;
00869
00870 ZRecip *= OneOverSize_255;
00871
00872 pVrtx->tmuvtx[TMU[0]].sow = (pPnts->u*ScaleU + ShiftU) * ZRecip;
00873 pVrtx->tmuvtx[TMU[0]].tow = (pPnts->v*ScaleV + ShiftV) * ZRecip;
00874
00875 pVrtx->x = SNAP_VERT(pPnts->x);
00876 pVrtx->y = SNAP_VERT(pPnts->y);
00877
00878 pPnts++;
00879 pVrtx++;
00880 }
00881
00882
00883 // Set the source texture for TMU 0
00884 SetupTexture(THandle);
00885
00886 // If only 1 TMU (or no lightmap), then draw first pass poly now.
00887 if (g_BoardInfo.NumTMU == 1 || !LInfo)
00888 { // The lightmap will blend over it
00889 if (Flags & DRV_RENDER_ALPHA)
00890 Render_SetHardwareMode(RENDER_WORLD_TRANSPARENT_POLY_MODE, Flags);
00891 else
00892 {
00893 if (LInfo)
00894 Render_SetHardwareMode(RENDER_WORLD_POLY_MODE, Flags);
00895 else
00896 Render_SetHardwareMode(RENDER_WORLD_POLY_MODE_NO_LIGHTMAP, Flags);
00897 }
00898
00899 grDrawPolygonVertexList( NumPoints, Vrtx);
00900 }
00901
00902 if (LInfo) // If there is a lightmap, render it now, on top of the first pass poly
00903 {
00904 geBoolean Dynamic;
00905
00906 // How much to shift u'vs back into lightmap space
00907 ShiftU = (geFloat)LInfo->MinU-8.0f;
00908 ShiftV = (geFloat)LInfo->MinV-8.0f;
00909
00910 pPnts = Pnts;
00911
00912 // Call the engine to set this sucker up, because it's visible...
00913 GLIDEDRV.SetupLightmap(LInfo, &Dynamic);
00914
00915 OneOverSize_255 = LInfo->THandle->OneOverLogSize_255;
00916
00917 pVrtx = Vrtx;
00918
00919 for (i = 0; i< NumPoints; i++)
00920 {
00921 geFloat u = pPnts->u-ShiftU;
00922 geFloat v = pPnts->v-ShiftV;
00923 geFloat ZRecip = pVrtx->oow * OneOverSize_255;
00924
00925 pVrtx->tmuvtx[TMU[1]].sow = u*ZRecip;
00926 pVrtx->tmuvtx[TMU[1]].tow = v*ZRecip;
00927 pPnts++;
00928 pVrtx++;
00929 }
00930
00931 RenderLightmapPoly(Vrtx, NumPoints, LInfo, (geBoolean)Dynamic, Flags);
00932 }
00933
00934 return TRUE;
00935 }
|
|
|
Definition at line 43 of file OpenGl/Render.h. |
|
|
Definition at line 44 of file OpenGl/Render.h. Referenced by DrawDecal(), and FreeAllTextureHandles(). |
|
|
Definition at line 42 of file OpenGl/Render.h. |
1.3.2