Fix review comments 2 #31

Merged
Bogdan Nagirniak merged 8 commits from BLEN-397 into hydra-render 2023-04-27 09:05:38 +02:00
2 changed files with 8 additions and 21 deletions
Showing only changes of commit 987c707c7d - Show all commits

View File

@ -39,13 +39,7 @@ void FinalEngine::render(Depsgraph *depsgraph)
std::string layer_name = view_layer->name;
const RenderData &r = scene->r;
pxr::GfVec4f border(0, 0, 1, 1);
if (r.mode & R_BORDER) {
border = pxr::GfVec4f(r.border.xmin,
r.border.ymin,
r.border.xmax - r.border.xmin,
r.border.ymax - r.border.ymin);
}
pxr::GfVec4f border = get_resolution(scene);
pxr::GfVec2i image_res(r.xsch * r.size / 100, r.ysch * r.size / 100);
pxr::GfVec2i res(int(image_res[0] * border[2]), int(image_res[1] * border[3]));
pxr::GfCamera camera =
@ -106,16 +100,15 @@ void FinalEngine::render(Depsgraph *depsgraph)
update_render_result(render_images, layer_name, res[0], res[1]);
}
pxr::GfVec2i FinalEngine::get_resolution(Scene *scene)
pxr::GfVec4f FinalEngine::get_resolution(const Scene *scene)
{
RenderData &r = scene->r;
const RenderData &r = scene->r;
float border_w = 1.0, border_h = 1.0;
if (r.mode & R_BORDER) {
border_w = r.border.xmax - r.border.xmin;
border_h = r.border.ymax - r.border.ymin;
}
return pxr::GfVec2i(int(r.xsch * border_w * r.size / 100),
int(r.ysch * border_h * r.size / 100));
return pxr::GfVec4f(r.border.xmin, r.border.ymin, border_w, border_h);
}
void FinalEngine::update_render_result(std::map<std::string, std::vector<float>> &render_images,
@ -157,15 +150,9 @@ void FinalEngineGL::render(Depsgraph *depsgraph)
std::string layer_name = view_layer->name;
const RenderData &r = scene->r;
pxr::GfVec4f border(0, 0, 1, 1);
if (r.mode & R_BORDER) {
border = pxr::GfVec4f(r.border.xmin,
r.border.ymin,
r.border.xmax - r.border.xmin,
r.border.ymax - r.border.ymin);
}
pxr::GfVec2i image_res = {r.xsch * r.size / 100, r.ysch * r.size / 100};
pxr::GfVec2i res = {int(image_res[0] * border[2]), int(image_res[1] * border[3])};
pxr::GfVec4f border = get_resolution(scene);
pxr::GfVec2i image_res(r.xsch * r.size / 100, r.ysch * r.size / 100);
pxr::GfVec2i res(int(image_res[0] * border[2]), int(image_res[1] * border[3]));
pxr::GfCamera camera =
CameraData(scene->camera, image_res, pxr::GfVec4f(0, 0, 1, 1)).gf_camera(border);

View File

@ -17,7 +17,7 @@ class FinalEngine : public Engine {
virtual void render(Depsgraph *b_depsgraph) override;
protected:
pxr::GfVec2i get_resolution(Scene *scene);
pxr::GfVec4f get_resolution(const Scene *scene);
void update_render_result(std::map<std::string, std::vector<float>> &render_images,
const std::string &layer_name,
int width,