diff --git a/Hydrogent/CMakeLists.txt b/Hydrogent/CMakeLists.txt index cb79007a..8252d461 100644 --- a/Hydrogent/CMakeLists.txt +++ b/Hydrogent/CMakeLists.txt @@ -16,7 +16,7 @@ set(SOURCE src/HnTextureUtils.cpp src/HnTypeConversions.cpp src/Tasks/HnTask.cpp - src/Tasks/HnRenderTask.cpp + src/Tasks/HnRenderRprimsTask.cpp src/Tasks/HnPostProcessTask.cpp src/Tasks/HnTaskController.cpp ) @@ -36,7 +36,7 @@ set(INCLUDE include/HnTextureUtils.hpp include/HnTypeConversions.hpp include/Tasks/HnTask.hpp - include/Tasks/HnRenderTask.hpp + include/Tasks/HnRenderRprimsTask.hpp include/Tasks/HnPostProcessTask.hpp include/Tasks/HnTaskController.hpp ) diff --git a/Hydrogent/include/Tasks/HnRenderTask.hpp b/Hydrogent/include/Tasks/HnRenderRprimsTask.hpp similarity index 83% rename from Hydrogent/include/Tasks/HnRenderTask.hpp rename to Hydrogent/include/Tasks/HnRenderRprimsTask.hpp index decebf13..4a06e8ee 100644 --- a/Hydrogent/include/Tasks/HnRenderTask.hpp +++ b/Hydrogent/include/Tasks/HnRenderRprimsTask.hpp @@ -34,28 +34,28 @@ namespace Diligent namespace USD { -struct HnRenderTaskParams +struct HnRenderRprimsTaskParams { - constexpr bool operator==(const HnRenderTaskParams& rhs) const + constexpr bool operator==(const HnRenderRprimsTaskParams& rhs) const { return true; } - constexpr bool operator!=(const HnRenderTaskParams& rhs) const + constexpr bool operator!=(const HnRenderRprimsTaskParams& rhs) const { return !(*this == rhs); } }; /// Render task implementation in Hydrogent. -class HnRenderTask final : public HnTask +class HnRenderRprimsTask final : public HnTask { public: - using TaskSharedPtr = std::shared_ptr; + using TaskSharedPtr = std::shared_ptr; static TaskSharedPtr Create(pxr::HdSceneDelegate& ParamsDelegate, const pxr::SdfPath& Id); - HnRenderTask(pxr::HdSceneDelegate* ParamsDelegate, const pxr::SdfPath& Id); - ~HnRenderTask(); + HnRenderRprimsTask(pxr::HdSceneDelegate* ParamsDelegate, const pxr::SdfPath& Id); + ~HnRenderRprimsTask(); virtual void Sync(pxr::HdSceneDelegate* Delegate, pxr::HdTaskContext* TaskCtx, diff --git a/Hydrogent/include/Tasks/HnTaskController.hpp b/Hydrogent/include/Tasks/HnTaskController.hpp index ef3c0880..0b26fcbb 100644 --- a/Hydrogent/include/Tasks/HnTaskController.hpp +++ b/Hydrogent/include/Tasks/HnTaskController.hpp @@ -40,19 +40,19 @@ namespace Diligent namespace USD { -struct HnRenderTaskParams; +struct HnRenderRprimsTaskParams; struct HnPostProcessTaskParams; /// Task controller implementation in Hydrogent. class HnTaskController { public: - using TaskUID = uint64_t; - static constexpr TaskUID TaskUID_RenderDefault = 0x287af907f3a740a0; - static constexpr TaskUID TaskUID_RenderMasked = 0xf5290fec47594711; - static constexpr TaskUID TaskUID_RenderAdditive = 0x37d45531106c4c52; - static constexpr TaskUID TaskUID_RenderTranslucent = 0xa015c7e45941407e; - static constexpr TaskUID TaskUID_PostProcess = 0x1f5367e65d034500; + using TaskUID = uint64_t; + static constexpr TaskUID TaskUID_RenderRprimsDefault = 0x287af907f3a740a0; + static constexpr TaskUID TaskUID_RenderRprimsMasked = 0xf5290fec47594711; + static constexpr TaskUID TaskUID_RenderRprimsAdditive = 0x37d45531106c4c52; + static constexpr TaskUID TaskUID_RenderRprimsTranslucent = 0xa015c7e45941407e; + static constexpr TaskUID TaskUID_PostProcess = 0x1f5367e65d034500; HnTaskController(pxr::HdRenderIndex& RenderIndex, const pxr::SdfPath& ControllerId); @@ -79,7 +79,7 @@ class HnTaskController void SetCollection(const pxr::HdRprimCollection& Collection); /// Sets new params for the render tasks. - void SetRenderParams(const HnRenderTaskParams& Params); + void SetRenderParams(const HnRenderRprimsTaskParams& Params); /// Sets new params for the post-process task. void SetPostProcessParams(const HnPostProcessTaskParams& Params); @@ -99,9 +99,9 @@ class HnTaskController void RemoveTask(TaskUID UID); private: - pxr::SdfPath GetRenderTaskId(const pxr::TfToken& MaterialTag) const; + pxr::SdfPath GetRenderRprimsTaskId(const pxr::TfToken& MaterialTag) const; - void CreateRenderTask(const pxr::TfToken& MaterialTag, TaskUID UID); + void CreateRenderRprimsTask(const pxr::TfToken& MaterialTag, TaskUID UID); void CreatePostProcessTask(); private: @@ -122,9 +122,9 @@ template void HnTaskController::CreateTask(const pxr::SdfPath& TaskId, TaskUID UID) { - m_RenderIndex.InsertTask(m_ParamsDelegate.get(), TaskId); + m_RenderIndex.InsertTask(m_ParamsDelegate.get(), TaskId); auto it_inserted = m_TaskUIDs.emplace(UID, TaskId); - VERIFY(!it_inserted.second, "Task with UID ", UID, " already exists: ", it_inserted.first->second.GetText()); + VERIFY(it_inserted.second, "Task with UID ", UID, " already exists: ", it_inserted.first->second.GetText()); } } // namespace USD diff --git a/Hydrogent/src/Tasks/HnRenderTask.cpp b/Hydrogent/src/Tasks/HnRenderRprimsTask.cpp similarity index 65% rename from Hydrogent/src/Tasks/HnRenderTask.cpp rename to Hydrogent/src/Tasks/HnRenderRprimsTask.cpp index 65454211..2db8e03e 100644 --- a/Hydrogent/src/Tasks/HnRenderTask.cpp +++ b/Hydrogent/src/Tasks/HnRenderRprimsTask.cpp @@ -24,7 +24,7 @@ * of the possibility of such damages. */ -#include "Tasks/HnRenderTask.hpp" +#include "Tasks/HnRenderRprimsTask.hpp" namespace Diligent { @@ -32,32 +32,32 @@ namespace Diligent namespace USD { -HnRenderTask::TaskSharedPtr HnRenderTask::Create(pxr::HdSceneDelegate& ParamsDelegate, const pxr::SdfPath& Id) +HnRenderRprimsTask::TaskSharedPtr HnRenderRprimsTask::Create(pxr::HdSceneDelegate& ParamsDelegate, const pxr::SdfPath& Id) { - return TaskSharedPtr(new HnRenderTask{&ParamsDelegate, Id}); + return TaskSharedPtr(new HnRenderRprimsTask{&ParamsDelegate, Id}); } -HnRenderTask::HnRenderTask(pxr::HdSceneDelegate* ParamsDelegate, const pxr::SdfPath& Id) : +HnRenderRprimsTask::HnRenderRprimsTask(pxr::HdSceneDelegate* ParamsDelegate, const pxr::SdfPath& Id) : HnTask{Id} { } -HnRenderTask::~HnRenderTask() +HnRenderRprimsTask::~HnRenderRprimsTask() { } -void HnRenderTask::Sync(pxr::HdSceneDelegate* Delegate, - pxr::HdTaskContext* TaskCtx, - pxr::HdDirtyBits* DirtyBits) +void HnRenderRprimsTask::Sync(pxr::HdSceneDelegate* Delegate, + pxr::HdTaskContext* TaskCtx, + pxr::HdDirtyBits* DirtyBits) { } -void HnRenderTask::Prepare(pxr::HdTaskContext* TaskCtx, - pxr::HdRenderIndex* RenderIndex) +void HnRenderRprimsTask::Prepare(pxr::HdTaskContext* TaskCtx, + pxr::HdRenderIndex* RenderIndex) { } -void HnRenderTask::Execute(pxr::HdTaskContext* TaskCtx) +void HnRenderRprimsTask::Execute(pxr::HdTaskContext* TaskCtx) { } diff --git a/Hydrogent/src/Tasks/HnTaskController.cpp b/Hydrogent/src/Tasks/HnTaskController.cpp index e55a3a06..f520a718 100644 --- a/Hydrogent/src/Tasks/HnTaskController.cpp +++ b/Hydrogent/src/Tasks/HnTaskController.cpp @@ -29,7 +29,7 @@ #include #include -#include "Tasks/HnRenderTask.hpp" +#include "Tasks/HnRenderRprimsTask.hpp" #include "Tasks/HnPostProcessTask.hpp" #include "HnTokens.hpp" #include "HashUtils.hpp" @@ -167,19 +167,19 @@ HnTaskController::HnTaskController(pxr::HdRenderIndex& RenderIndex, m_ControllerId{ControllerId}, m_ParamsDelegate{std::make_unique(RenderIndex, ControllerId)} { - CreateRenderTask(HnMaterialTagTokens->defaultTag, TaskUID_RenderDefault); - CreateRenderTask(HnMaterialTagTokens->masked, TaskUID_RenderMasked); - CreateRenderTask(HnMaterialTagTokens->additive, TaskUID_RenderAdditive); - CreateRenderTask(HnMaterialTagTokens->translucent, TaskUID_RenderTranslucent); + CreateRenderRprimsTask(HnMaterialTagTokens->defaultTag, TaskUID_RenderRprimsDefault); + CreateRenderRprimsTask(HnMaterialTagTokens->masked, TaskUID_RenderRprimsMasked); + CreateRenderRprimsTask(HnMaterialTagTokens->additive, TaskUID_RenderRprimsAdditive); + CreateRenderRprimsTask(HnMaterialTagTokens->translucent, TaskUID_RenderRprimsTranslucent); CreatePostProcessTask(); m_DefaultTaskOrder = { - TaskUID_RenderDefault, - TaskUID_RenderMasked, - TaskUID_RenderAdditive, - TaskUID_RenderTranslucent, + TaskUID_RenderRprimsDefault, + TaskUID_RenderRprimsMasked, + TaskUID_RenderRprimsAdditive, + TaskUID_RenderRprimsTranslucent, TaskUID_PostProcess, }; } @@ -212,9 +212,9 @@ void HnTaskController::RemoveTask(TaskUID UID) m_TaskUIDs.erase(it); } -pxr::SdfPath HnTaskController::GetRenderTaskId(const pxr::TfToken& MaterialTag) const +pxr::SdfPath HnTaskController::GetRenderRprimsTaskId(const pxr::TfToken& MaterialTag) const { - std::string Id = std::string{"renderTask_"} + MaterialTag.GetString(); + std::string Id = std::string{"RenderRprimsTask_"} + MaterialTag.GetString(); std::replace(Id.begin(), Id.end(), ':', '_'); return GetControllerId().AppendChild(TfToken{Id}); } @@ -224,14 +224,14 @@ void HnTaskController::SetParameter(const pxr::SdfPath& Id, const TfToken& Value m_ParamsDelegate->SetParameter(Id, ValueKey, std::move(Value)); } -void HnTaskController::CreateRenderTask(const pxr::TfToken& MaterialTag, TaskUID UID) +void HnTaskController::CreateRenderRprimsTask(const pxr::TfToken& MaterialTag, TaskUID UID) { - pxr::SdfPath RenderTaskId = GetRenderTaskId(MaterialTag); + pxr::SdfPath RenderRprimsTaskId = GetRenderRprimsTaskId(MaterialTag); // Note that we pass the delegate to the scene index. This delegate will be passed // to the task's Sync() method. - CreateTask(RenderTaskId, UID); + CreateTask(RenderRprimsTaskId, UID); - HnRenderTaskParams TaskParams; + HnRenderRprimsTaskParams TaskParams; pxr::HdRprimCollection Collection{ pxr::HdTokens->geometry, @@ -243,11 +243,11 @@ void HnTaskController::CreateRenderTask(const pxr::TfToken& MaterialTag, TaskUID pxr::TfTokenVector RenderTags = {pxr::HdRenderTagTokens->geometry}; - m_ParamsDelegate->SetParameter(RenderTaskId, pxr::HdTokens->params, TaskParams); - m_ParamsDelegate->SetParameter(RenderTaskId, pxr::HdTokens->collection, Collection); - m_ParamsDelegate->SetParameter(RenderTaskId, pxr::HdTokens->renderTags, RenderTags); + m_ParamsDelegate->SetParameter(RenderRprimsTaskId, pxr::HdTokens->params, TaskParams); + m_ParamsDelegate->SetParameter(RenderRprimsTaskId, pxr::HdTokens->collection, Collection); + m_ParamsDelegate->SetParameter(RenderRprimsTaskId, pxr::HdTokens->renderTags, RenderTags); - m_RenderTaskIds.emplace_back(std::move(RenderTaskId)); + m_RenderTaskIds.emplace_back(std::move(RenderRprimsTaskId)); } void HnTaskController::CreatePostProcessTask() @@ -295,11 +295,11 @@ void HnTaskController::SetCollection(const pxr::HdRprimCollection& Collection) } } -void HnTaskController::SetRenderParams(const HnRenderTaskParams& Params) +void HnTaskController::SetRenderParams(const HnRenderRprimsTaskParams& Params) { for (const auto& TaskId : m_RenderTaskIds) { - HnRenderTaskParams OldParams = m_ParamsDelegate->GetParameter(TaskId, pxr::HdTokens->params); + HnRenderRprimsTaskParams OldParams = m_ParamsDelegate->GetParameter(TaskId, pxr::HdTokens->params); if (OldParams == Params) continue;