Program Listing for File camera.h#

Return to documentation for file (public/camera.h)

#ifndef f3d_camera_h
#define f3d_camera_h

#include "export.h"
#include "types.h"

#include <array>
#include <string>

namespace f3d
{
struct F3D_EXPORT camera_state_t
{
  point3_t pos = { 0., 0., 1. };
  point3_t foc = { 0., 0., 0. };
  vector3_t up = { 0., 1., 0. };
  angle_deg_t angle = 30.;
};

class F3D_EXPORT camera
{
public:

  virtual camera& setPosition(const point3_t& pos) = 0;
  virtual point3_t getPosition() = 0;
  virtual void getPosition(point3_t& pos) = 0;
  virtual camera& setFocalPoint(const point3_t& foc) = 0;
  virtual point3_t getFocalPoint() = 0;
  virtual void getFocalPoint(point3_t& foc) = 0;
  virtual camera& setViewUp(const vector3_t& up) = 0;
  virtual vector3_t getViewUp() = 0;
  virtual void getViewUp(vector3_t& up) = 0;
  virtual camera& setViewAngle(const angle_deg_t& angle) = 0;
  virtual angle_deg_t getViewAngle() = 0;
  virtual void getViewAngle(angle_deg_t& angle) = 0;
  virtual camera& setState(const camera_state_t& state) = 0;
  virtual camera_state_t getState() = 0;
  virtual void getState(camera_state_t& state) = 0;


  virtual camera& dolly(double val) = 0;
  virtual camera& pan(double right, double up, double forward = 0) = 0;
  virtual camera& zoom(double factor) = 0;
  virtual camera& roll(angle_deg_t angle) = 0;
  virtual camera& azimuth(angle_deg_t angle) = 0;
  virtual camera& yaw(angle_deg_t angle) = 0;
  virtual camera& elevation(angle_deg_t angle) = 0;
  virtual camera& pitch(angle_deg_t angle) = 0;


  virtual camera& setCurrentAsDefault() = 0;

  virtual camera& resetToDefault() = 0;

  virtual camera& resetToBounds(double zoomFactor = 0.9) = 0;

protected:
  camera() = default;
  virtual ~camera() = default;
  camera(const camera&) = delete;
  camera(camera&&) = delete;
  camera& operator=(const camera&) = delete;
  camera& operator=(camera&&) = delete;
};
}

#endif