forked from blender/blender
Code improvements and fixes #26
@ -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
|
||||||
|
@ -150,7 +150,7 @@ pxr::GfMatrix4d BlenderSceneDelegate::GetInstancerTransform(pxr::SdfPath const &
|
|||||||
return i_data->transform();
|
return i_data->transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlenderSceneDelegate::populate(Depsgraph * deps, bContext * cont)
|
void BlenderSceneDelegate::populate(Depsgraph *deps, bContext *cont)
|
||||||
{
|
{
|
||||||
bool is_populated = depsgraph != nullptr;
|
bool is_populated = depsgraph != nullptr;
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user