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<SimpleLightTaskDelegate> simple_light_task_delegate_;
std::unique_ptr<pxr::HdEngine> engine_;
};
} // namespace blender::render::hydra

View File

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

View File

@ -53,7 +53,9 @@ using InstancerDataMap =
class InstanceMeshData : public MeshData {
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;
};

View File

@ -80,7 +80,7 @@ void LightData::init()
break;
}
p_type_ = prim_type(light);
prim_type_ = prim_type(light);
/* TODO: temporary value, it should be delivered through Python UI */
data_[pxr::HdLightTokens->exposure] = 1.0f;
@ -89,13 +89,13 @@ void LightData::init()
void LightData::insert()
{
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()
{
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()
@ -103,7 +103,7 @@ void LightData::update()
ID_LOG(2, "");
Light *light = (Light *)((Object *)id)->data;
if (prim_type(light) != p_type_) {
if (prim_type(light) != prim_type_) {
remove();
init();
insert();

View File

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

View File

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