SOB render list working (finally!)

This commit is contained in:
lawnjelly 2019-09-25 16:45:09 +01:00 committed by GitHub
parent 15ab53250d
commit 7dd45301fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 13 deletions

View File

@ -191,19 +191,19 @@ void LRoom::FinalizeVisibility(LRoomManager &manager)
{ {
//print_line("FinalizeVisibility room " + get_name() + " NumSOBs " + itos(m_SOBs.size()) + ", NumDOBs " + itos(m_DOBs.size())); //print_line("FinalizeVisibility room " + get_name() + " NumSOBs " + itos(m_SOBs.size()) + ", NumDOBs " + itos(m_DOBs.size()));
int last_sob = m_iFirstSOB + m_iNumSOBs; // int last_sob = m_iFirstSOB + m_iNumSOBs;
for (int n=m_iFirstSOB; n<last_sob; n++) // for (int n=m_iFirstSOB; n<last_sob; n++)
{ // {
const LSob &sob = manager.m_SOBs[n]; // const LSob &sob = manager.m_SOBs[n];
VisualInstance * pVI = sob.GetVI(); // VisualInstance * pVI = sob.GetVI();
if (pVI) // if (pVI)
{ // {
//SoftShow(pVI, sob.m_bSOBVisible); // //SoftShow(pVI, sob.m_bSOBVisible);
bool bVisible = manager.m_BF_visible_SOBs.GetBit(n) != 0; // bool bVisible = manager.m_BF_visible_SOBs.GetBit(n) != 0;
SoftShow(pVI, bVisible); // SoftShow(pVI, bVisible);
} // }
} // }
for (int n=0; n<m_DOBs.size(); n++) for (int n=0; n<m_DOBs.size(); n++)
{ {

View File

@ -124,12 +124,12 @@ public:
Geometry::MeshData m_Bound_MeshData; Geometry::MeshData m_Bound_MeshData;
bool IsVisible() const {return m_bVisible;} bool IsVisible() const {return m_bVisible;}
private:
// instead of directly showing and hiding objects we now set their layer, // instead of directly showing and hiding objects we now set their layer,
// and the camera will hide them with a cull mask. This is so that // and the camera will hide them with a cull mask. This is so that
// objects can still be rendered outside immediate view for casting shadows. // objects can still be rendered outside immediate view for casting shadows.
static void SoftShow(VisualInstance * pVI, bool bShow); static void SoftShow(VisualInstance * pVI, bool bShow);
private:
// whether lportal thinks this room is currently visible // whether lportal thinks this room is currently visible
// this allows us to show / hide dobs as they cross room boundaries // this allows us to show / hide dobs as they cross room boundaries
bool m_bVisible; bool m_bVisible;

View File

@ -700,6 +700,8 @@ void LRoomManager::FrameUpdate()
FrameUpdate_AddShadowCasters(); FrameUpdate_AddShadowCasters();
FrameUpdate_FinalizeVisibility_SoftShow();
// swap the current and previous visible room list // swap the current and previous visible room list
LVector<int> * pTemp = m_pCurr_VisibleRoomList; LVector<int> * pTemp = m_pCurr_VisibleRoomList;
m_pCurr_VisibleRoomList = m_pPrev_VisibleRoomList; m_pCurr_VisibleRoomList = m_pPrev_VisibleRoomList;
@ -754,6 +756,28 @@ void LRoomManager::FrameUpdate_AddShadowCasters()
} }
void LRoomManager::FrameUpdate_FinalizeVisibility_SoftShow()
{
// apply the appropriate soft show for each sob in the render list
int nSOBs = m_RenderList_SOBs.size();
for (int n=0; n<nSOBs; n++)
{
int ID = m_RenderList_SOBs[n];
const LSob &sob = m_SOBs[ID];
VisualInstance * pVI = sob.GetVI();
if (pVI)
{
//SoftShow(pVI, sob.m_bSOBVisible);
bool bVisible = m_BF_visible_SOBs.GetBit(ID) != 0;
LRoom::SoftShow(pVI, bVisible);
}
}
}
void LRoomManager::FrameUpdate_FinalizeVisibility_WithinRooms() void LRoomManager::FrameUpdate_FinalizeVisibility_WithinRooms()
{ {
// and hide all the dobs that are in visible rooms that haven't been made visible // and hide all the dobs that are in visible rooms that haven't been made visible

View File

@ -99,6 +99,7 @@ private:
void FrameUpdate_FinalizeRooms(); void FrameUpdate_FinalizeRooms();
void FrameUpdate_AddShadowCasters(); void FrameUpdate_AddShadowCasters();
void FrameUpdate_FinalizeVisibility_WithinRooms(); void FrameUpdate_FinalizeVisibility_WithinRooms();
void FrameUpdate_FinalizeVisibility_SoftShow();
// debugging emulate view frustum // debugging emulate view frustum
void FrameUpdate_FrustumOnly(); void FrameUpdate_FrustumOnly();