Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/camera.cpp
| Show All 27 Lines | |||||
| #include "util/util_logging.h" | #include "util/util_logging.h" | ||||
| #include "util/util_math_cdf.h" | #include "util/util_math_cdf.h" | ||||
| #include "util/util_task.h" | #include "util/util_task.h" | ||||
| #include "util/util_time.h" | #include "util/util_time.h" | ||||
| #include "util/util_vector.h" | #include "util/util_vector.h" | ||||
| /* needed for calculating differentials */ | /* needed for calculating differentials */ | ||||
| // clang-format off | // clang-format off | ||||
| #include "kernel/kernel_compat_cpu.h" | #include "kernel/device/cpu/compat.h" | ||||
| #include "kernel/split/kernel_split_data.h" | #include "kernel/device/cpu/globals.h" | ||||
| #include "kernel/kernel_globals.h" | |||||
| #include "kernel/kernel_projection.h" | #include "kernel/kernel_projection.h" | ||||
| #include "kernel/kernel_differential.h" | #include "kernel/kernel_differential.h" | ||||
| #include "kernel/kernel_montecarlo.h" | #include "kernel/kernel_montecarlo.h" | ||||
| #include "kernel/kernel_camera.h" | #include "kernel/kernel_camera.h" | ||||
| // clang-format on | // clang-format on | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| Camera::Camera() : Node(get_node_type()) | Camera::Camera() : Node(get_node_type()) | ||||
| { | { | ||||
| shutter_table_offset = TABLE_OFFSET_INVALID; | shutter_table_offset = TABLE_OFFSET_INVALID; | ||||
| width = 1024; | width = 1024; | ||||
| height = 512; | height = 512; | ||||
| resolution = 1; | |||||
| use_perspective_motion = false; | use_perspective_motion = false; | ||||
| shutter_curve.resize(RAMP_TABLE_SIZE); | shutter_curve.resize(RAMP_TABLE_SIZE); | ||||
| for (int i = 0; i < shutter_curve.size(); ++i) { | for (int i = 0; i < shutter_curve.size(); ++i) { | ||||
| shutter_curve[i] = 1.0f; | shutter_curve[i] = 1.0f; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | void Camera::update(Scene *scene) | ||||
| /* sensor size */ | /* sensor size */ | ||||
| kcam->sensorwidth = sensorwidth; | kcam->sensorwidth = sensorwidth; | ||||
| kcam->sensorheight = sensorheight; | kcam->sensorheight = sensorheight; | ||||
| /* render size */ | /* render size */ | ||||
| kcam->width = width; | kcam->width = width; | ||||
| kcam->height = height; | kcam->height = height; | ||||
| kcam->resolution = resolution; | |||||
| /* store differentials */ | /* store differentials */ | ||||
| kcam->dx = float3_to_float4(dx); | kcam->dx = float3_to_float4(dx); | ||||
| kcam->dy = float3_to_float4(dy); | kcam->dy = float3_to_float4(dy); | ||||
| /* clipping */ | /* clipping */ | ||||
| kcam->nearclip = nearclip; | kcam->nearclip = nearclip; | ||||
| kcam->cliplength = (farclip == FLT_MAX) ? FLT_MAX : farclip - nearclip; | kcam->cliplength = (farclip == FLT_MAX) ? FLT_MAX : farclip - nearclip; | ||||
| ▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | |||||
| # endif | # endif | ||||
| 0.5f * full_width, | 0.5f * full_width, | ||||
| 0.5f * full_height, | 0.5f * full_height, | ||||
| 0.0f, | 0.0f, | ||||
| 0.0f, | 0.0f, | ||||
| &ray); | &ray); | ||||
| #endif | #endif | ||||
| differential_transfer(&ray.dP, ray.dP, ray.D, ray.dD, ray.D, dist); | /* TODO: would it help to use more accurate differentials here? */ | ||||
| differential3 dP; | |||||
| differential_transfer_compact(&dP, ray.dP, ray.D, ray.dD, ray.D, dist); | |||||
| return max(len(ray.dP.dx), len(ray.dP.dy)); | return max(len(dP.dx), len(dP.dy)); | ||||
| } | } | ||||
| return res; | return res; | ||||
| } | } | ||||
| bool Camera::use_motion() const | bool Camera::use_motion() const | ||||
| { | { | ||||
| return motion.size() > 1; | return motion.size() > 1; | ||||
| } | } | ||||
| void Camera::set_screen_size_and_resolution(int width_, int height_, int resolution_) | void Camera::set_screen_size(int width_, int height_) | ||||
| { | { | ||||
| if (width_ != width || height_ != height || resolution_ != resolution) { | if (width_ != width || height_ != height) { | ||||
| width = width_; | width = width_; | ||||
| height = height_; | height = height_; | ||||
| resolution = resolution_; | |||||
| tag_modified(); | tag_modified(); | ||||
| } | } | ||||
| } | } | ||||
| float Camera::motion_time(int step) const | float Camera::motion_time(int step) const | ||||
| { | { | ||||
| return (use_motion()) ? 2.0f * step / (motion.size() - 1) - 1.0f : 0.0f; | return (use_motion()) ? 2.0f * step / (motion.size() - 1) - 1.0f : 0.0f; | ||||
| } | } | ||||
| Show All 15 Lines | |||||