diff options
author | Fire_Head <Fire-Head@users.noreply.github.com> | 2020-07-29 11:20:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-29 11:20:02 +0200 |
commit | 52e77c66345399f7f1064b80676a2495e299bb46 (patch) | |
tree | 358b7762beb8809084c65358087d5899e4546f18 /src/render/Renderer.cpp | |
parent | miami shadows (diff) | |
parent | some fakerw additions for shadows; update librw (diff) | |
download | re3-52e77c66345399f7f1064b80676a2495e299bb46.tar re3-52e77c66345399f7f1064b80676a2495e299bb46.tar.gz re3-52e77c66345399f7f1064b80676a2495e299bb46.tar.bz2 re3-52e77c66345399f7f1064b80676a2495e299bb46.tar.lz re3-52e77c66345399f7f1064b80676a2495e299bb46.tar.xz re3-52e77c66345399f7f1064b80676a2495e299bb46.tar.zst re3-52e77c66345399f7f1064b80676a2495e299bb46.zip |
Diffstat (limited to 'src/render/Renderer.cpp')
-rw-r--r-- | src/render/Renderer.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index becac84d..0640f25e 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -317,7 +317,11 @@ enum Visbility VIS_STREAMME }; +#ifdef FIX_BUGS +#define LOD_DISTANCE (300.0f*TheCamera.LODDistMultiplier) +#else #define LOD_DISTANCE 300.0f +#endif #define FADE_DISTANCE 20.0f #define STREAM_DISTANCE 30.0f @@ -419,6 +423,8 @@ CRenderer::SetupEntityVisibility(CEntity *ent) // whose draw dist is > LOD_DISTANCE-FADE_DISTANCE, i.e. 280 // because decreasing dist here makes the object visible above LOD_DISTANCE // before fading normally once below LOD_DISTANCE. + // aha! this must be a workaround for the fact that we're not taking + // the LOD multiplier into account here anywhere if(LOD_DISTANCE < dist && dist < mi->GetLargestLodDistance() + FADE_DISTANCE) dist += mi->GetLargestLodDistance() - LOD_DISTANCE; #endif @@ -751,14 +757,7 @@ CRenderer::ScanWorld(void) }else #endif { - if(f <= LOD_DISTANCE){ - poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x); - poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y); - poly[1].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPLEFT].x); - poly[1].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPLEFT].y); - poly[2].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPRIGHT].x); - poly[2].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPRIGHT].y); - }else{ + if(f > LOD_DISTANCE){ // priority poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x); poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y); @@ -775,11 +774,19 @@ CRenderer::ScanWorld(void) poly[1].y = CWorld::GetSectorY(vectors[CORNER_LOD_LEFT].y); poly[2].x = CWorld::GetSectorX(vectors[CORNER_LOD_RIGHT].x); poly[2].y = CWorld::GetSectorY(vectors[CORNER_LOD_RIGHT].y); + ScanSectorPoly(poly, 3, ScanSectorList); + }else{ + poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x); + poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y); + poly[1].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPLEFT].x); + poly[1].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPLEFT].y); + poly[2].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPRIGHT].x); + poly[2].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPRIGHT].y); + ScanSectorPoly(poly, 3, ScanSectorList); } - ScanSectorPoly(poly, 3, ScanSectorList); ScanBigBuildingList(CWorld::GetBigBuildingList(CGame::currLevel)); - ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_NONE)); + ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_GENERIC)); } } } @@ -922,9 +929,9 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL // prestep x1 and x2 to next integer y deltaA = CalcNewDelta(&poly[a1], &poly[a2]); - xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x; + xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x; deltaB = CalcNewDelta(&poly[b1], &poly[b2]); - xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x; + xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x; if(y != yend){ if(deltaB < 0.0f && (int)xB < xstart) @@ -969,7 +976,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL xstart = poly[b1].x; }while(y == (int)poly[b2].y); deltaB = CalcNewDelta(&poly[b1], &poly[b2]); - xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x; + xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x; if(deltaB < 0.0f && (int)xB < xstart) xstart = xB; } @@ -1005,7 +1012,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL xend = poly[a1].x; }while(y == (int)poly[a2].y); deltaA = CalcNewDelta(&poly[a1], &poly[a2]); - xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x; + xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x; if(deltaA >= 0.0f && (int)xA > xend) xend = xA; } |