summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp149
-rw-r--r--src/core/main.h5
-rw-r--r--src/core/re3.cpp24
4 files changed, 174 insertions, 5 deletions
diff --git a/src/core/config.h b/src/core/config.h
index 6e0a17f7..822cf83f 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -246,6 +246,7 @@ enum Config {
#ifdef LIBRW
//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
+//#define NEW_RENDERER // leeds-like world rendering, needs librw
#endif
//#define MULTISAMPLING // adds MSAA option TODO
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 64b3a63f..6560cbda 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -107,6 +107,13 @@ void TheGame(void);
void DebugMenuPopulate(void);
#endif
+#ifdef NEW_RENDERER
+bool gbNewRenderer;
+#define CLEARMODE (rwCAMERACLEARZ | rwCAMERACLEARSTENCIL)
+#else
+#define CLEARMODE (rwCAMERACLEARZ)
+#endif
+
void
ValidateVersion()
{
@@ -151,7 +158,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
+ RwCameraClear(Scene.camera, &TopColor.rwRGBA, CLEARMODE);
if(!RsCameraBeginUpdate(Scene.camera))
return false;
@@ -170,7 +177,7 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
if(!RsCameraBeginUpdate(Scene.camera))
return false;
@@ -849,9 +856,130 @@ DisplayGameDebugText()
}
#endif
+#ifdef NEW_RENDERER
+bool gbRenderRoads = true;
+bool gbRenderEverythingBarRoads = true;
+bool gbRenderFadingInUnderwaterEntities = true;
+bool gbRenderFadingInEntities = true;
+bool gbRenderWater = true;
+bool gbRenderBoats = true;
+bool gbRenderVehicles = true;
+bool gbRenderWorld0 = true;
+bool gbRenderWorld1 = true;
+bool gbRenderWorld2 = true;
+
+void
+MattRenderScene(void)
+{
+ // this calls CMattRenderer::Render
+ CWorld::AdvanceCurrentScanCode();
+ // CMattRenderer::ResetRenderStates
+ CRenderer::ClearForFrame();
+ // CClock::CalcEnvMapTimeMultiplicator
+ CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater
+ // CClock::ms_EnvMapTimeMultiplicator = 1.0f;
+ // cWorldStream::ClearDynamics
+ CRenderer::ConstructRenderList();
+if(gbRenderWorld0)
+ CRenderer::RenderWorld(0); // roads
+ // CMattRenderer::ResetRenderStates
+ CRenderer::PreRender();
+ CCoronas::RenderReflections();
+if(gbRenderWorld1)
+ CRenderer::RenderWorld(1); // opaque
+if(gbRenderRoads)
+ CRenderer::RenderRoads();
+
+ // not sure where to put these since LCS has no underwater entities
+if(gbRenderBoats)
+ CRenderer::RenderBoats();
+if(gbRenderFadingInUnderwaterEntities)
+ CRenderer::RenderFadingInUnderwaterEntities();
+if(gbRenderWater)
+ CRenderer::RenderTransparentWater();
+
+if(gbRenderEverythingBarRoads)
+ CRenderer::RenderEverythingBarRoads();
+ // get env map here?
+ // moved this:
+ // CRenderer::RenderFadingInEntities();
+}
+
+void
+RenderScene_new(void)
+{
+ CClouds::Render();
+ DoRWRenderHorizon();
+
+ MattRenderScene();
+ DefinedState();
+ // CMattRenderer::ResetRenderStates
+ // moved CRenderer::RenderBoats to before transparent water
+}
+
+// TODO
+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();
+ CSkidmarks::Render();
+ CRubbish::Render();
+
+ // these aren't really effects
+ DefinedState();
+ if(FredIsInFirstPersonCam()){
+ DefinedState();
+ C3dMarkers::Render(); // normally rendered in CSpecialFX::Render()
+if(gbRenderWorld2)
+ CRenderer::RenderWorld(2); // transparent
+if(gbRenderVehicles)
+ CRenderer::RenderVehicles();
+ }else{
+if(gbRenderVehicles)
+ CRenderer::RenderVehicles();
+if(gbRenderWorld2)
+ CRenderer::RenderWorld(2); // transparent
+ }
+ // better render these after transparent world
+if(gbRenderFadingInEntities)
+ CRenderer::RenderFadingInEntities();
+
+ // actual effects here
+ CGlass::Render();
+ // CMattRenderer::ResetRenderStates
+ DefinedState();
+ CCoronas::RenderSunReflection();
+ CWeather::RenderRainStreaks();
+ // CWeather::AddSnow
+ CWaterCannons::Render();
+ CAntennas::Render();
+ CSpecialFX::Render();
+ CRopes::Render();
+ CCoronas::Render();
+ CParticle::Render();
+ CPacManPickups::Render();
+ CWeaponEffects::Render();
+ CPointLights::RenderFogEffect();
+ CMovingThings::Render();
+ CRenderer::RenderFirstPersonVehicle();
+}
+#endif
+
void
RenderScene(void)
{
+#ifdef NEW_RENDERER
+ if(gbNewRenderer){
+ RenderScene_new();
+ return;
+ }
+#endif
CClouds::Render();
DoRWRenderHorizon();
CRenderer::RenderRoads();
@@ -885,6 +1013,12 @@ RenderDebugShit(void)
void
RenderEffects(void)
{
+#ifdef NEW_RENDERER
+ if(gbNewRenderer){
+ RenderEffects_new();
+ return;
+ }
+#endif
CGlass::Render();
CWaterCannons::Render();
CSpecialFX::Render();
@@ -1061,6 +1195,10 @@ Idle(void *arg)
pos.y = SCREEN_HEIGHT / 2.0f;
RsMouseSetPos(&pos);
#endif
+#ifdef NEW_RENDERER
+ if(!gbNewRenderer)
+#endif
+{
tbStartTimer(0, "CnstrRenderList");
#ifdef PC_WATER
CWaterLevel::PreCalcWaterGeometry();
@@ -1071,6 +1209,7 @@ Idle(void *arg)
tbStartTimer(0, "PreRender");
CRenderer::PreRender();
tbEndTimer("PreRender");
+}
#ifdef FIX_BUGS
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); // TODO: temp? this fixes OpenGL render but there should be a better place for this
@@ -1125,7 +1264,7 @@ Idle(void *arg)
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
if(!RsCameraBeginUpdate(Scene.camera))
return;
}
@@ -1174,7 +1313,7 @@ FrontendIdle(void)
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
if(!RsCameraBeginUpdate(Scene.camera))
return;
@@ -1450,7 +1589,7 @@ void TheGame(void)
{
CameraSize(Scene.camera, NULL, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
if (!RsCameraBeginUpdate(Scene.camera))
break;
}
diff --git a/src/core/main.h b/src/core/main.h
index 8bf06c30..f428224e 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -38,3 +38,8 @@ void ResetLoadingScreenBar(void);
#ifndef MASTER
void TheModelViewer(void);
#endif
+
+#ifdef NEW_RENDERER
+extern bool gbNewRenderer;
+bool FredIsInFirstPersonCam(void);
+#endif
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 318b1d47..ebfa8de5 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -422,6 +422,30 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
+#ifdef NEW_RENDERER
+ DebugMenuAddVarBool8("Render", "new renderer", &gbNewRenderer, nil);
+extern bool gbRenderRoads;
+extern bool gbRenderEverythingBarRoads;
+extern bool gbRenderFadingInUnderwaterEntities;
+extern bool gbRenderFadingInEntities;
+extern bool gbRenderWater;
+extern bool gbRenderBoats;
+extern bool gbRenderVehicles;
+extern bool gbRenderWorld0;
+extern bool gbRenderWorld1;
+extern bool gbRenderWorld2;
+ DebugMenuAddVarBool8("Render", "gbRenderRoads", &gbRenderRoads, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderEverythingBarRoads", &gbRenderEverythingBarRoads, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderFadingInUnderwaterEntities", &gbRenderFadingInUnderwaterEntities, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderFadingInEntities", &gbRenderFadingInEntities, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderWater", &gbRenderWater, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderBoats", &gbRenderBoats, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderVehicles", &gbRenderVehicles, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderWorld0", &gbRenderWorld0, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderWorld1", &gbRenderWorld1, nil);
+ DebugMenuAddVarBool8("Render", "gbRenderWorld2", &gbRenderWorld2, nil);
+#endif
+
#ifdef EXTENDED_COLOURFILTER
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);