376 | 377 | ||
---|---|---|---|
41 | #include "kshape.h" | 41 | #include "kshape.h" |
42 | int LightIntensityAtPoint(VECTORCH *pointPtr); | 42 | int LightIntensityAtPoint(VECTORCH *pointPtr); |
43 | extern float CameraZoomScale; | 43 | extern float CameraZoomScale; |
44 | extern float p, o; | ||
44 | } | 45 | } |
45 | 46 | ||
46 | static float currentCameraZoomScale = 1.0f; | 47 | static float currentCameraZoomScale = 1.0f; |
... | ... | ||
248 | mainList->Sort(); | 249 | mainList->Sort(); |
249 | 250 | ||
250 | // check if we're zooming in (Predator zoom) | 251 | // check if we're zooming in (Predator zoom) |
251 | if (currentCameraZoomScale != CameraZoomScale) | 252 | // if (currentCameraZoomScale != CameraZoomScale) |
252 | { | 253 | { |
253 | R_CameraZoom(CameraZoomScale); | 254 | // R_CameraZoom(CameraZoomScale); |
254 | currentCameraZoomScale = CameraZoomScale; | 255 | // currentCameraZoomScale = CameraZoomScale; |
256 | D3DXMatrixPerspectiveFovLH(&matProjection, D3DXToRadian(d3d.fieldOfView * CameraZoomScale), (((float)ScreenDescriptorBlock.SDB_Width) *1) / (((float)ScreenDescriptorBlock.SDB_Height) *p), 64.0f, 1000000.0f); | ||
255 | } | 257 | } |
256 | 258 | ||
257 | { | 259 | { |
... | ... | ||
312 | 314 | ||
313 | void DrawFmvFrame(uint32_t frameWidth, uint32_t frameHeight, uint32_t textureWidth, uint32_t textureHeight, r_Texture fmvTexture) | 315 | void DrawFmvFrame(uint32_t frameWidth, uint32_t frameHeight, uint32_t textureWidth, uint32_t textureHeight, r_Texture fmvTexture) |
314 | { | 316 | { |
317 | /* | ||
315 | uint32_t topX = (640 - frameWidth) / 2; | 318 | uint32_t topX = (640 - frameWidth) / 2; |
316 | uint32_t topY = (480 - frameHeight) / 2; | 319 | uint32_t topY = (480 - frameHeight) / 2; |
317 | 320 | ||
... | ... | ||
369 | { | 372 | { |
370 | OutputDebugString("DrawPrimitiveUP failed\n"); | 373 | OutputDebugString("DrawPrimitiveUP failed\n"); |
371 | } | 374 | } |
375 | */ | ||
372 | } | 376 | } |
373 | 377 | ||
374 | void DrawFmvFrame2(uint32_t frameWidth, uint32_t frameHeight, uint32_t *textures, uint32_t numTextures) | 378 | void DrawFmvFrame2(uint32_t frameWidth, uint32_t frameHeight, uint32_t *textures, uint32_t numTextures) |
... | ... | ||
1046 | orthoList->CreateOrthoIndices(orthoIndex); | 1050 | orthoList->CreateOrthoIndices(orthoIndex); |
1047 | } | 1051 | } |
1048 | 1052 | ||
1053 | extern void BuildFrustum(); | ||
1054 | |||
1049 | extern "C" { | 1055 | extern "C" { |
1050 | 1056 | ||
1051 | #include "3dc.h" | 1057 | #include "3dc.h" |
... | ... | ||
1115 | viewMatrix._41 = -D3DXVec3Dot(&vecPosition, &vecRight); | 1121 | viewMatrix._41 = -D3DXVec3Dot(&vecPosition, &vecRight); |
1116 | viewMatrix._42 = -D3DXVec3Dot(&vecPosition, &vecUp); | 1122 | viewMatrix._42 = -D3DXVec3Dot(&vecPosition, &vecUp); |
1117 | viewMatrix._43 = -D3DXVec3Dot(&vecPosition, &vecFront); | 1123 | viewMatrix._43 = -D3DXVec3Dot(&vecPosition, &vecFront); |
1124 | |||
1125 | // move this later (we may not catch projection matrix changes otherwise) | ||
1126 | // BuildFrustum(); | ||
1118 | } | 1127 | } |
1119 | 1128 | ||
1120 | void DrawCoronas() | 1129 | void DrawCoronas() |
... | ... | ||
1349 | } | 1358 | } |
1350 | #endif | 1359 | #endif |
1351 | 1360 | ||
1361 | extern BOOL CheckPointIsInFrustum(D3DXVECTOR3 *point); | ||
1362 | |||
1352 | void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr) | 1363 | void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr) |
1353 | { | 1364 | { |
1354 | // bjd - This is the function responsible for drawing level geometry and the players weapon | 1365 | // bjd - This is the function responsible for drawing level geometry and the players weapon |
1355 | 1366 | ||
1367 | bool valid = false; | ||
1368 | /* | ||
1369 | // test frustum culling for each point | ||
1370 | for (uint32_t i = 0; i < RenderPolygon.NumberOfVertices; i++) | ||
1371 | { | ||
1372 | RENDERVERTEX *vertices = &renderVerticesPtr[i]; | ||
1373 | |||
1374 | VECTORCHF test; | ||
1375 | test.vx = vertices->X; | ||
1376 | test.vy = vertices->Y; | ||
1377 | test.vz = vertices->Z; | ||
1378 | |||
1379 | TransformToViewspace(&test); | ||
1380 | |||
1381 | D3DXVECTOR3 temp; | ||
1382 | // temp.x = (float)vertices->X; | ||
1383 | // temp.y = (float)-vertices->Y; | ||
1384 | // temp.z = (float)vertices->Z; | ||
1385 | |||
1386 | temp.x = (float)test.vx; | ||
1387 | temp.y = (float)-test.vy; | ||
1388 | temp.z = (float)test.vz; | ||
1389 | |||
1390 | if (CheckPointIsInFrustum(&temp) == TRUE) | ||
1391 | { | ||
1392 | // true | ||
1393 | valid = true; | ||
1394 | break; | ||
1395 | } | ||
1396 | } | ||
1397 | |||
1398 | // lets bail out of this function and not draw this poly if none of the points are inside the view frustum | ||
1399 | if (valid == false) | ||
1400 | return; | ||
1401 | */ | ||
1356 | // We assume bit 15 (TxLocal) HAS been | 1402 | // We assume bit 15 (TxLocal) HAS been |
1357 | // properly cleared this time... | 1403 | // properly cleared this time... |
1358 | uint32_t textureID = (inputPolyPtr->PolyColour & ClrTxDefn); | 1404 | uint32_t textureID = (inputPolyPtr->PolyColour & ClrTxDefn); |
... | ... | ||
1660 | 1706 | ||
1661 | void D3D_DecalSystem_Setup(void) | 1707 | void D3D_DecalSystem_Setup(void) |
1662 | { | 1708 | { |
1663 | /* | ||
1664 | UnlockExecuteBufferAndPrepareForUse(); | 1709 | UnlockExecuteBufferAndPrepareForUse(); |
1665 | ExecuteBuffer(); | 1710 | ExecuteBuffer(); |
1666 | LockExecuteBuffer(); | 1711 | LockExecuteBuffer(); |
1667 | 1712 | ||
1668 | ChangeZWriteEnable(ZWRITE_DISABLED); | 1713 | ChangeZWriteEnable(ZWRITE_DISABLED); |
1669 | */ | ||
1670 | } | 1714 | } |
1671 | 1715 | ||
1672 | void D3D_DecalSystem_End(void) | 1716 | void D3D_DecalSystem_End(void) |
1673 | { | 1717 | { |
1674 | |||
1675 | DrawParticles(); | 1718 | DrawParticles(); |
1676 | DrawCoronas(); | 1719 | DrawCoronas(); |
1677 | /* | 1720 | |
1678 | UnlockExecuteBufferAndPrepareForUse(); | 1721 | UnlockExecuteBufferAndPrepareForUse(); |
1679 | ExecuteBuffer(); | 1722 | ExecuteBuffer(); |
1680 | LockExecuteBuffer(); | 1723 | LockExecuteBuffer(); |
1681 | 1724 | ||
1682 | ChangeZWriteEnable(ZWRITE_ENABLED); | 1725 | ChangeZWriteEnable(ZWRITE_ENABLED); |
1683 | */ | ||
1684 | } | 1726 | } |
1685 | 1727 | ||
1686 | void D3D_Decal_Output(DECAL *decalPtr, RENDERVERTEX *renderVerticesPtr) | 1728 | void D3D_Decal_Output(DECAL *decalPtr, RENDERVERTEX *renderVerticesPtr) |