Add files via upload

This commit is contained in:
lawnjelly 2019-09-24 18:33:55 +01:00 committed by GitHub
parent 077c9ac13b
commit eca14bea42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 8 deletions

View File

@ -33,6 +33,9 @@ LRoom::LRoom() {
m_iFirstPortal = 0;
m_iNumPortals = 0;
m_bVisible = true;
m_iFirstSOB = 0;
m_iNumSOBs = 0;
}
@ -169,9 +172,10 @@ void LRoom::FinalizeVisibility(LRoomManager &manager)
{
//print_line("FinalizeVisibility room " + get_name() + " NumSOBs " + itos(m_SOBs.size()) + ", NumDOBs " + itos(m_DOBs.size()));
for (int n=0; n<m_SOBs.size(); n++)
int last_sob = m_iFirstSOB + m_iNumSOBs;
for (int n=m_iFirstSOB; n<last_sob; n++)
{
const LSob &sob = m_SOBs[n];
const LSob &sob = manager.m_SOBs[n];
VisualInstance * pVI = sob.GetVI();
if (pVI)
@ -299,8 +303,14 @@ void LRoom::FirstTouch(LRoomManager &manager)
manager.m_pCurr_VisibleRoomList->push_back(m_RoomID);
// hide all objects
for (int n=0; n<m_SOBs.size(); n++)
m_SOBs[n].m_bVisible = false;
int last_sob = m_iFirstSOB + m_iNumSOBs;
for (int n=m_iFirstSOB; n<last_sob; n++)
{
LSob &sob = manager.m_SOBs[n];
sob.m_bVisible = false;
}
// for (int n=0; n<m_SOBs.size(); n++)
// m_SOBs[n].m_bVisible = false;
// hide all dobs
for (int n=0; n<m_DOBs.size(); n++)
@ -335,9 +345,13 @@ void LRoom::DetermineVisibility_Recursive(LRoomManager &manager, int depth, cons
#ifdef LPORTAL_CULL_STATIC
// clip all objects in this room to the clipping planes
for (int n=0; n<m_SOBs.size(); n++)
int last_sob = m_iFirstSOB + m_iNumSOBs;
for (int n=m_iFirstSOB; n<last_sob; n++)
{
LSob &sob = m_SOBs[n];
LSob &sob = manager.m_SOBs[n];
// for (int n=0; n<m_SOBs.size(); n++)
// {
// LSob &sob = m_SOBs[n];
// already determined to be visible through another portal
if (sob.m_bVisible)

View File

@ -57,8 +57,12 @@ public:
static const int SOFT_SHOW_BIT = 18;
static const int SOFT_HIDE_BIT = 19;
// static objects are stored in the manager in a contiguous list
int m_iFirstSOB;
int m_iNumSOBs;
// static objects
LVector<LSob> m_SOBs;
//LVector<LSob> m_SOBs;
// dynamic objects
LVector<LDob> m_DOBs;

View File

@ -41,6 +41,8 @@ void LRoomConverter::Convert(LRoomManager &manager)
LMAN = &manager;
int count = CountRooms();
LMAN->m_SOBs.clear();
// make sure bitfield is right size for number of rooms
LMAN->m_BF_visible_rooms.Create(count);
@ -129,7 +131,8 @@ void LRoomConverter::Convert_Room_FindObjects_Recursive(Node * pParent, LRoom &l
sob.m_ID = pVI->get_instance_id();
sob.m_aabb = bb;
lroom.m_SOBs.push_back(sob);
//lroom.m_SOBs.push_back(sob);
LRoom_PushBackSOB(lroom, sob);
}
else
{
@ -409,6 +412,17 @@ void LRoomConverter::LRoom_DetectPortalMeshes(LRoom &lroom, LTempRoom &troom)
}
void LRoomConverter::LRoom_PushBackSOB(LRoom &lroom, const LSob &sob)
{
// first added for this room?
if (lroom.m_iNumSOBs == 0)
lroom.m_iFirstSOB = LMAN->m_SOBs.size();
LMAN->m_SOBs.push_back(sob);
lroom.m_iNumSOBs++;
}
// handles the slight faff involved in getting a new portal in the manager contiguous list of portals
LPortal * LRoomConverter::LRoom_RequestNewPortal(LRoom &lroom)
{

View File

@ -100,6 +100,7 @@ private:
void LRoom_MakePortalFinalList(LRoom &lroom, LTempRoom &troom);
void LRoom_DetectedPortalMesh(LRoom &lroom, LTempRoom &troom, MeshInstance * pMeshInstance, String szLinkRoom);
LPortal * LRoom_RequestNewPortal(LRoom &lroom);
void LRoom_PushBackSOB(LRoom &lroom, const LSob &sob);
void TRoom_MakeOppositePortal(const LPortal &port, int iRoomOrig);

View File

@ -159,6 +159,9 @@ private:
LVector<LRoom> m_Rooms;
LVector<LPortal> m_Portals;
// static objects
LVector<LSob> m_SOBs;
public:
// whether debug planes is switched on
bool m_bDebugPlanes;