new LCS-style renderer

This commit is contained in:
aap
2020-11-03 20:33:07 +01:00
parent 8acc98563e
commit 3c5bb4e8f3
10 changed files with 749 additions and 16 deletions

View File

@ -1,6 +1,7 @@
#include "common.h"
#include "templates.h"
#include "main.h"
#include "Entity.h"
#include "ModelInfo.h"
#include "Lights.h"
@ -19,6 +20,9 @@ CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaList;
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaBoatAtomicList;
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaEntityList;
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaUnderwaterEntityList;
#ifdef NEW_RENDERER
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaBuildingList;
#endif
int32 CVisibilityPlugins::ms_atomicPluginOffset = -1;
int32 CVisibilityPlugins::ms_framePluginOffset = -1;
@ -59,6 +63,11 @@ CVisibilityPlugins::Initialise(void)
m_alphaUnderwaterEntityList.head.item.sort = 0.0f;
m_alphaUnderwaterEntityList.tail.item.sort = 100000000.0f;
#ifdef NEW_RENDERER
m_alphaBuildingList.Init(NUMALPHAENTITYLIST);
m_alphaBuildingList.head.item.sort = 0.0f;
m_alphaBuildingList.tail.item.sort = 100000000.0f;
#endif
}
void
@ -68,6 +77,9 @@ CVisibilityPlugins::Shutdown(void)
m_alphaBoatAtomicList.Shutdown();
m_alphaEntityList.Shutdown();
m_alphaUnderwaterEntityList.Shutdown();
#ifdef NEW_RENDERER
m_alphaBuildingList.Shutdown();
#endif
}
void
@ -76,6 +88,9 @@ CVisibilityPlugins::InitAlphaEntityList(void)
m_alphaEntityList.Clear();
m_alphaBoatAtomicList.Clear();
m_alphaUnderwaterEntityList.Clear();
#ifdef NEW_RENDERER
m_alphaBuildingList.Clear();
#endif
}
bool
@ -84,6 +99,10 @@ CVisibilityPlugins::InsertEntityIntoSortedList(CEntity *e, float dist)
AlphaObjectInfo item;
item.entity = e;
item.sort = dist;
#ifdef NEW_RENDERER
if(gbNewRenderer && e->IsBuilding())
return !!m_alphaBuildingList.InsertSorted(item);
#endif
if(e->bUnderwater && m_alphaUnderwaterEntityList.InsertSorted(item))
return true;
return !!m_alphaEntityList.InsertSorted(item);
@ -308,7 +327,7 @@ CVisibilityPlugins::RenderFadingAtomic(RpAtomic *atomic, float camdist)
mi = GetAtomicModelInfo(atomic);
lodatm = mi->GetAtomicFromDistance(camdist - FADE_DISTANCE);
if(mi->m_additive)
AtomicDefaultRenderCallBack(atomic);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
fadefactor = (mi->GetLargestLodDistance() - (camdist - FADE_DISTANCE))/FADE_DISTANCE;
if(fadefactor > 1.0f)

View File

@ -24,6 +24,9 @@ public:
static CLinkList<AlphaObjectInfo> m_alphaBoatAtomicList;
static CLinkList<AlphaObjectInfo> m_alphaEntityList;
static CLinkList<AlphaObjectInfo> m_alphaUnderwaterEntityList;
#ifdef NEW_RENDERER
static CLinkList<AlphaObjectInfo> m_alphaBuildingList;
#endif
static RwCamera *ms_pCamera;
static RwV3d *ms_pCameraPosn;
static float ms_cullCompsDist;