forked from blender/blender
Fix review comments 2 #31
@ -17,12 +17,13 @@ namespace blender::render::hydra {
|
|||||||
|
|
||||||
CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA, "render.hydra");
|
CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA, "render.hydra");
|
||||||
|
|
||||||
Engine::Engine(RenderEngine *bl_engine, const std::string &delegate_id) : bl_engine_(bl_engine)
|
Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
|
||||||
|
: bl_engine_(bl_engine), render_delegate_name(render_delegate_name)
|
||||||
{
|
{
|
||||||
pxr::HdRendererPluginRegistry ®istry = pxr::HdRendererPluginRegistry::GetInstance();
|
pxr::HdRendererPluginRegistry ®istry = pxr::HdRendererPluginRegistry::GetInstance();
|
||||||
|
|
||||||
pxr::TF_PY_ALLOW_THREADS_IN_SCOPE();
|
pxr::TF_PY_ALLOW_THREADS_IN_SCOPE();
|
||||||
render_delegate_ = registry.CreateRenderDelegate(pxr::TfToken(delegate_id));
|
render_delegate_ = registry.CreateRenderDelegate(pxr::TfToken(render_delegate_name));
|
||||||
|
|
||||||
/* Current USD (23.02) has limited support for Vulkan. To make it works USD should be built
|
/* Current USD (23.02) has limited support for Vulkan. To make it works USD should be built
|
||||||
* with PXR_ENABLE_VULKAN_SUPPORT=TRUE which is not possible now */
|
* with PXR_ENABLE_VULKAN_SUPPORT=TRUE which is not possible now */
|
||||||
@ -44,7 +45,7 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &delegate_id) : bl_eng
|
|||||||
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera"));
|
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera"));
|
||||||
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
|
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
|
||||||
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
|
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
|
||||||
if (render_delegate_->GetRendererDisplayName() == "GL") {
|
if (render_delegate_name == "HdStormRendererPlugin") {
|
||||||
simple_light_task_delegate_ = std::make_unique<SimpleLightTaskDelegate>(
|
simple_light_task_delegate_ = std::make_unique<SimpleLightTaskDelegate>(
|
||||||
render_index_.get(),
|
render_index_.get(),
|
||||||
pxr::SdfPath::AbsoluteRootPath().AppendElementString("simpleLightTask"));
|
pxr::SdfPath::AbsoluteRootPath().AppendElementString("simpleLightTask"));
|
||||||
|
@ -25,7 +25,7 @@ extern struct CLG_LogRef *LOG_RENDER_HYDRA; /* EN - Engine */
|
|||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
public:
|
public:
|
||||||
Engine(RenderEngine *bl_engine, const std::string &render_delegate_id);
|
Engine(RenderEngine *bl_engine, const std::string &render_delegate_name);
|
||||||
virtual ~Engine() = default;
|
virtual ~Engine() = default;
|
||||||
|
|
||||||
virtual void sync(Depsgraph *depsgraph,
|
virtual void sync(Depsgraph *depsgraph,
|
||||||
@ -33,6 +33,8 @@ class Engine {
|
|||||||
pxr::HdRenderSettingsMap &render_settings) = 0;
|
pxr::HdRenderSettingsMap &render_settings) = 0;
|
||||||
virtual void render(Depsgraph *depsgraph) = 0;
|
virtual void render(Depsgraph *depsgraph) = 0;
|
||||||
|
|
||||||
|
std::string render_delegate_name;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float renderer_percent_done();
|
float renderer_percent_done();
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ void FinalEngine::sync(Depsgraph *depsgraph,
|
|||||||
scene_delegate_ = std::make_unique<BlenderSceneDelegate>(
|
scene_delegate_ = std::make_unique<BlenderSceneDelegate>(
|
||||||
render_index_.get(),
|
render_index_.get(),
|
||||||
pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"),
|
pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"),
|
||||||
BlenderSceneDelegate::EngineType::FINAL);
|
BlenderSceneDelegate::EngineType::FINAL,
|
||||||
|
render_delegate_name);
|
||||||
scene_delegate_->populate(depsgraph, context);
|
scene_delegate_->populate(depsgraph, context);
|
||||||
|
|
||||||
for (auto const &setting : render_settings) {
|
for (auto const &setting : render_settings) {
|
||||||
|
@ -44,7 +44,8 @@ void PreviewEngine::sync(Depsgraph *depsgraph,
|
|||||||
scene_delegate_ = std::make_unique<BlenderSceneDelegate>(
|
scene_delegate_ = std::make_unique<BlenderSceneDelegate>(
|
||||||
render_index_.get(),
|
render_index_.get(),
|
||||||
pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"),
|
pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"),
|
||||||
BlenderSceneDelegate::EngineType::PREVIEW);
|
BlenderSceneDelegate::EngineType::PREVIEW,
|
||||||
|
render_delegate_name);
|
||||||
}
|
}
|
||||||
scene_delegate_->clear();
|
scene_delegate_->clear();
|
||||||
scene_delegate_->populate(depsgraph, context);
|
scene_delegate_->populate(depsgraph, context);
|
||||||
|
@ -15,8 +15,11 @@ CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA_SCENE, "render.hydra.scene");
|
|||||||
|
|
||||||
BlenderSceneDelegate::BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
BlenderSceneDelegate::BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
||||||
pxr::SdfPath const &delegate_id,
|
pxr::SdfPath const &delegate_id,
|
||||||
BlenderSceneDelegate::EngineType engine_type)
|
BlenderSceneDelegate::EngineType engine_type,
|
||||||
: HdSceneDelegate(parent_index, delegate_id), engine_type(engine_type)
|
std::string render_delegate_name)
|
||||||
|
: HdSceneDelegate(parent_index, delegate_id),
|
||||||
|
engine_type(engine_type),
|
||||||
|
render_delegate_name(render_delegate_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
|||||||
|
|
||||||
BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
||||||
pxr::SdfPath const &delegate_id,
|
pxr::SdfPath const &delegate_id,
|
||||||
BlenderSceneDelegate::EngineType engine_type);
|
BlenderSceneDelegate::EngineType engine_type,
|
||||||
|
std::string render_delegate_name);
|
||||||
~BlenderSceneDelegate() override = default;
|
~BlenderSceneDelegate() override = default;
|
||||||
|
|
||||||
/* Delegate methods */
|
/* Delegate methods */
|
||||||
@ -56,6 +57,8 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
|||||||
View3D *view3d = nullptr;
|
View3D *view3d = nullptr;
|
||||||
Scene *scene = nullptr;
|
Scene *scene = nullptr;
|
||||||
|
|
||||||
|
std::string render_delegate_name;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pxr::SdfPath prim_id(ID *id, const char *prefix) const;
|
pxr::SdfPath prim_id(ID *id, const char *prefix) const;
|
||||||
pxr::SdfPath object_prim_id(Object *object) const;
|
pxr::SdfPath object_prim_id(Object *object) const;
|
||||||
|
@ -162,7 +162,7 @@ void WorldData::write_transform()
|
|||||||
transform = pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -90), pxr::GfVec3d());
|
transform = pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -90), pxr::GfVec3d());
|
||||||
|
|
||||||
/* TODO : do this check via RenderSettings*/
|
/* TODO : do this check via RenderSettings*/
|
||||||
if (scene_delegate_->GetRenderIndex().GetRenderDelegate()->GetRendererDisplayName() == "RPR") {
|
if (scene_delegate_->render_delegate_name == "HdRprPlugin") {
|
||||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -180),
|
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -180),
|
||||||
pxr::GfVec3d());
|
pxr::GfVec3d());
|
||||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, 1.0), 90.0),
|
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, 1.0), 90.0),
|
||||||
|
@ -225,7 +225,8 @@ void ViewportEngine::sync(Depsgraph *depsgraph,
|
|||||||
scene_delegate_ = std::make_unique<BlenderSceneDelegate>(
|
scene_delegate_ = std::make_unique<BlenderSceneDelegate>(
|
||||||
render_index_.get(),
|
render_index_.get(),
|
||||||
pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"),
|
pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"),
|
||||||
BlenderSceneDelegate::EngineType::VIEWPORT);
|
BlenderSceneDelegate::EngineType::VIEWPORT,
|
||||||
|
render_delegate_name);
|
||||||
}
|
}
|
||||||
scene_delegate_->populate(depsgraph, context);
|
scene_delegate_->populate(depsgraph, context);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user