Skip to content

Commit

Permalink
Change folder name
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsy committed Apr 16, 2015
1 parent 178d3be commit f1544fa
Show file tree
Hide file tree
Showing 2 changed files with 210 additions and 0 deletions.
111 changes: 111 additions & 0 deletions src/renderer/Camera.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#define SPICA_CAMERA_EXPORT
#include "Camera.h"

namespace spica {

// ------------------------------------------------------------
// Image sensor
// ------------------------------------------------------------

ImageSensor::ImageSensor()
: _width(0.0)
, _height(0.0)
, _center()
, _direction()
, _up()
, _u()
, _v()
, _sensitivity(0.0)
{
}

ImageSensor::ImageSensor(double width, double height, Vector3 center, Vector3 direction, Vector3 up, Vector3 u, Vector3 v, double sensitivity)
: _width(width)
, _height(height)
, _center(center)
, _direction(direction)
, _up(up)
, _u(u)
, _v(v)
, _sensitivity(sensitivity)
{
}

ImageSensor::ImageSensor(const ImageSensor& sensor)
: _width(sensor._width)
, _height(sensor._height)
, _center(sensor._center)
, _direction(sensor._direction)
, _up(sensor._up)
, _u(sensor._u)
, _v(sensor._v)
, _sensitivity(sensor._sensitivity)
{
}

ImageSensor::~ImageSensor()
{
}

ImageSensor& ImageSensor::operator=(const ImageSensor& sensor) {
this->_width = sensor._width;
this->_height = sensor._height;
this->_center = sensor._center;
this->_direction = sensor._direction;
this->_up = sensor._up;
this->_u = sensor._u;
this->_v = sensor._v;
this->_sensitivity = sensor._sensitivity;
return *this;
}


// ------------------------------------------------------------
// Lens
// ------------------------------------------------------------

Lens::Lens()
: _focalLength(0.0)
, _radius(0.0)
, _center()
, _u()
, _v()
, _normal()
{
}

Lens::Lens(double focalLength, double radius, Vector3 center, Vector3 u, Vector3 v, Vector3 normal)
: _focalLength(focalLength)
, _radius(radius)
, _center(center)
, _u(u)
, _v(v)
, _normal(normal)
{
}

Lens::Lens(const Lens& lens)
: _focalLength(lens._focalLength)
, _radius(lens._radius)
, _center(lens._center)
, _u(lens._u)
, _v(lens._v)
, _normal(lens._normal)
{
}

Lens::~Lens()
{
}

Lens& Lens::operator=(const Lens& lens) {
this->_focalLength = lens._focalLength;
this->_radius = lens._radius;
this->_center = lens._center;
this->_u = lens._u;
this->_v = lens._v;
this->_normal = lens._normal;
return *this;
}
}

99 changes: 99 additions & 0 deletions src/renderer/Camera.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#ifndef SPICA_CAMERA_H_
#define SPICA_CAMERA_H_

#if defined(_WIN32) || defined(__WIN32__)
#ifdef SPICA_CAMERA_EXPORT
#define SPICA_CAMERA_DLL __declspec(dllexport)
#else
#define SPICA_CAMERA_DLL __declspec(dllimport)
#endif
#elif defined(linux) || defined(__linux)
#define SPICA_CAMERA_DLL
#endif

#include "../utils/Image.h"

namespace spica {

// ------------------------------------------------------------
// Image sensor
// ------------------------------------------------------------

class SPICA_CAMERA_DLL ImageSensor {
private:
double _width;
double _height;
Vector3 _center;
Vector3 _direction;
Vector3 _up;
Vector3 _u;
Vector3 _v;
double _sensitivity;

public:
ImageSensor();
ImageSensor(double width, double height, Vector3 center, Vector3 direction, Vector3 up, Vector3 u, Vector3 v, double sensitivity);
ImageSensor(const ImageSensor& sensor);

~ImageSensor();

ImageSensor& operator=(const ImageSensor& sensor);

inline double width() const { return _width; }
inline double height() const { return _height; }
inline Vector3 center() const { return _center; }
inline Vector3 direction() const { return _direction; }
inline Vector3 u() const { return _u; }
inline Vector3 v() const { return _v; }
};


// ------------------------------------------------------------
// Lens
// ------------------------------------------------------------

class Lens {
private:
double _focalLength;
double _radius;
Vector3 _center;
Vector3 _u;
Vector3 _v;
Vector3 _normal;

public:
Lens();
Lens(double focalLength, double radius, Vector3 center, Vector3 u, Vector3 v, Vector3 normal);
Lens(const Lens& lens);

~Lens();

Lens& operator=(const Lens& lens);
};


// ------------------------------------------------------------
// Camera
// ------------------------------------------------------------

class Camera {
private:
// Image size
int _width;
int _height;

// Image sensor parameters
ImageSensor _sensor;

// Lens parameters
Lens _lens;

// Object plane
Vector3 _objPlaneCenter;
Vector3 _objPlaneU;
Vector3 _objPlaneV;
};

}

#endif // SPICA_CAMERA_H_

0 comments on commit f1544fa

Please sign in to comment.