Fixed a bug that caused a Y-direction offset in rendering results.
The renderer now takes the aspect ratio settings into account.
This commit is contained in:
@@ -52,8 +52,9 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re)
|
||||
set_scene_bg( freestyle_scene );
|
||||
|
||||
// image dimensions
|
||||
float ycor = ((float)re->r.yasp) / ((float)re->r.xasp);
|
||||
float width = freestyle_scene->r.xsch;
|
||||
float height = freestyle_scene->r.ysch;
|
||||
float height = freestyle_scene->r.ysch * ycor;
|
||||
|
||||
// Camera
|
||||
Object* object_camera = add_object(freestyle_scene, OB_CAMERA);
|
||||
|
||||
@@ -81,8 +81,9 @@ extern "C" {
|
||||
//=======================================================
|
||||
|
||||
void init_view(Render* re){
|
||||
float ycor = ((float)re->r.yasp) / ((float)re->r.xasp);
|
||||
int width = re->scene->r.xsch;
|
||||
int height = re->scene->r.ysch;
|
||||
int height = (int)(((float)re->scene->r.ysch) * ycor);
|
||||
|
||||
freestyle_viewport[0] = freestyle_viewport[1] = 0;
|
||||
freestyle_viewport[2] = width;
|
||||
@@ -168,10 +169,12 @@ extern "C" {
|
||||
rl = render_get_active_layer( freestyle_render, freestyle_render->result );
|
||||
if( !rl || rl->rectf == NULL) { cout << "Cannot find Freestyle result image" << endl; return; }
|
||||
src = rl->rectf;
|
||||
//cout << "src: " << rl->rectx << " x " << rl->recty << endl;
|
||||
|
||||
rl = RE_GetRenderLayer(re->result, srl->name);
|
||||
if( !rl || rl->rectf == NULL) { cout << "No layer to composite to" << endl; return; }
|
||||
dest = rl->rectf;
|
||||
//cout << "dest: " << rl->rectx << " x " << rl->recty << endl;
|
||||
|
||||
rectx = re->rectx;
|
||||
recty = re->recty;
|
||||
|
||||
Reference in New Issue
Block a user