diff options
author | Fire_Head <Fire-Head@users.noreply.github.com> | 2020-08-27 19:35:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 19:35:14 +0200 |
commit | a8999bbf38cae233e39b5995118fa03bca7894ef (patch) | |
tree | ada9bd1935512f4b46fe6b4f42d9160eb2281262 /src/render/Renderer.cpp | |
parent | bike shooting fix + trace temp fix (diff) | |
parent | update librw (diff) | |
download | re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.gz re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.bz2 re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.lz re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.xz re3-a8999bbf38cae233e39b5995118fa03bca7894ef.tar.zst re3-a8999bbf38cae233e39b5995118fa03bca7894ef.zip |
Diffstat (limited to 'src/render/Renderer.cpp')
-rw-r--r-- | src/render/Renderer.cpp | 88 |
1 files changed, 50 insertions, 38 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 03ef1064..3b996b55 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -21,6 +21,7 @@ #include "PointLights.h" #include "Occlusion.h" #include "Renderer.h" +#include "custompipes.h" //--MIAMI: file done @@ -243,6 +244,11 @@ CRenderer::RenderEverythingBarRoads(void) if(IsRoad(e)) continue; +#ifdef EXTENDED_PIPELINES + if(CustomPipes::bRenderingEnvMap && (e->IsPed() || e->IsVehicle())) + continue; +#endif + if(e->IsVehicle() || e->IsPed() && CVisibilityPlugins::GetClumpAlpha((RpClump*)e->m_rwObject) != 255){ if(e->IsVehicle() && PutIntoSortedVehicleList((CVehicle*)e)){ @@ -883,6 +889,12 @@ CalcNewDelta(RwV2d *a, RwV2d *b) return (b->x - a->x) / (b->y - a->y); } +#ifdef FIX_BUGS +#define TOINT(x) ((int)Floor(x)) +#else +#define TOINT(x) ((int)(x)) +#endif + void CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrList *)) { @@ -908,8 +920,8 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL a2 = i; } } - y = miny; - yend = maxy; + y = TOINT(miny); + yend = TOINT(maxy); // Go left in poly to find first edge b b2 = a2; @@ -917,8 +929,8 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL b1 = b2--; if(b2 < 0) b2 = numVertices-1; if(poly[b1].x < xstart) - xstart = poly[b1].x; - if((int)poly[b1].y != (int)poly[b2].y) + xstart = TOINT(poly[b1].x); + if(TOINT(poly[b1].y) != TOINT(poly[b2].y)) break; } // Go right to find first edge a @@ -926,8 +938,8 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL a1 = a2++; if(a2 == numVertices) a2 = 0; if(poly[a1].x > xend) - xend = poly[a1].x; - if((int)poly[a1].y != (int)poly[a2].y) + xend = TOINT(poly[a1].x); + if(TOINT(poly[a1].y) != TOINT(poly[a2].y)) break; } @@ -938,17 +950,17 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x; if(y != yend){ - if(deltaB < 0.0f && (int)xB < xstart) - xstart = xB; - if(deltaA >= 0.0f && (int)xA > xend) - xend = xA; + if(deltaB < 0.0f && TOINT(xB) < xstart) + xstart = TOINT(xB); + if(deltaA >= 0.0f && TOINT(xA) > xend) + xend = TOINT(xA); } while(y <= yend && y < NUMSECTORS_Y){ // scan one x-line if(y >= 0 && xstart < NUMSECTORS_X) - for(x = xstart; x <= xend; x++) - if(x >= 0 && x != NUMSECTORS_X) + for(x = xstart; x <= xend && x != NUMSECTORS_X; x++) + if(x >= 0) scanfunc(CWorld::GetSector(x, y)->m_lists); // advance one scan line @@ -957,74 +969,74 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL xB += deltaB; // update left side - if(y == (int)poly[b2].y){ + if(y == TOINT(poly[b2].y)){ // reached end of edge if(y == yend){ if(deltaB < 0.0f){ do{ - xstart = poly[b2--].x; + xstart = TOINT(poly[b2--].x); if(b2 < 0) b2 = numVertices-1; - }while(xstart > (int)poly[b2].x); + }while(xstart > TOINT(poly[b2].x)); }else - xstart = xB - deltaB; + xstart = TOINT(xB - deltaB); }else{ // switch edges if(deltaB < 0.0f) - xstart = poly[b2].x; + xstart = TOINT(poly[b2].x); else - xstart = xB - deltaB; + xstart = TOINT(xB - deltaB); do{ b1 = b2--; if(b2 < 0) b2 = numVertices-1; - if((int)poly[b1].x < xstart) - xstart = poly[b1].x; - }while(y == (int)poly[b2].y); + if(TOINT(poly[b1].x) < xstart) + xstart = TOINT(poly[b1].x); + }while(y == TOINT(poly[b2].y)); deltaB = CalcNewDelta(&poly[b1], &poly[b2]); xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x; - if(deltaB < 0.0f && (int)xB < xstart) - xstart = xB; + if(deltaB < 0.0f && TOINT(xB) < xstart) + xstart = TOINT(xB); } }else{ if(deltaB < 0.0f) - xstart = xB; + xstart = TOINT(xB); else - xstart = xB - deltaB; + xstart = TOINT(xB - deltaB); } // update right side - if(y == (int)poly[a2].y){ + if(y == TOINT(poly[a2].y)){ // reached end of edge if(y == yend){ if(deltaA < 0.0f) - xend = xA - deltaA; + xend = TOINT(xA - deltaA); else{ do{ - xend = poly[a2++].x; + xend = TOINT(poly[a2++].x); if(a2 == numVertices) a2 = 0; - }while(xend < (int)poly[a2].x); + }while(xend < TOINT(poly[a2].x)); } }else{ // switch edges if(deltaA < 0.0f) - xend = xA - deltaA; + xend = TOINT(xA - deltaA); else - xend = poly[a2].x; + xend = TOINT(poly[a2].x); do{ a1 = a2++; if(a2 == numVertices) a2 = 0; - if((int)poly[a1].x > xend) - xend = poly[a1].x; - }while(y == (int)poly[a2].y); + if(TOINT(poly[a1].x) > xend) + xend = TOINT(poly[a1].x); + }while(y == TOINT(poly[a2].y)); deltaA = CalcNewDelta(&poly[a1], &poly[a2]); xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x; - if(deltaA >= 0.0f && (int)xA > xend) - xend = xA; + if(deltaA >= 0.0f && TOINT(xA) > xend) + xend = TOINT(xA); } }else{ if(deltaA < 0.0f) - xend = xA - deltaA; + xend = TOINT(xA - deltaA); else - xend = xA; + xend = TOINT(xA); } } } |