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
3 changed files with 6 additions and 4 deletions
Showing only changes of commit 3c642fabc9 - Show all commits

View File

@ -22,7 +22,7 @@ extern struct CLG_LogRef *LOG_RENDER_HYDRA_SCENE; /* BSD - Blender Scene Delegat
class BlenderSceneDelegate : public pxr::HdSceneDelegate { class BlenderSceneDelegate : public pxr::HdSceneDelegate {
friend ObjectData; /* has access to instances */ friend ObjectData; /* has access to instances */
friend MeshData; /* has access to materials */ friend MeshData; /* has access to materials */
public: public:
enum class EngineType { VIEWPORT = 1, FINAL, PREVIEW }; enum class EngineType { VIEWPORT = 1, FINAL, PREVIEW };

View File

@ -107,13 +107,15 @@ bool InstancerData::update_visibility()
change_tracker.MarkInstancerDirty(prim_id, pxr::HdChangeTracker::DirtyVisibility); change_tracker.MarkInstancerDirty(prim_id, pxr::HdChangeTracker::DirtyVisibility);
for (auto &it : mesh_instances_) { for (auto &it : mesh_instances_) {
it.second.data->visible = visible; it.second.data->visible = visible;
change_tracker.MarkRprimDirty(it.second.data->prim_id, pxr::HdChangeTracker::DirtyVisibility); change_tracker.MarkRprimDirty(it.second.data->prim_id,
pxr::HdChangeTracker::DirtyVisibility);
} }
char name[16]; char name[16];
for (auto &it : light_instances_) { for (auto &it : light_instances_) {
for (int i = 0; i < it.second.count; ++i) { for (int i = 0; i < it.second.count; ++i) {
snprintf(name, 16, "L_%08x", i); snprintf(name, 16, "L_%08x", i);
change_tracker.MarkRprimDirty(it.second.data->prim_id.AppendElementString(name), pxr::HdChangeTracker::DirtyVisibility); change_tracker.MarkRprimDirty(it.second.data->prim_id.AppendElementString(name),
pxr::HdChangeTracker::DirtyVisibility);
} }
} }
} }

View File

@ -5,8 +5,8 @@
#include "BKE_duplilist.h" #include "BKE_duplilist.h"
#include "mesh.h"
#include "light.h" #include "light.h"
#include "mesh.h"
namespace blender::render::hydra { namespace blender::render::hydra {