This commit is contained in:
CodingJellyfish 2024-04-17 20:09:18 +08:00 committed by GitHub
parent a6cecd2279
commit 6be521fc96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 20 deletions

View File

@ -151,6 +151,7 @@ void DrawCalls::parseSceneManager(core::array<scene::ISceneNode*> &List,
if (List[i]->getType() == ESNT_LOD_NODE) if (List[i]->getType() == ESNT_LOD_NODE)
{ {
LODNode *node = static_cast<LODNode *>(List[i]); LODNode *node = static_cast<LODNode *>(List[i]);
node->updateVisibility();
core::array<scene::ISceneNode*> child; core::array<scene::ISceneNode*> child;
if (node->getLevel() >= 0) if (node->getLevel() >= 0)

View File

@ -110,33 +110,16 @@ void LODNode::forceLevelOfDetail(int n)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void LODNode::OnAnimate(u32 timeMs) void LODNode::OnAnimate(u32 timeMs)
{ {
updateVisibility();
if (isVisible() && m_nodes.size() > 0) if (isVisible() && m_nodes.size() > 0)
{ {
// update absolute position // update absolute position
updateAbsolutePosition(); updateAbsolutePosition();
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
for (size_t i = 0; i < m_nodes.size(); i++) for (size_t i = 0; i < m_nodes.size(); i++)
{ {
m_nodes[i]->setVisible(true); m_nodes[i]->setVisible(true);
m_nodes[i]->OnAnimate(timeMs); m_nodes[i]->OnAnimate(timeMs);
} }
}
else
#endif
{
int level = getLevel();
// Assume all the scene node have the same bouding box
if(level >= 0)
{
m_nodes[level]->setVisible(true);
m_nodes[level]->OnAnimate(timeMs);
}
}
if (m_update_box_every_frame) if (m_update_box_every_frame)
Box = m_nodes[m_detail.size() - 1]->getBoundingBox(); Box = m_nodes[m_detail.size() - 1]->getBoundingBox();
@ -173,6 +156,8 @@ void LODNode::updateVisibility()
void LODNode::OnRegisterSceneNode() void LODNode::OnRegisterSceneNode()
{ {
updateVisibility();
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
if (CVS->isGLSL()) if (CVS->isGLSL())
{ {