Cycles Standalone: Various changes
* Change Info in header, put more important info to the left * API: Move Camera width/height to camera, add some film properties * Add ESC key to help menu
This commit is contained in:
@@ -163,8 +163,8 @@ static void display_info(Progress& progress)
|
|||||||
if(substatus != "")
|
if(substatus != "")
|
||||||
status += ": " + substatus;
|
status += ": " + substatus;
|
||||||
|
|
||||||
str = string_printf("latency: %.4f sample: %d total: %.4f average: %.4f %s",
|
str = string_printf("%s Time: %.2f Latency: %.4f Sample: %d Average: %.4f",
|
||||||
latency, sample, total_time, sample_time, status.c_str());
|
status.c_str(), total_time, latency, sample, sample_time);
|
||||||
|
|
||||||
view_display_info(str.c_str());
|
view_display_info(str.c_str());
|
||||||
|
|
||||||
@@ -313,11 +313,11 @@ static void options_parse(int argc, const char **argv)
|
|||||||
fprintf(stderr, "Unknown shading system: %s\n", ssname.c_str());
|
fprintf(stderr, "Unknown shading system: %s\n", ssname.c_str());
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if(options.scene_params.shadingsystem == SceneParams::OSL && options.session_params.device.type != DEVICE_CPU) {
|
else if(options.scene_params.shadingsystem == SceneParams::OSL && options.session_params.device.type != DEVICE_CPU) {
|
||||||
fprintf(stderr, "OSL shading system only works with CPU device\n");
|
fprintf(stderr, "OSL shading system only works with CPU device\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else if(options.session_params.samples < 0) {
|
else if(options.session_params.samples < 0) {
|
||||||
fprintf(stderr, "Invalid number of samples: %d\n", options.session_params.samples);
|
fprintf(stderr, "Invalid number of samples: %d\n", options.session_params.samples);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@@ -223,28 +223,12 @@ static bool xml_read_enum(ustring *str, ShaderEnum& enm, pugi::xml_node node, co
|
|||||||
|
|
||||||
static void xml_read_film(const XMLReadState& state, pugi::xml_node node)
|
static void xml_read_film(const XMLReadState& state, pugi::xml_node node)
|
||||||
{
|
{
|
||||||
Camera *cam = state.scene->camera;
|
Film *film = state.scene->film;
|
||||||
|
|
||||||
|
xml_read_float(&film->exposure, node, "exposure");
|
||||||
|
|
||||||
xml_read_int(&cam->width, node, "width");
|
/* ToDo: Filter Type */
|
||||||
xml_read_int(&cam->height, node, "height");
|
xml_read_float(&film->filter_width, node, "filter_width");
|
||||||
|
|
||||||
float aspect = (float)cam->width/(float)cam->height;
|
|
||||||
|
|
||||||
if(cam->width >= cam->height) {
|
|
||||||
cam->viewplane.left = -aspect;
|
|
||||||
cam->viewplane.right = aspect;
|
|
||||||
cam->viewplane.bottom = -1.0f;
|
|
||||||
cam->viewplane.top = 1.0f;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cam->viewplane.left = -1.0f;
|
|
||||||
cam->viewplane.right = 1.0f;
|
|
||||||
cam->viewplane.bottom = -1.0f/aspect;
|
|
||||||
cam->viewplane.top = 1.0f/aspect;
|
|
||||||
}
|
|
||||||
|
|
||||||
cam->need_update = true;
|
|
||||||
cam->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Integrator */
|
/* Integrator */
|
||||||
@@ -301,6 +285,24 @@ static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
|
|||||||
{
|
{
|
||||||
Camera *cam = state.scene->camera;
|
Camera *cam = state.scene->camera;
|
||||||
|
|
||||||
|
xml_read_int(&cam->width, node, "width");
|
||||||
|
xml_read_int(&cam->height, node, "height");
|
||||||
|
|
||||||
|
float aspect = (float)cam->width/(float)cam->height;
|
||||||
|
|
||||||
|
if(cam->width >= cam->height) {
|
||||||
|
cam->viewplane.left = -aspect;
|
||||||
|
cam->viewplane.right = aspect;
|
||||||
|
cam->viewplane.bottom = -1.0f;
|
||||||
|
cam->viewplane.top = 1.0f;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cam->viewplane.left = -1.0f;
|
||||||
|
cam->viewplane.right = 1.0f;
|
||||||
|
cam->viewplane.bottom = -1.0f/aspect;
|
||||||
|
cam->viewplane.top = 1.0f/aspect;
|
||||||
|
}
|
||||||
|
|
||||||
if(xml_read_float(&cam->fov, node, "fov"))
|
if(xml_read_float(&cam->fov, node, "fov"))
|
||||||
cam->fov *= M_PI/180.0f;
|
cam->fov *= M_PI/180.0f;
|
||||||
|
|
||||||
|
@@ -78,19 +78,19 @@ void view_display_help()
|
|||||||
{
|
{
|
||||||
const int w = V.width / 1.15;
|
const int w = V.width / 1.15;
|
||||||
const int h = V.height / 1.15;
|
const int h = V.height / 1.15;
|
||||||
|
|
||||||
const int x1 = (V.width - w) / 2;
|
const int x1 = (V.width - w) / 2;
|
||||||
const int x2 = x1 + w;
|
const int x2 = x1 + w;
|
||||||
|
|
||||||
const int y1 = (V.height - h) / 2;
|
const int y1 = (V.height - h) / 2;
|
||||||
const int y2 = y1 + h;
|
const int y2 = y1 + h;
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glColor4f(0.4f, 0.4f, 0.4f, 0.8f);
|
glColor4f(0.5f, 0.5f, 0.5f, 0.8f);
|
||||||
glRectf(x1, y1, x2, y2);
|
glRectf(x1, y1, x2, y2);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
glColor3f(0.8f, 0.8f, 0.8f);
|
glColor3f(0.8f, 0.8f, 0.8f);
|
||||||
|
|
||||||
view_display_text(x1+20, y2-20, "Cycles Renderer");
|
view_display_text(x1+20, y2-20, "Cycles Renderer");
|
||||||
@@ -99,7 +99,8 @@ void view_display_help()
|
|||||||
view_display_text(x1+20, y2-100, "h: Toggle this help message");
|
view_display_text(x1+20, y2-100, "h: Toggle this help message");
|
||||||
view_display_text(x1+20, y2-120, "r: Restart the render");
|
view_display_text(x1+20, y2-120, "r: Restart the render");
|
||||||
view_display_text(x1+20, y2-140, "q: Quit the program");
|
view_display_text(x1+20, y2-140, "q: Quit the program");
|
||||||
|
view_display_text(x1+20, y2-160, "esc: Cancel the render");
|
||||||
|
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user