Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add scene variables 'image_start_column', 'image_end_column, 'image_s… #311

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions vfe/vfe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,21 +636,58 @@ bool VirtualFrontEnd::Start(POVMS_Object& opts)
if(opts.Exist(kPOVAttrib_Declare) == true)
opts.Get(kPOVAttrib_Declare, declares);

float width = (float)opts.TryGetInt(kPOVAttrib_Width, 160);
float height = (float)opts.TryGetInt(kPOVAttrib_Height, 120);

POVMS_Object image_width(kPOVMSType_WildCard);
image_width.SetString(kPOVAttrib_Identifier, "image_width");
image_width.SetFloat(kPOVAttrib_Value, opts.TryGetInt(kPOVAttrib_Width, 160));
image_width.SetFloat(kPOVAttrib_Value, width);
declares.Append(image_width);

POVMS_Object image_height(kPOVMSType_WildCard);
image_height.SetString(kPOVAttrib_Identifier, "image_height");
image_height.SetFloat(kPOVAttrib_Value, opts.TryGetInt(kPOVAttrib_Height, 120));
image_height.SetFloat(kPOVAttrib_Value, height);
declares.Append(image_height);

POVMS_Object input_file_name(kPOVMSType_WildCard);
input_file_name.SetString(kPOVAttrib_Identifier, "input_file_name");
input_file_name.SetString(kPOVAttrib_Value, UCS2toASCIIString(ip.GetFile()).c_str());
declares.Append(input_file_name);

float start_column = opts.TryGetFloat(kPOVAttrib_StartColumn, 0.0);
float end_column = opts.TryGetFloat(kPOVAttrib_EndColumn, 1.0);
float start_row = opts.TryGetFloat(kPOVAttrib_StartRow, 0.0);
float end_row = opts.TryGetFloat(kPOVAttrib_EndRow, 1.0);

if(start_column >= 1.0)
start_column = (int)start_column / width;
if(end_column > 1.0)
end_column = (int)end_column / width;
if(start_row >= 1.0)
start_row = (int)start_row / height;
if(end_row > 1.0)
end_row = (int)end_row / height;

POVMS_Object image_start_column(kPOVMSType_WildCard);
image_start_column.SetString(kPOVAttrib_Identifier, "image_start_column");
image_start_column.SetFloat(kPOVAttrib_Value, start_column);
declares.Append(image_start_column);

POVMS_Object image_end_column(kPOVMSType_WildCard);
image_end_column.SetString(kPOVAttrib_Identifier, "image_end_column");
image_end_column.SetFloat(kPOVAttrib_Value, end_column);
declares.Append(image_end_column);

POVMS_Object image_start_row(kPOVMSType_WildCard);
image_start_row.SetString(kPOVAttrib_Identifier, "image_start_row");
image_start_row.SetFloat(kPOVAttrib_Value, start_row);
declares.Append(image_start_row);

POVMS_Object image_end_row(kPOVMSType_WildCard);
image_end_row.SetString(kPOVAttrib_Identifier, "image_end_row");
image_end_row.SetFloat(kPOVAttrib_Value, end_row);
declares.Append(image_end_row);

int initialFrame = opts.TryGetInt (kPOVAttrib_InitialFrame, 0) ;
int finalFrame = opts.TryGetInt (kPOVAttrib_FinalFrame, 0) ;
if ((initialFrame == 0 && finalFrame == 0) || (initialFrame == 1 && finalFrame == 1))
Expand Down