Rename some functions #25

Merged
Bogdan Nagirniak merged 13 commits from BLEN-388 into hydra-render 2023-04-18 09:07:35 +02:00
7 changed files with 21 additions and 23 deletions
Showing only changes of commit fa34aadc68 - Show all commits

View File

@ -46,6 +46,7 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &delegate_id) : bl_eng
Engine::~Engine() Engine::~Engine()
{ {
/* Destructor must exists and keep deletion order */
scene_delegate_ = nullptr; scene_delegate_ = nullptr;
render_task_delegate_ = nullptr; render_task_delegate_ = nullptr;
free_camera_delegate_ = nullptr; free_camera_delegate_ = nullptr;

View File

@ -5,8 +5,6 @@
#include <chrono> #include <chrono>
#include <Python.h>
#include <pxr/imaging/hd/driver.h> #include <pxr/imaging/hd/driver.h>
#include <pxr/imaging/hd/engine.h> #include <pxr/imaging/hd/engine.h>
#include <pxr/imaging/hd/pluginRenderDelegateUniqueHandle.h> #include <pxr/imaging/hd/pluginRenderDelegateUniqueHandle.h>

View File

@ -29,14 +29,14 @@ void FinalEngine::sync(Depsgraph *depsgraph,
void FinalEngine::render(Depsgraph *depsgraph) void FinalEngine::render(Depsgraph *depsgraph)
{ {
Scene *scene = DEG_get_input_scene(depsgraph); const Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); const ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
std::string scene_name(MAX_ID_FULL_NAME, 0); std::string scene_name(MAX_ID_FULL_NAME, 0);
BKE_id_full_name_get(scene_name.data(), (ID *)scene, 0); BKE_id_full_name_get(scene_name.data(), (ID *)scene, 0);
std::string layer_name = view_layer->name; std::string layer_name = view_layer->name;
RenderData &r = scene->r; const RenderData &r = scene->r;
pxr::GfVec4f border(0, 0, 1, 1); pxr::GfVec4f border(0, 0, 1, 1);
if (r.mode & R_BORDER) { if (r.mode & R_BORDER) {
border = pxr::GfVec4f(r.border.xmin, border = pxr::GfVec4f(r.border.xmin,
@ -149,14 +149,14 @@ void FinalEngine::notify_status(float progress, const std::string &title, const
void FinalEngineGL::render(Depsgraph *depsgraph) void FinalEngineGL::render(Depsgraph *depsgraph)
{ {
Scene *scene = DEG_get_input_scene(depsgraph); const Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); const ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
std::string scene_name(MAX_ID_FULL_NAME, 0); std::string scene_name(MAX_ID_FULL_NAME, 0);
BKE_id_full_name_get(scene_name.data(), (ID *)scene, 0); BKE_id_full_name_get(scene_name.data(), (ID *)scene, 0);
std::string layer_name = view_layer->name; std::string layer_name = view_layer->name;
RenderData &r = scene->r; const RenderData &r = scene->r;
pxr::GfVec4f border(0, 0, 1, 1); pxr::GfVec4f border(0, 0, 1, 1);
if (r.mode & R_BORDER) { if (r.mode & R_BORDER) {
border = pxr::GfVec4f(r.border.xmin, border = pxr::GfVec4f(r.border.xmin,
@ -195,9 +195,9 @@ void FinalEngineGL::render(Depsgraph *depsgraph)
{"Combined", std::vector<float>(res[0] * res[1] * 4)}}; /* 4 - number of channels. */ {"Combined", std::vector<float>(res[0] * res[1] * 4)}}; /* 4 - number of channels. */
std::vector<float> &pixels = render_images["Combined"]; std::vector<float> &pixels = render_images["Combined"];
GPUFrameBuffer *framebuffer = GPU_framebuffer_create("fbHydraRenderFinal"); GPUFrameBuffer *framebuffer = GPU_framebuffer_create("fb_hdyra_render_final");
GPUTexture *texture = GPU_texture_create_2d( GPUTexture *texture = GPU_texture_create_2d(
"texHydraRenderFinal", res[0], res[1], 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr); "tex_hydra_render_final", res[0], res[1], 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr);
GPU_texture_filter_mode(texture, true); GPU_texture_filter_mode(texture, true);
GPU_texture_mipmap_mode(texture, true, true); GPU_texture_mipmap_mode(texture, true, true);
GPU_framebuffer_texture_attach(framebuffer, texture, 0, 0); GPU_framebuffer_texture_attach(framebuffer, texture, 0, 0);

View File

@ -56,8 +56,8 @@ void PreviewEngine::sync(Depsgraph *depsgraph,
void PreviewEngine::render(Depsgraph *depsgraph) void PreviewEngine::render(Depsgraph *depsgraph)
{ {
Scene *scene = DEG_get_input_scene(depsgraph); const Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); const ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
std::string layer_name = view_layer->name; std::string layer_name = view_layer->name;
pxr::GfVec2i res(scene->r.xsch, scene->r.ysch); pxr::GfVec2i res(scene->r.xsch, scene->r.ysch);

View File

@ -17,10 +17,7 @@ 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), : HdSceneDelegate(parent_index, delegate_id),
engine_type(engine_type), engine_type(engine_type)
depsgraph_(nullptr),
context_(nullptr),
view3d_(nullptr)
{ {
} }

View File

@ -66,11 +66,11 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
void update_world(); void update_world();
void update_collection(bool remove, bool visibility); void update_collection(bool remove, bool visibility);
Depsgraph *depsgraph_; Depsgraph *depsgraph_ = nullptr;
bContext *context_; bContext *context_ = nullptr;
View3D *view3d_ = nullptr;
Scene *scene_; Scene *scene_;
View3D *view3d_;
ObjectDataMap objects_; ObjectDataMap objects_;
MaterialDataMap materials_; MaterialDataMap materials_;
std::unique_ptr<WorldData> world_data_; std::unique_ptr<WorldData> world_data_;

View File

@ -5,15 +5,17 @@
#include <pxr/imaging/glf/drawTarget.h> #include <pxr/imaging/glf/drawTarget.h>
#include <pxr/usd/usdGeom/camera.h> #include <pxr/usd/usdGeom/camera.h>
// clang-format off
#include "DNA_camera_types.h" #include "DNA_camera_types.h"
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "DNA_vec_types.h" /* this include must be before BKE_camera.h due to "rctf" type */ #include "DNA_vec_types.h" /* this include must be before BKE_camera.h due to "rctf" type */
#include "BKE_camera.h" #include "BKE_camera.h"
#include "BLI_math_matrix.h" #include "BLI_math_matrix.h"
#include "DEG_depsgraph_query.h" #include "DEG_depsgraph_query.h"
#include "GPU_matrix.h" #include "GPU_matrix.h"
// clang-format on
#include "camera.h" #include "camera.h"
#include "utils.h" #include "utils.h"
@ -194,7 +196,7 @@ void DrawTexture::create(pxr::HdRenderBuffer *buffer)
channels_ = pxr::HdGetComponentCount(buffer->GetFormat()); channels_ = pxr::HdGetComponentCount(buffer->GetFormat());
void *data = buffer->Map(); void *data = buffer->Map();
texture_ = GPU_texture_create_2d("texHydraRenderViewport", texture_ = GPU_texture_create_2d("tex_hydra_render_viewport",
width_, width_,
height_, height_,
1, 1,