|
|
@ -85,21 +85,21 @@ void plPageTreeMgr::AddNode(plSceneNode* node) |
|
|
|
|
|
|
|
|
|
|
|
node->Init(); |
|
|
|
node->Init(); |
|
|
|
|
|
|
|
|
|
|
|
fNodes.Append(node); |
|
|
|
fNodes.push_back(node); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plPageTreeMgr::RemoveNode(plSceneNode* node) |
|
|
|
void plPageTreeMgr::RemoveNode(plSceneNode* node) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ITrashSpaceTree(); |
|
|
|
ITrashSpaceTree(); |
|
|
|
|
|
|
|
|
|
|
|
int idx = fNodes.Find(node); |
|
|
|
auto it = std::find(fNodes.begin(), fNodes.end(), node); |
|
|
|
if( idx != fNodes.kMissingIndex ) |
|
|
|
if (it != fNodes.end()) |
|
|
|
fNodes.Remove(idx); |
|
|
|
fNodes.erase(it); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plPageTreeMgr::Reset() |
|
|
|
void plPageTreeMgr::Reset() |
|
|
|
{ |
|
|
|
{ |
|
|
|
fNodes.Reset(); |
|
|
|
fNodes.clear(); |
|
|
|
|
|
|
|
|
|
|
|
ITrashSpaceTree(); |
|
|
|
ITrashSpaceTree(); |
|
|
|
} |
|
|
|
} |
|
|
@ -474,16 +474,13 @@ bool plPageTreeMgr::IRenderSortingSpans(plPipeline* pipe, hsTArray<plDrawVisList |
|
|
|
|
|
|
|
|
|
|
|
bool plPageTreeMgr::IBuildSpaceTree() |
|
|
|
bool plPageTreeMgr::IBuildSpaceTree() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( !fNodes.GetCount() ) |
|
|
|
if (fNodes.empty()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
plSpaceTreeMaker maker; |
|
|
|
plSpaceTreeMaker maker; |
|
|
|
maker.Reset(); |
|
|
|
maker.Reset(); |
|
|
|
int i; |
|
|
|
for (plSceneNode* node : fNodes) |
|
|
|
for( i = 0; i < fNodes.GetCount(); i++ ) |
|
|
|
maker.AddLeaf(node->GetSpaceTree()->GetWorldBounds(), node->GetSpaceTree()->IsEmpty()); |
|
|
|
{ |
|
|
|
|
|
|
|
maker.AddLeaf(fNodes[i]->GetSpaceTree()->GetWorldBounds(), fNodes[i]->GetSpaceTree()->IsEmpty()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fSpaceTree = maker.MakeTree(); |
|
|
|
fSpaceTree = maker.MakeTree(); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -491,18 +488,17 @@ bool plPageTreeMgr::IBuildSpaceTree() |
|
|
|
|
|
|
|
|
|
|
|
bool plPageTreeMgr::IRefreshTree(plPipeline* pipe) |
|
|
|
bool plPageTreeMgr::IRefreshTree(plPipeline* pipe) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
for (size_t i = 0; i < fNodes.size(); ++i) |
|
|
|
for( i = 0; i < fNodes.GetCount(); i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if( fNodes[i]->GetSpaceTree()->IsDirty() ) |
|
|
|
plSceneNode* node = fNodes[i]; |
|
|
|
|
|
|
|
if (node->GetSpaceTree()->IsDirty()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fNodes[i]->GetSpaceTree()->Refresh(); |
|
|
|
node->GetSpaceTree()->Refresh(); |
|
|
|
|
|
|
|
|
|
|
|
GetSpaceTree()->MoveLeaf(i, fNodes[i]->GetSpaceTree()->GetWorldBounds()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !fNodes[i]->GetSpaceTree()->IsEmpty() && fSpaceTree->HasLeafFlag(i, plSpaceTreeNode::kDisabled) ) |
|
|
|
GetSpaceTree()->MoveLeaf(i, node->GetSpaceTree()->GetWorldBounds()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!node->GetSpaceTree()->IsEmpty() && fSpaceTree->HasLeafFlag(i, plSpaceTreeNode::kDisabled) ) |
|
|
|
fSpaceTree->SetLeafFlag(i, plSpaceTreeNode::kDisabled, false); |
|
|
|
fSpaceTree->SetLeafFlag(i, plSpaceTreeNode::kDisabled, false); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -679,11 +675,8 @@ bool plPageTreeMgr::IGetOcclusion(plPipeline* pipe, hsTArray<int16_t>& list) |
|
|
|
|
|
|
|
|
|
|
|
fCullPolys.SetCount(0); |
|
|
|
fCullPolys.SetCount(0); |
|
|
|
fOccluders.SetCount(0); |
|
|
|
fOccluders.SetCount(0); |
|
|
|
int i; |
|
|
|
for (plSceneNode* node : fNodes) |
|
|
|
for( i = 0; i < fNodes.GetCount(); i++ ) |
|
|
|
node->SubmitOccluders(this); |
|
|
|
{ |
|
|
|
|
|
|
|
fNodes[i]->SubmitOccluders(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !IGetCullPolys(pipe) ) |
|
|
|
if( !IGetCullPolys(pipe) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|