Skip to content

Commit

Permalink
Update refresh indirect lighting data
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamhong committed Aug 16, 2024
1 parent 86e2cb4 commit d5e7741
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,26 @@ namespace Skylicht

void CIndirectLighting::addLightingData(CEntity* entity)
{
// add indirect data info
CIndirectLightingData* data = entity->addData<CIndirectLightingData>();
CIndirectLightingData* data = entity->getData<CIndirectLightingData>();
if (data == NULL)
{
// add indirect data info
data = entity->addData<CIndirectLightingData>();
}

data->Type = (CIndirectLightingData::EType)m_type;
data->SH = m_sh;
data->AutoSH = &m_autoSH;

m_data.push_back(data);
if (std::find(m_data.begin(), m_data.end(), data) == m_data.end())
m_data.push_back(data);
}

void CIndirectLighting::removeAllData()
{
for (CIndirectLightingData* d : m_data)
d->Entity->removeData<CIndirectLightingData>();
m_data.clear();
}

void CIndirectLighting::updateComponent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ namespace Skylicht
}

bool isLightmapEmpty();

bool isLightmapChanged(const std::vector<std::string>& paths);

void removeAllData();

DECLARE_GETTYPENAME(CIndirectLighting)
};
}

0 comments on commit d5e7741

Please sign in to comment.