Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2014-02-14 21:40:31 +0400
committerThomas Dinges <blender@dingto.org>2014-02-14 21:40:31 +0400
commit8cc925a21664698fd88bdd58db93ae5bd922cec3 (patch)
treec151cf2472f6de1c6cbe4c36c40ca2c0910c756e /intern/cycles/app
parent2bf591762ad9817b0145acd9645041a495986370 (diff)
Cycles Standalone: The camera now gets properly updated, when changing window size or using --width --height overwrites.
Diffstat (limited to 'intern/cycles/app')
-rw-r--r--intern/cycles/app/cycles_standalone.cpp28
-rw-r--r--intern/cycles/app/cycles_xml.cpp16
2 files changed, 23 insertions, 21 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp
index 230833802b0..3ec92a2aa00 100644
--- a/intern/cycles/app/cycles_standalone.cpp
+++ b/intern/cycles/app/cycles_standalone.cpp
@@ -114,15 +114,25 @@ static void session_init()
options.scene = NULL;
}
-static void scene_init(int width, int height)
+static void scene_init()
{
options.scene = new Scene(options.scene_params, options.session_params.device);
+
+ /* Read XML */
xml_read_file(options.scene, options.filepath.c_str());
- if (width == 0 || height == 0) {
+ /* Camera width/height override? */
+ if (!(options.width == 0 || options.height == 0)) {
+ options.scene->camera->width = options.width;
+ options.scene->camera->height = options.height;
+ }
+ else {
options.width = options.scene->camera->width;
options.height = options.scene->camera->height;
}
+
+ /* Calculate Viewplane */
+ options.scene->camera->compute_auto_viewplane();
}
static void session_exit()
@@ -216,8 +226,16 @@ static void resize(int width, int height)
options.width = width;
options.height = height;
- if(options.session)
+ if(options.session) {
+ /* Update camera */
+ options.session->scene->camera->width = width;
+ options.session->scene->camera->height = height;
+ options.session->scene->camera->compute_auto_viewplane();
+ options.session->scene->camera->need_update = true;
+ options.session->scene->camera->need_device_update = true;
+
options.session->reset(session_buffer_params(), options.session_params.samples);
+ }
}
static void keyboard(unsigned char key)
@@ -360,12 +378,12 @@ static void options_parse(int argc, const char **argv)
fprintf(stderr, "No file path specified\n");
exit(EXIT_FAILURE);
}
-
+
/* For smoother Viewport */
options.session_params.start_resolution = 64;
/* load scene */
- scene_init(options.width, options.height);
+ scene_init();
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 14fe43115d5..f30e399350a 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -289,21 +289,6 @@ static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
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"))
cam->fov *= M_PI/180.0f;
@@ -333,7 +318,6 @@ static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
xml_read_float(&cam->sensorwidth, node, "sensorwidth");
xml_read_float(&cam->sensorheight, node, "sensorheight");
-
cam->matrix = state.tfm;
cam->need_update = true;