diff --git a/include/xdg/geometry_data.h b/include/xdg/geometry_data.h index f3b69c7..11b4048 100644 --- a/include/xdg/geometry_data.h +++ b/include/xdg/geometry_data.h @@ -1,6 +1,8 @@ #ifndef _XDG_GEOMETRY_DATA_H #define _XDG_GEOMETRY_DATA_H +#include "xdg/constants.h" + namespace xdg { @@ -8,6 +10,7 @@ struct MeshManager; // Forward declaration struct TriangleRef; // Forward declaration struct GeometryUserData { + MeshID surface_id {ID_NONE}; //! ID of the surface this geometry data is associated with MeshManager* mesh_manager {nullptr}; //! Pointer to the mesh manager for this geometry TriangleRef* tri_ref_buffer {nullptr}; //! Pointer to the triangles in the geometry double box_bump; //! Bump distance for the bounding boxes in this geometry diff --git a/include/xdg/ray_tracing_interface.h b/include/xdg/ray_tracing_interface.h index 03c5152..c6632b9 100644 --- a/include/xdg/ray_tracing_interface.h +++ b/include/xdg/ray_tracing_interface.h @@ -14,6 +14,8 @@ namespace xdg { +using TreeID = RTCScene; + class RayTracer { // Constructors public: diff --git a/include/xdg/triangle_ref.h b/include/xdg/triangle_ref.h index adb6798..0f84302 100644 --- a/include/xdg/triangle_ref.h +++ b/include/xdg/triangle_ref.h @@ -12,7 +12,6 @@ struct TriangleRef; // Forward declaration // TODO: could be a more generic primitive ref? struct TriangleRef { MeshID triangle_id {ID_NONE}; - MeshID surface_id {ID_NONE}; Sense sense {Sense::UNSET}; }; diff --git a/src/ray_tracing_interface.cpp b/src/ray_tracing_interface.cpp index 7bbcf76..0e9a487 100644 --- a/src/ray_tracing_interface.cpp +++ b/src/ray_tracing_interface.cpp @@ -51,7 +51,6 @@ RayTracer::register_volume(const std::shared_ptr mesh_manager, for (int i = 0; i < surface_elements.size(); ++i) { auto& triangle_ref = triangle_storage[i + storage_offset]; triangle_ref.triangle_id = surface_elements[i]; - triangle_ref.surface_id = surface_id; triangle_ref.sense = triangle_sense; } storage_offset += surface_elements.size(); @@ -86,6 +85,7 @@ RayTracer::register_volume(const std::shared_ptr mesh_manager, this->surface_to_geometry_map_[surface] = surface_geometry; GeometryUserData surface_data; + surface_data.surface_id = surface; surface_data.mesh_manager = mesh_manager.get(); surface_data.tri_ref_buffer = tri_ref_ptr + buffer_start; user_data_map_[surface_geometry] = surface_data; @@ -255,9 +255,10 @@ Direction RayTracer::get_normal(MeshID surface, TriangleRef triangle_ref; closest(surface_vols.first, point, dist, triangle_ref); - if (triangle_ref.surface_id != surface) { - fatal_error("Point {} was closest to surface {}, not surface {}, in volume {}.", point, triangle_ref.surface_id, surface, surface_vols.first); - } + // TODO: bring this back when we have a better way to handle this + // if (geom_data.surface_id != surface) { + // fatal_error("Point {} was closest to surface {}, not surface {}, in volume {}.", point, geom_data.surface_id, surface, surface_vols.first); + // } element = triangle_ref.triangle_id; }