forked from blender/blender
Fix review comments 2 #31
@ -39,13 +39,7 @@ void FinalEngine::render(Depsgraph *depsgraph)
|
|||||||
std::string layer_name = view_layer->name;
|
std::string layer_name = view_layer->name;
|
||||||
|
|
||||||
const RenderData &r = scene->r;
|
const RenderData &r = scene->r;
|
||||||
pxr::GfVec4f border(0, 0, 1, 1);
|
pxr::GfVec4f border = get_resolution(scene);
|
||||||
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 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::GfVec2i res(int(image_res[0] * border[2]), int(image_res[1] * border[3]));
|
||||||
pxr::GfCamera camera =
|
pxr::GfCamera camera =
|
||||||
@ -106,16 +100,15 @@ void FinalEngine::render(Depsgraph *depsgraph)
|
|||||||
update_render_result(render_images, layer_name, res[0], res[1]);
|
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;
|
float border_w = 1.0, border_h = 1.0;
|
||||||
if (r.mode & R_BORDER) {
|
if (r.mode & R_BORDER) {
|
||||||
border_w = r.border.xmax - r.border.xmin;
|
border_w = r.border.xmax - r.border.xmin;
|
||||||
border_h = r.border.ymax - r.border.ymin;
|
border_h = r.border.ymax - r.border.ymin;
|
||||||
}
|
}
|
||||||
return pxr::GfVec2i(int(r.xsch * border_w * r.size / 100),
|
return pxr::GfVec4f(r.border.xmin, r.border.ymin, border_w, border_h);
|
||||||
int(r.ysch * border_h * r.size / 100));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinalEngine::update_render_result(std::map<std::string, std::vector<float>> &render_images,
|
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;
|
std::string layer_name = view_layer->name;
|
||||||
|
|
||||||
const RenderData &r = scene->r;
|
const RenderData &r = scene->r;
|
||||||
pxr::GfVec4f border(0, 0, 1, 1);
|
pxr::GfVec4f border = get_resolution(scene);
|
||||||
if (r.mode & R_BORDER) {
|
pxr::GfVec2i image_res(r.xsch * r.size / 100, r.ysch * r.size / 100);
|
||||||
border = pxr::GfVec4f(r.border.xmin,
|
pxr::GfVec2i res(int(image_res[0] * border[2]), int(image_res[1] * border[3]));
|
||||||
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::GfCamera camera =
|
pxr::GfCamera camera =
|
||||||
CameraData(scene->camera, image_res, pxr::GfVec4f(0, 0, 1, 1)).gf_camera(border);
|
CameraData(scene->camera, image_res, pxr::GfVec4f(0, 0, 1, 1)).gf_camera(border);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class FinalEngine : public Engine {
|
|||||||
virtual void render(Depsgraph *b_depsgraph) override;
|
virtual void render(Depsgraph *b_depsgraph) override;
|
||||||
|
|
||||||
protected:
|
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,
|
void update_render_result(std::map<std::string, std::vector<float>> &render_images,
|
||||||
const std::string &layer_name,
|
const std::string &layer_name,
|
||||||
int width,
|
int width,
|
||||||
|
Loading…
Reference in New Issue
Block a user