#include <sc_store.h>

Public Types

enum  Projection : uint32_t { Invalid = 0, Perspective, Orthographic, Stretched }
 

Public Member Functions

 Camera ()
 
 Camera (Projection projection, DPoint const &position, DPoint const &target, DVector const &up_vector, double field_width, double field_height)
 
bool operator!= (Camera const &that) const
 
bool operator== (Camera const &that) const
 

Public Attributes

double field_height
 Sets the height of the camera field in world space units. More...
 
double field_width
 Sets the width of the camera field in world space units. More...
 
DPoint position
 The location of the camera. More...
 
Projection projection
 Enum that specifies the projection type. More...
 
DPoint target
 Sets the location where the camera is pointing. More...
 
DVector up_vector
 Defines the vertical up vector of the camera. More...
 

Detailed Description

The Camera class is used to define a camera for a View. It specifies the position, target, up vector, field dimensions, and projection type.


The field of view of the camera is comprised of two numbers, field_width and field_height. These define the minimum area around the target that will be visible in the output window. The camera field, along with the distance between the camera position and the camera target, determine - in photographic terms - what kind of lens the camera is using. If the field is larger than the distance from the camera position to the target, then we have the equivalent of a wide-angle lens. If the distance between the camera position and target is much larger than the camera field, then we have the equivalent of a telephoto lens. Changing the size of the field (if the camera position and target remain fixed) is the same as zooming the lens. The ratio of the width to the height of the field is called the aspect ratio.

Member Enumeration Documentation

◆ Projection

An enumeration that indicates a camera's projection type.

Enumerator
Invalid 

This means the Camera Projection has not been set, and is effectively like having no Camera at all.

Perspective 

Objects diminish in size the further they are from the camera, just as in a typical photograph.

Orthographic 

Objects remain the same size, regardless of their distance from the camera.

Stretched 

With a stretched projection, the scene stretches to fit the output window. The aspect ratio will not be preserved and the output may appear stretched or distorted.

Constructor & Destructor Documentation

◆ Camera() [1/2]

SC::Store::Camera::Camera ( )

◆ Camera() [2/2]

SC::Store::Camera::Camera ( Projection  projection,
DPoint const &  position,
DPoint const &  target,
DVector const &  up_vector,
double  field_width,
double  field_height 
)

Member Function Documentation

◆ operator!=()

bool SC::Store::Camera::operator!= ( Camera const &  that) const

◆ operator==()

bool SC::Store::Camera::operator== ( Camera const &  that) const

Member Data Documentation

◆ field_height

double SC::Store::Camera::field_height

Sets the height of the camera field in world space units.

◆ field_width

double SC::Store::Camera::field_width

Sets the width of the camera field in world space units.

◆ position

DPoint SC::Store::Camera::position

The location of the camera.

◆ projection

Projection SC::Store::Camera::projection

Enum that specifies the projection type.

◆ target

DPoint SC::Store::Camera::target

Sets the location where the camera is pointing.

◆ up_vector

DVector SC::Store::Camera::up_vector

Defines the vertical up vector of the camera.