Add constructors to camera classes
This commit is contained in:
parent
9b8026d5ba
commit
6eacee38f0
1 changed files with 41 additions and 0 deletions
|
|
@ -41,6 +41,13 @@ namespace psemek::geom
|
|||
{
|
||||
float width, height;
|
||||
|
||||
window_camera() = default;
|
||||
|
||||
window_camera(float width, float height)
|
||||
: width{width}
|
||||
, height{height}
|
||||
{}
|
||||
|
||||
matrix<float, 4, 4> view() const override;
|
||||
matrix<float, 4, 4> projection() const override;
|
||||
};
|
||||
|
|
@ -50,6 +57,12 @@ namespace psemek::geom
|
|||
{
|
||||
geom::box<float_t, 3> box;
|
||||
|
||||
orthographic_camera() = default;
|
||||
|
||||
orthographic_camera(geom::box<float_t, 3> const & box)
|
||||
: box{box}
|
||||
{}
|
||||
|
||||
matrix<float, 4, 4> view() const override;
|
||||
matrix<float, 4, 4> projection() const override;
|
||||
};
|
||||
|
|
@ -63,6 +76,15 @@ namespace psemek::geom
|
|||
float near_clip;
|
||||
float far_clip;
|
||||
|
||||
perspective_camera() = default;
|
||||
|
||||
perspective_camera(float fov_x, float fov_y, float near_clip, float far_clip)
|
||||
: fov_x{fov_x}
|
||||
, fov_y{fov_y}
|
||||
, near_clip{near_clip}
|
||||
, far_clip{far_clip}
|
||||
{}
|
||||
|
||||
matrix<float, 4, 4> projection() const override;
|
||||
|
||||
// aspect_ratio = width / height
|
||||
|
|
@ -90,6 +112,16 @@ namespace psemek::geom
|
|||
float distance;
|
||||
point<float, 3> target;
|
||||
|
||||
spherical_camera() = default;
|
||||
|
||||
spherical_camera(float fov_x, float fov_y, float near_clip, float far_clip, float azimuthal_angle, float elevation_angle, float distance, point<float, 3> const & target)
|
||||
: perspective_camera(fov_x, fov_y, near_clip, far_clip)
|
||||
, azimuthal_angle{azimuthal_angle}
|
||||
, elevation_angle{elevation_angle}
|
||||
, distance{distance}
|
||||
, target{target}
|
||||
{}
|
||||
|
||||
matrix<float, 4, 4> view() const override;
|
||||
};
|
||||
|
||||
|
|
@ -104,6 +136,15 @@ namespace psemek::geom
|
|||
float elevation_angle;
|
||||
point<float, 3> pos;
|
||||
|
||||
free_camera() = default;
|
||||
|
||||
free_camera(float fov_x, float fov_y, float near_clip, float far_clip, float azimuthal_angle, float elevation_angle, point<float, 3> const & pos)
|
||||
: perspective_camera(fov_x, fov_y, near_clip, far_clip)
|
||||
, azimuthal_angle{azimuthal_angle}
|
||||
, elevation_angle{elevation_angle}
|
||||
, pos{pos}
|
||||
{}
|
||||
|
||||
matrix<float, 4, 4> view() const override;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue