more fixes to new renderer

This commit is contained in:
aap 2020-11-04 23:11:27 +01:00
parent 0662de5323
commit 67c894cda9
3 changed files with 27 additions and 19 deletions

View File

@ -876,7 +876,6 @@ MattRenderScene(void)
// CMattRenderer::ResetRenderStates // CMattRenderer::ResetRenderStates
CRenderer::ClearForFrame(); CRenderer::ClearForFrame();
// CClock::CalcEnvMapTimeMultiplicator // CClock::CalcEnvMapTimeMultiplicator
//if(gbRenderWater)
CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater
// CClock::ms_EnvMapTimeMultiplicator = 1.0f; // CClock::ms_EnvMapTimeMultiplicator = 1.0f;
// cWorldStream::ClearDynamics // cWorldStream::ClearDynamics
@ -919,11 +918,13 @@ RenderScene_new(void)
} }
// TODO // TODO
bool FredIsInFirstPersonCam(void) { return false; } bool FredIsInFirstPersonCam(void) { return true; } // this seems to give the best result in all cases
void void
RenderEffects_new(void) RenderEffects_new(void)
{ {
CRenderer::RenderPeds();
CShadows::RenderStaticShadows(); CShadows::RenderStaticShadows();
// CRenderer::GenerateEnvironmentMap // CRenderer::GenerateEnvironmentMap
CShadows::RenderStoredShadows(); CShadows::RenderStoredShadows();
@ -938,10 +939,10 @@ RenderEffects_new(void)
if(gbRenderWorld2) if(gbRenderWorld2)
CRenderer::RenderWorld(2); // transparent CRenderer::RenderWorld(2); // transparent
if(gbRenderVehicles) if(gbRenderVehicles)
CRenderer::RenderVehiclesAndPeds(); CRenderer::RenderVehicles();
}else{ }else{
if(gbRenderVehicles) if(gbRenderVehicles)
CRenderer::RenderVehiclesAndPeds(); CRenderer::RenderVehicles();
if(gbRenderWorld2) if(gbRenderWorld2)
CRenderer::RenderWorld(2); // transparent CRenderer::RenderWorld(2); // transparent
} }

View File

@ -814,36 +814,42 @@ CRenderer::RenderWorld(int pass)
} }
void 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; int i;
CEntity *e; CEntity *e;
EntityInfo ei; EntityInfo ei;
CLink<EntityInfo> *node; CLink<EntityInfo> *node;
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
//CVisibilityPlugins::InitAlphaEntityList(); // not safe yet
// not the real thing // not the real thing
for(i = 0; i < ms_nNoOfVisibleVehicles; i++){ for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
e = ms_aVisibleVehiclePtrs[i]; e = ms_aVisibleVehiclePtrs[i];
if(e->IsVehicle() && PutIntoSortedVehicleList((CVehicle*)e)) if(!e->IsVehicle())
continue;
if(PutIntoSortedVehicleList((CVehicle*)e))
continue; // boats handled elsewhere continue; // boats handled elsewhere
if(e->IsPed())
RenderOneNonRoad(e);
else{
ei.ent = e; ei.ent = e;
ei.sort = (ms_vecCameraPosition - e->GetPosition()).MagnitudeSqr(); ei.sort = (ms_vecCameraPosition - e->GetPosition()).MagnitudeSqr();
gSortedVehiclesAndPeds.InsertSorted(ei); gSortedVehiclesAndPeds.InsertSorted(ei);
} }
}
for(node = gSortedVehiclesAndPeds.tail.prev; for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head; node != &gSortedVehiclesAndPeds.head;
node = node->prev) node = node->prev)
RenderOneNonRoad(node->item.ent); RenderOneNonRoad(node->item.ent);
// RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
} }
void void

View File

@ -74,7 +74,8 @@ public:
#ifdef NEW_RENDERER #ifdef NEW_RENDERER
static void ClearForFrame(void); 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 RenderOneBuilding(CEntity *ent, float camdist = 0.0f);
static void RenderWorld(int pass); // like cWorldStream::Render(int) static void RenderWorld(int pass); // like cWorldStream::Render(int)
static void RenderTransparentWater(void); // keep-out polys and transparent water static void RenderTransparentWater(void); // keep-out polys and transparent water