FIX:need to clarify eigen data type in linux
jira: none Change-Id: Ibb1d0015912641d1ba16355f5842f1693c72f391
This commit is contained in:
parent
75994cc765
commit
b7ab08e65b
|
@ -23,7 +23,7 @@ public:
|
||||||
float distance(const Vec3f &pt) const { return normal_.dot(pt) + d_; }
|
float distance(const Vec3f &pt) const { return normal_.dot(pt) + d_; }
|
||||||
|
|
||||||
inline const Vec3f &getNormal() const { return normal_; }
|
inline const Vec3f &getNormal() const { return normal_; }
|
||||||
|
const Vec3f & getCenter() const { return center_; }
|
||||||
Plane::PlaneIntersects intersects(const BoundingBoxf3 &box) const;
|
Plane::PlaneIntersects intersects(const BoundingBoxf3 &box) const;
|
||||||
//// check intersect with point (world space)
|
//// check intersect with point (world space)
|
||||||
Plane::PlaneIntersects intersects(const Vec3f &p0) const;
|
Plane::PlaneIntersects intersects(const Vec3f &p0) const;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "GLShader.hpp"
|
#include "GLShader.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "GUI_Colors.hpp"
|
#include "GUI_Colors.hpp"
|
||||||
//#include "Camera.hpp"
|
|
||||||
#include "Plater.hpp"
|
#include "Plater.hpp"
|
||||||
#include "BitmapCache.hpp"
|
#include "BitmapCache.hpp"
|
||||||
|
|
||||||
|
|
|
@ -109,11 +109,43 @@ void Camera::select_view(const std::string& direction)
|
||||||
//how to use
|
//how to use
|
||||||
//BoundingBox bbox = mesh.aabb.transform(transform);
|
//BoundingBox bbox = mesh.aabb.transform(transform);
|
||||||
//return camera_->getFrustum().intersects(bbox);
|
//return camera_->getFrustum().intersects(bbox);
|
||||||
|
void Camera::debug_frustum()
|
||||||
|
{
|
||||||
|
ImGuiWrapper &imgui = *wxGetApp().imgui();
|
||||||
|
imgui.begin(std::string("Camera debug_frusm"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
||||||
|
|
||||||
|
Vec3f frustum_min = m_frustum.bbox.min.cast<float>();
|
||||||
|
Vec3f frustum_max = m_frustum.bbox.max.cast<float>();
|
||||||
|
Vec3f _0_normal = m_frustum.planes[0].getNormal().cast<float>();
|
||||||
|
Vec3f _0_corner = m_frustum.corners[0].cast<float>();
|
||||||
|
Vec3f _1_corner = m_frustum.corners[1].cast<float>();
|
||||||
|
|
||||||
|
ImGui::InputFloat3("m_last_eye", m_last_eye.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::InputFloat3("m_last_center", m_last_center.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::InputFloat3("m_last_up", m_last_up.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::InputFloat3("frustum_min", frustum_min.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::InputFloat3("frustum_max", frustum_max.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
for (size_t i = 0; i < 8; i++) {
|
||||||
|
std::string name = "corner" + std::to_string(i);
|
||||||
|
ImGui::InputFloat3(name.c_str(), m_frustum.corners[i].data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < 6; i++) {
|
||||||
|
std::string name = "plane_normal" + std::to_string(i);
|
||||||
|
Vec3f normal = m_frustum.planes[i].getNormal();
|
||||||
|
ImGui::InputFloat3(name.c_str(), normal.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
|
||||||
|
name = "plane_center" + std::to_string(i);
|
||||||
|
Vec3f center = m_frustum.planes[i].getCenter();
|
||||||
|
ImGui::InputFloat3(name.c_str(), center.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
|
||||||
|
}
|
||||||
|
imgui.end();
|
||||||
|
}
|
||||||
|
|
||||||
void Camera::update_frustum()
|
void Camera::update_frustum()
|
||||||
{
|
{
|
||||||
auto eye_ = get_position().cast<float>();
|
Vec3f eye_ = get_position().cast<float>();
|
||||||
auto center_ = get_target().cast<float>();
|
Vec3f center_ = get_target().cast<float>();
|
||||||
auto up_ = get_dir_up().cast<float>();
|
Vec3f up_ = get_dir_up().cast<float>();
|
||||||
float near_ = m_frustrum_zs.first;
|
float near_ = m_frustrum_zs.first;
|
||||||
float far_ = m_frustrum_zs.second;
|
float far_ = m_frustrum_zs.second;
|
||||||
float aspect_ = m_viewport[2] / (double)m_viewport[3];
|
float aspect_ = m_viewport[2] / (double)m_viewport[3];
|
||||||
|
|
|
@ -121,7 +121,7 @@ public:
|
||||||
|
|
||||||
void zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor);
|
void zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor);
|
||||||
void zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor = DefaultZoomToVolumesMarginFactor);
|
void zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor = DefaultZoomToVolumesMarginFactor);
|
||||||
|
void debug_frustum();
|
||||||
#if ENABLE_CAMERA_STATISTICS
|
#if ENABLE_CAMERA_STATISTICS
|
||||||
void debug_render();
|
void debug_render();
|
||||||
#endif // ENABLE_CAMERA_STATISTICS
|
#endif // ENABLE_CAMERA_STATISTICS
|
||||||
|
|
Loading…
Reference in New Issue