Code improvements and fixes #26

Merged
Bogdan Nagirniak merged 8 commits from code_improvements_fixes into hydra-render 2023-04-21 07:48:50 +02:00
7 changed files with 17 additions and 13 deletions
Showing only changes of commit d170b0eaf2 - Show all commits

View File

@ -48,7 +48,6 @@ class Engine {
std::unique_ptr<pxr::HdxFreeCameraSceneDelegate> free_camera_delegate_; std::unique_ptr<pxr::HdxFreeCameraSceneDelegate> free_camera_delegate_;
std::unique_ptr<SimpleLightTaskDelegate> simple_light_task_delegate_; std::unique_ptr<SimpleLightTaskDelegate> simple_light_task_delegate_;
std::unique_ptr<pxr::HdEngine> engine_; std::unique_ptr<pxr::HdEngine> engine_;
}; };
} // namespace blender::render::hydra } // namespace blender::render::hydra

View File

@ -116,7 +116,8 @@ bool InstancerData::update_visibility()
return ret; return ret;
} }
pxr::HdPrimvarDescriptorVector InstancerData::primvar_descriptors(pxr::HdInterpolation interpolation) const pxr::HdPrimvarDescriptorVector InstancerData::primvar_descriptors(
pxr::HdInterpolation interpolation) const
{ {
pxr::HdPrimvarDescriptorVector primvars; pxr::HdPrimvarDescriptorVector primvars;
if (interpolation == pxr::HdInterpolationInstance) { if (interpolation == pxr::HdInterpolationInstance) {
@ -179,8 +180,8 @@ void InstancerData::check_remove(std::set<std::string> &available_objects)
} }
if (ret) { if (ret) {
set_instances(); set_instances();
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(prim_id, scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
pxr::HdChangeTracker::AllDirty); prim_id, pxr::HdChangeTracker::AllDirty);
} }
} }
@ -212,7 +213,8 @@ void InstancerData::set_instances()
Instance *inst; Instance *inst;
pxr::SdfPath path; pxr::SdfPath path;
ListBase *lb = object_duplilist(scene_delegate_->depsgraph, scene_delegate_->scene, (Object *)id); ListBase *lb = object_duplilist(
scene_delegate_->depsgraph, scene_delegate_->scene, (Object *)id);
LISTBASE_FOREACH (DupliObject *, dupli, lb) { LISTBASE_FOREACH (DupliObject *, dupli, lb) {
path = object_prim_id(dupli->ob); path = object_prim_id(dupli->ob);
auto it = instances_.find(path); auto it = instances_.find(path);

View File

@ -53,7 +53,9 @@ using InstancerDataMap =
class InstanceMeshData : public MeshData { class InstanceMeshData : public MeshData {
public: public:
InstanceMeshData(BlenderSceneDelegate *scene_delegate, Object *object, pxr::SdfPath const &prim_id); InstanceMeshData(BlenderSceneDelegate *scene_delegate,
Object *object,
pxr::SdfPath const &prim_id);
pxr::GfMatrix4d transform() override; pxr::GfMatrix4d transform() override;
}; };

View File

@ -80,7 +80,7 @@ void LightData::init()
break; break;
} }
p_type_ = prim_type(light); prim_type_ = prim_type(light);
/* TODO: temporary value, it should be delivered through Python UI */ /* TODO: temporary value, it should be delivered through Python UI */
data_[pxr::HdLightTokens->exposure] = 1.0f; data_[pxr::HdLightTokens->exposure] = 1.0f;
@ -89,13 +89,13 @@ void LightData::init()
void LightData::insert() void LightData::insert()
{ {
ID_LOG(2, ""); ID_LOG(2, "");
scene_delegate_->GetRenderIndex().InsertSprim(p_type_, scene_delegate_, prim_id); scene_delegate_->GetRenderIndex().InsertSprim(prim_type_, scene_delegate_, prim_id);
} }
void LightData::remove() void LightData::remove()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", prim_id.GetText()); CLOG_INFO(LOG_BSD, 2, "%s", prim_id.GetText());
scene_delegate_->GetRenderIndex().RemoveSprim(p_type_, prim_id); scene_delegate_->GetRenderIndex().RemoveSprim(prim_type_, prim_id);
} }
void LightData::update() void LightData::update()
@ -103,7 +103,7 @@ void LightData::update()
ID_LOG(2, ""); ID_LOG(2, "");
Light *light = (Light *)((Object *)id)->data; Light *light = (Light *)((Object *)id)->data;
if (prim_type(light) != p_type_) { if (prim_type(light) != prim_type_) {
remove(); remove();
init(); init();
insert(); insert();

View File

@ -29,7 +29,7 @@ class LightData : public ObjectData {
pxr::TfToken prim_type(Light *light); pxr::TfToken prim_type(Light *light);
std::map<pxr::TfToken, pxr::VtValue> data_; std::map<pxr::TfToken, pxr::VtValue> data_;
pxr::TfToken p_type_; pxr::TfToken prim_type_;
}; };
} // namespace blender::render::hydra } // namespace blender::render::hydra

View File

@ -135,7 +135,8 @@ pxr::HdMeshTopology MeshData::mesh_topology() const
face_vertex_indices_); face_vertex_indices_);
} }
pxr::HdPrimvarDescriptorVector MeshData::primvar_descriptors(pxr::HdInterpolation interpolation) const pxr::HdPrimvarDescriptorVector MeshData::primvar_descriptors(
pxr::HdInterpolation interpolation) const
{ {
pxr::HdPrimvarDescriptorVector primvars; pxr::HdPrimvarDescriptorVector primvars;
if (interpolation == pxr::HdInterpolationVertex) { if (interpolation == pxr::HdInterpolationVertex) {