Blender V4.3
scene/camera.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#ifndef __CAMERA_H__
6#define __CAMERA_H__
7
8#include "kernel/types.h"
9
10#include "graph/node.h"
11
12#include "util/array.h"
13#include "util/boundbox.h"
14#include "util/projection.h"
15#include "util/transform.h"
16#include "util/types.h"
17
19
20class Device;
21class DeviceScene;
22class Scene;
23
24/* Camera
25 *
26 * The camera parameters are quite standard, tested to be both compatible with
27 * Renderman, and Blender after remapping.
28 */
29
30class Camera : public Node {
31 public:
33
34 /* Specifies rolling shutter effect. */
36 /* No rolling shutter effect. */
38 /* Sensor is being scanned vertically from top to bottom. */
40
42 };
43
44 /* Stereo Type */
50
51 /* motion blur */
52 NODE_SOCKET_API(float, shuttertime)
53 NODE_SOCKET_API(MotionPosition, motion_position)
56
57 /* ** Rolling shutter effect. ** */
58 /* Defines rolling shutter effect type. */
59 NODE_SOCKET_API(RollingShutterType, rolling_shutter_type)
60 /* Specifies exposure time of scan-lines when using
61 * rolling shutter effect.
62 */
63 NODE_SOCKET_API(float, rolling_shutter_duration)
64
65 /* depth of field */
66 NODE_SOCKET_API(float, focaldistance)
67 NODE_SOCKET_API(float, aperturesize)
68 NODE_SOCKET_API(uint, blades)
69 NODE_SOCKET_API(float, bladesrotation)
70
71 /* type */
72 NODE_SOCKET_API(CameraType, camera_type)
73 NODE_SOCKET_API(float, fov)
74
75 /* panorama */
83
89
94
95 /* panorama stereo */
96 NODE_SOCKET_API(StereoEye, stereo_eye)
97 NODE_SOCKET_API(bool, use_spherical_stereo)
98 NODE_SOCKET_API(float, interocular_distance)
99 NODE_SOCKET_API(float, convergence_distance)
100 NODE_SOCKET_API(bool, use_pole_merge)
101 NODE_SOCKET_API(float, pole_merge_angle_from)
102 NODE_SOCKET_API(float, pole_merge_angle_to)
103
104 /* anamorphic lens bokeh */
105 NODE_SOCKET_API(float, aperture_ratio)
106
107 /* sensor */
108 NODE_SOCKET_API(float, sensorwidth)
109 NODE_SOCKET_API(float, sensorheight)
110
111 /* clipping */
112 NODE_SOCKET_API(float, nearclip)
113 NODE_SOCKET_API(float, farclip)
114
115 /* screen */
121
122 /* width and height change during preview, so we need these for calculating dice rates. */
123 NODE_SOCKET_API(int, full_width)
124 NODE_SOCKET_API(int, full_height)
125 /* controls how fast the dicing rate falls off for geometry out side of view */
126 NODE_SOCKET_API(float, offscreen_dicing_scale)
127
128 /* border */
134
140
141 /* transformation */
143
144 /* motion */
146 NODE_SOCKET_API(bool, use_perspective_motion)
147 NODE_SOCKET_API(float, fov_pre)
148 NODE_SOCKET_API(float, fov_post)
149
150 /* computed camera parameters */
155
160
162
164
167
170
175
176 /* update */
180
181 /* Kernel camera data, copied here for dicing. */
184
185 private:
186 int width;
187 int height;
188
189 public:
190 /* functions */
191 Camera();
192 ~Camera();
193
195
196 void update(Scene *scene);
197
198 void device_update(Device *device, DeviceScene *dscene, Scene *scene);
199 void device_update_volume(Device *device, DeviceScene *dscene, Scene *scene);
200 void device_free(Device *device, DeviceScene *dscene, Scene *scene);
201
202 /* Public utility functions. */
204
205 /* Calculates the width of a pixel at point in world space. */
207
208 /* Motion blur. */
209 float motion_time(int step) const;
210 int motion_step(float time) const;
211 bool use_motion() const;
212
213 void set_screen_size(int width_, int height_);
214
215 private:
216 /* Private utility functions. */
217 float3 transform_raster_to_world(float raster_x, float raster_y);
218};
219
221
222#endif /* __CAMERA_H__ */
unsigned int uint
#define CCL_NAMESPACE_END
#define NODE_SOCKET_API_STRUCT_MEMBER(type_, name, member)
Definition graph/node.h:76
#define NODE_SOCKET_API_ARRAY(type_, name)
Definition graph/node.h:63
#define NODE_SOCKET_API(type_, name)
Definition graph/node.h:55
MotionPosition
PanoramaType
CameraType
#define NODE_DECLARE
Definition node_type.h:142
bool need_device_update
char panorama_type
ProjectionTransform worldtoraster
RollingShutterType
@ ROLLING_SHUTTER_NUM_TYPES
@ ROLLING_SHUTTER_NONE
@ ROLLING_SHUTTER_TOP
float3 frustum_right_normal
BoundBox2D viewplane
void set_screen_size(int width_, int height_)
int previous_need_motion
float3 full_dy
bool need_flags_update
float latitude_max
float3 full_dx
ProjectionTransform rastertoworld
BoundBox viewplane_bounds_get()
float central_cylindrical_range_v_min
Transform worldtocamera
float fisheye_polynomial_k3
ProjectionTransform worldtoscreen
ProjectionTransform worldtondc
float longitude_max
float motion_time(int step) const
float central_cylindrical_range_u_min
void update(Scene *scene)
ProjectionTransform rastertocamera
BoundBox2D border
float fisheye_polynomial_k1
float central_cylindrical_range_u_max
float latitude_min
ProjectionTransform screentoworld
float fisheye_polynomial_k2
bool use_motion() const
size_t shutter_table_offset
void device_update_volume(Device *device, DeviceScene *dscene, Scene *scene)
void device_free(Device *device, DeviceScene *dscene, Scene *scene)
ProjectionTransform ndctoworld
float3 dx
void device_update(Device *device, DeviceScene *dscene, Scene *scene)
float3 frustum_left_normal
float fisheye_fov
float world_to_raster_size(float3 P)
Transform cameratoworld
int motion_step(float time) const
float fisheye_polynomial_k0
void compute_auto_viewplane()
float3 frustum_top_normal
float fisheye_polynomial_k4
ProjectionTransform full_rastertocamera
float3 frustum_bottom_normal
float fisheye_lens
float3 dy
@ STEREO_LEFT
@ STEREO_NONE
@ STEREO_RIGHT
BoundBox2D viewport_camera_border
KernelCamera kernel_camera
float central_cylindrical_range_v_max
float longitude_min
array< DecomposedTransform > kernel_camera_motion