2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CAMERA_H__
|
|
|
|
#define __CAMERA_H__
|
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
#include "kernel_types.h"
|
|
|
|
|
2012-11-10 22:31:29 +00:00
|
|
|
#include "util_boundbox.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
#include "util_transform.h"
|
|
|
|
#include "util_types.h"
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
class DeviceScene;
|
2012-04-30 12:49:26 +00:00
|
|
|
class Scene;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
/* Camera
|
|
|
|
*
|
|
|
|
* The camera parameters are quite standard, tested to be both compatible with
|
|
|
|
* Renderman, and Blender after remapping. */
|
|
|
|
|
|
|
|
class Camera {
|
|
|
|
public:
|
|
|
|
/* motion blur */
|
2012-04-30 12:49:26 +00:00
|
|
|
float shuttertime;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
/* depth of field */
|
|
|
|
float focaldistance;
|
2011-09-16 13:14:02 +00:00
|
|
|
float aperturesize;
|
|
|
|
uint blades;
|
|
|
|
float bladesrotation;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
/* type */
|
|
|
|
CameraType type;
|
2011-04-27 11:58:34 +00:00
|
|
|
float fov;
|
|
|
|
|
2012-05-04 16:20:51 +00:00
|
|
|
/* panorama */
|
|
|
|
PanoramaType panorama_type;
|
|
|
|
float fisheye_fov;
|
|
|
|
float fisheye_lens;
|
|
|
|
|
|
|
|
/* sensor */
|
|
|
|
float sensorwidth;
|
|
|
|
float sensorheight;
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* clipping */
|
|
|
|
float nearclip;
|
|
|
|
float farclip;
|
|
|
|
|
|
|
|
/* screen */
|
|
|
|
int width, height;
|
2013-04-15 21:38:31 +00:00
|
|
|
int resolution;
|
2012-11-10 22:31:29 +00:00
|
|
|
BoundBox2D viewplane;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2012-06-06 23:27:43 +00:00
|
|
|
/* border */
|
2012-11-10 22:31:29 +00:00
|
|
|
BoundBox2D border;
|
2012-06-06 23:27:43 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* transformation */
|
|
|
|
Transform matrix;
|
|
|
|
|
2012-04-30 12:49:26 +00:00
|
|
|
/* motion */
|
|
|
|
MotionTransform motion;
|
|
|
|
bool use_motion;
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* computed camera parameters */
|
2012-06-09 18:56:12 +00:00
|
|
|
Transform screentoworld;
|
2011-04-27 11:58:34 +00:00
|
|
|
Transform rastertoworld;
|
|
|
|
Transform ndctoworld;
|
|
|
|
Transform cameratoworld;
|
2012-11-21 01:00:03 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
Transform worldtoraster;
|
2012-11-21 01:00:03 +00:00
|
|
|
Transform worldtoscreen;
|
|
|
|
Transform worldtondc;
|
|
|
|
Transform worldtocamera;
|
|
|
|
|
|
|
|
Transform rastertocamera;
|
2013-01-20 14:50:50 +00:00
|
|
|
Transform cameratoraster;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
float3 dx;
|
|
|
|
float3 dy;
|
|
|
|
|
|
|
|
/* update */
|
|
|
|
bool need_update;
|
|
|
|
bool need_device_update;
|
2012-09-04 13:29:07 +00:00
|
|
|
int previous_need_motion;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
/* functions */
|
|
|
|
Camera();
|
|
|
|
~Camera();
|
|
|
|
|
|
|
|
void update();
|
|
|
|
|
2012-04-30 12:49:26 +00:00
|
|
|
void device_update(Device *device, DeviceScene *dscene, Scene *scene);
|
2011-04-27 11:58:34 +00:00
|
|
|
void device_free(Device *device, DeviceScene *dscene);
|
|
|
|
|
|
|
|
bool modified(const Camera& cam);
|
2012-10-15 21:12:58 +00:00
|
|
|
bool motion_modified(const Camera& cam);
|
2011-04-27 11:58:34 +00:00
|
|
|
void tag_update();
|
|
|
|
};
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif /* __CAMERA_H__ */
|
|
|
|
|