Implement instancing for light objects #35

Merged
Bogdan Nagirniak merged 18 commits from BLEN-395 into hydra-render 2023-05-04 15:12:27 +02:00
Showing only changes of commit 7834da5971 - Show all commits

View File

@ -63,19 +63,12 @@ void InstancerData::update()
{ {
ID_LOG(2, ""); ID_LOG(2, "");
pxr::HdDirtyBits bits = pxr::HdChangeTracker::Clean;
Object *object = (Object *)id; Object *object = (Object *)id;
if ((id->recalc & ID_RECALC_GEOMETRY) || (((ID *)object->data)->recalc & ID_RECALC_GEOMETRY)) { if (id->recalc & ID_RECALC_GEOMETRY || ((ID *)object->data)->recalc & ID_RECALC_GEOMETRY ||
id->recalc & ID_RECALC_TRANSFORM) {
set_instances(); set_instances();
bits |= pxr::HdChangeTracker::AllDirty; scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
} prim_id, pxr::HdChangeTracker::AllDirty);
else if (id->recalc & ID_RECALC_TRANSFORM) {
set_instances();
bits |= pxr::HdChangeTracker::DirtyTransform;
}
if (bits != pxr::HdChangeTracker::Clean) {
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(prim_id, bits);
} }
} }
@ -168,13 +161,10 @@ void InstancerData::check_update(Object *object)
if (m_it != mesh_instances_.end()) { if (m_it != mesh_instances_.end()) {
m_it->second.data->update(); m_it->second.data->update();
pxr::HdDirtyBits bits = pxr::HdChangeTracker::Clean;
if (m_it->second.data->id->recalc & ID_RECALC_TRANSFORM) { if (m_it->second.data->id->recalc & ID_RECALC_TRANSFORM) {
set_instances(); set_instances();
bits |= pxr::HdChangeTracker::DirtyTransform; scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
} prim_id, pxr::HdChangeTracker::AllDirty);
if (bits != pxr::HdChangeTracker::Clean) {
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(prim_id, bits);
} }
return; return;
} }