ENABLE_6DOF_CAMERA set as default

This commit is contained in:
Enrico Turri 2020-02-13 12:13:54 +01:00
parent 904263d231
commit 847efec2ed
10 changed files with 63 additions and 396 deletions

View file

@ -30,20 +30,12 @@ struct Camera
Num_types
};
#if !ENABLE_6DOF_CAMERA
float phi;
bool inverted_phi;
#endif // !ENABLE_6DOF_CAMERA
bool requires_zoom_to_bed;
private:
EType m_type;
Vec3d m_target;
#if ENABLE_6DOF_CAMERA
float m_zenit;
#else
float m_theta;
#endif // ENABLE_6DOF_CAMERA
double m_zoom;
// Distance between camera position and camera target measured along the camera Z axis
mutable double m_distance;
@ -69,18 +61,9 @@ public:
const Vec3d& get_target() const { return m_target; }
void set_target(const Vec3d& target);
#if ENABLE_6DOF_CAMERA
double get_distance() const { return (get_position() - m_target).norm(); }
#else
double get_distance() const { return m_distance; }
#endif // ENABLE_6DOF_CAMERA
double get_gui_scale() const { return m_gui_scale; }
#if !ENABLE_6DOF_CAMERA
float get_theta() const { return m_theta; }
void set_theta(float theta, bool apply_limit);
#endif // !ENABLE_6DOF_CAMERA
double get_zoom() const { return m_zoom; }
double get_inv_zoom() const { assert(m_zoom != 0.0); return 1.0 / m_zoom; }
void update_zoom(double delta_zoom);
@ -89,11 +72,7 @@ public:
const BoundingBoxf3& get_scene_box() const { return m_scene_box; }
void set_scene_box(const BoundingBoxf3& box) { m_scene_box = box; }
#if ENABLE_6DOF_CAMERA
void select_view(const std::string& direction);
#else
bool select_view(const std::string& direction);
#endif // ENABLE_6DOF_CAMERA
const std::array<int, 4>& get_viewport() const { return m_viewport; }
const Transform3d& get_view_matrix() const { return m_view_matrix; }
@ -117,13 +96,8 @@ public:
void apply_projection(const BoundingBoxf3& box, double near_z = -1.0, double far_z = -1.0) const;
#if ENABLE_THUMBNAIL_GENERATOR
#if ENABLE_6DOF_CAMERA
void zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor);
void zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor = DefaultZoomToVolumesMarginFactor);
#else
void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h, double margin_factor = DefaultZoomToBoxMarginFactor);
void zoom_to_volumes(const GLVolumePtrs& volumes, int canvas_w, int canvas_h, double margin_factor = DefaultZoomToVolumesMarginFactor);
#endif // ENABLE_6DOF_CAMERA
#else
void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h);
#endif // ENABLE_THUMBNAIL_GENERATOR
@ -132,7 +106,6 @@ public:
void debug_render() const;
#endif // ENABLE_CAMERA_STATISTICS
#if ENABLE_6DOF_CAMERA
// translate the camera in world space
void translate_world(const Vec3d& displacement);
@ -149,7 +122,7 @@ public:
// returns true if the camera z axis (forward) is pointing in the negative direction of the world z axis
bool is_looking_downward() const { return get_dir_forward().dot(Vec3d::UnitZ()) < 0.0; }
#endif // ENABLE_6DOF_CAMERA
double max_zoom() const { return 100.0; }
double min_zoom() const;
@ -158,24 +131,17 @@ private:
// the camera MUST be outside of the bounding box in eye coordinate of the given box
std::pair<double, double> calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const;
#if ENABLE_THUMBNAIL_GENERATOR
#if ENABLE_6DOF_CAMERA
double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor) const;
double calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor = DefaultZoomToVolumesMarginFactor) const;
#else
double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h, double margin_factor = DefaultZoomToBoxMarginFactor) const;
double calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, int canvas_w, int canvas_h, Vec3d& center, double margin_factor = DefaultZoomToVolumesMarginFactor) const;
#endif // ENABLE_6DOF_CAMERA
#else
double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const;
#endif // ENABLE_THUMBNAIL_GENERATOR
void set_distance(double distance) const;
#if ENABLE_6DOF_CAMERA
void look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up);
void set_default_orientation();
Vec3d validate_target(const Vec3d& target) const;
void update_zenit();
#endif // ENABLE_6DOF_CAMERA
};
} // GUI