summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-11-04 23:11:27 +0100
committeraap <aap@papnet.eu>2020-11-04 23:11:27 +0100
commit67c894cda9b1415b73a5fafd155c149d53681ad1 (patch)
treed8bf73ef588dacabbb2d786d4201ac1d59dd4cb6
parentfixed vehicle and ped sorting for new renderer (diff)
downloadre3-67c894cda9b1415b73a5fafd155c149d53681ad1.tar
re3-67c894cda9b1415b73a5fafd155c149d53681ad1.tar.gz
re3-67c894cda9b1415b73a5fafd155c149d53681ad1.tar.bz2
re3-67c894cda9b1415b73a5fafd155c149d53681ad1.tar.lz
re3-67c894cda9b1415b73a5fafd155c149d53681ad1.tar.xz
re3-67c894cda9b1415b73a5fafd155c149d53681ad1.tar.zst
re3-67c894cda9b1415b73a5fafd155c149d53681ad1.zip
-rw-r--r--src/core/main.cpp9
-rw-r--r--src/render/Renderer.cpp34
-rw-r--r--src/render/Renderer.h3
3 files changed, 27 insertions, 19 deletions
diff --git a/src/core/main.cpp b/src/core/main.cpp
index a057e55b..92e939ad 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -876,7 +876,6 @@ MattRenderScene(void)
// CMattRenderer::ResetRenderStates
CRenderer::ClearForFrame();
// CClock::CalcEnvMapTimeMultiplicator
-//if(gbRenderWater)
CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater
// CClock::ms_EnvMapTimeMultiplicator = 1.0f;
// cWorldStream::ClearDynamics
@@ -919,11 +918,13 @@ RenderScene_new(void)
}
// TODO
-bool FredIsInFirstPersonCam(void) { return false; }
+bool FredIsInFirstPersonCam(void) { return true; } // this seems to give the best result in all cases
void
RenderEffects_new(void)
{
+ CRenderer::RenderPeds();
+
CShadows::RenderStaticShadows();
// CRenderer::GenerateEnvironmentMap
CShadows::RenderStoredShadows();
@@ -938,10 +939,10 @@ RenderEffects_new(void)
if(gbRenderWorld2)
CRenderer::RenderWorld(2); // transparent
if(gbRenderVehicles)
- CRenderer::RenderVehiclesAndPeds();
+ CRenderer::RenderVehicles();
}else{
if(gbRenderVehicles)
- CRenderer::RenderVehiclesAndPeds();
+ CRenderer::RenderVehicles();
if(gbRenderWorld2)
CRenderer::RenderWorld(2); // transparent
}
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 58311574..c2982d6d 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -814,36 +814,42 @@ CRenderer::RenderWorld(int pass)
}
void
-CRenderer::RenderVehiclesAndPeds(void)
+CRenderer::RenderPeds(void)
+{
+ int i;
+ CEntity *e;
+
+ for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
+ e = ms_aVisibleVehiclePtrs[i];
+ if(e->IsPed())
+ RenderOneNonRoad(e);
+ }
+}
+
+void
+CRenderer::RenderVehicles(void)
{
int i;
CEntity *e;
EntityInfo ei;
CLink<EntityInfo> *node;
- RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
- //CVisibilityPlugins::InitAlphaEntityList(); // not safe yet
-
// not the real thing
for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
e = ms_aVisibleVehiclePtrs[i];
- if(e->IsVehicle() && PutIntoSortedVehicleList((CVehicle*)e))
+ if(!e->IsVehicle())
+ continue;
+ if(PutIntoSortedVehicleList((CVehicle*)e))
continue; // boats handled elsewhere
- if(e->IsPed())
- RenderOneNonRoad(e);
- else{
- ei.ent = e;
- ei.sort = (ms_vecCameraPosition - e->GetPosition()).MagnitudeSqr();
- gSortedVehiclesAndPeds.InsertSorted(ei);
- }
+ ei.ent = e;
+ ei.sort = (ms_vecCameraPosition - e->GetPosition()).MagnitudeSqr();
+ gSortedVehiclesAndPeds.InsertSorted(ei);
}
for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head;
node = node->prev)
RenderOneNonRoad(node->item.ent);
-
-// RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
}
void
diff --git a/src/render/Renderer.h b/src/render/Renderer.h
index ec9d9023..b579bb4c 100644
--- a/src/render/Renderer.h
+++ b/src/render/Renderer.h
@@ -74,7 +74,8 @@ public:
#ifdef NEW_RENDERER
static void ClearForFrame(void);
- static void RenderVehiclesAndPeds(void); // just called RenderVehicles in LCS
+ static void RenderPeds(void);
+ static void RenderVehicles(void); // also renders peds in LCS
static void RenderOneBuilding(CEntity *ent, float camdist = 0.0f);
static void RenderWorld(int pass); // like cWorldStream::Render(int)
static void RenderTransparentWater(void); // keep-out polys and transparent water