33#include <NDEVR/Model.h>
34#include <NDEVR/Material.h>
35#include <NDEVR/SnapsManager.h>
36#include <NDEVR/ModelIterator.h>
37#include <NDEVR/DesignSelection.h>
38#include <NDEVR/SelectionArea.h>
282 void _processGeometryNoTree(ProcessStruct& geo);
286 void _processGeometryWithTree(ProcessStruct& geo);
291 bool _doesIntersect(
const Model& model)
const;
296 bool _processLineSelection(ProcessStruct& pstruct);
302 bool _processLineSelection(
uint04 current_index, ProcessStruct& pstruct);
307 bool _processPointSelection(ProcessStruct& pstruct);
313 bool _processPointSelection(
uint04 current_index, ProcessStruct& pstruct);
A specification of upper and lower bounds in N-dimensions.
The equivelent of std::vector but with a bit more control.
A simple structure for storing a collection of data.
A hash-based key-value store, useful for quick associative lookups.
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
A class to easily iterate each line segment over a Geometry of lines.
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Templated logic for doing matrix multiplication.
ParseResult
The result returned by process functions to control iteration flow.
ModelIterator()
Default constructor.
A core class that represents a node on model hierarchy.
An area of N-dimensional space that is considered selected.
Stores information about the closest model element found during a selection operation,...
void update(const SelectionArea< 3, fltp08 > &new_selection, const SelectionArea< 3, fltp08 > &old_selection)
Updates internal state when the selection area changes, adjusting tracked distances and positions rel...
UUID nearest_material
The UUID of the nearest material.
uint04 nearest_index
The primitive index of the nearest hit.
UUID nearest_geometry
The UUID of the nearest geometry object.
ClosestModelInfo()
Constructs a default ClosestModelInfo with invalid/default values.
void clear()
Resets all tracked closest-model data to default/invalid values.
fltp08 screen_distance
The screen-space distance to the nearest hit.
Vertex< 3, fltp08 > screen_location
The screen-space position of the nearest hit.
UUID nearest_layer
The UUID of the nearest layer.
Matrix< fltp08 > geometry_transform
The world transform of the nearest geometry.
void setMaxDistance(fltp08 distance)
Sets the maximum screen-space distance threshold for considering a hit.
uint04 nearest_vertex
The vertex index of the nearest hit.
UUID nearest_model
The UUID of the nearest model object.
bool is_smooth
Whether the nearest hit lies on a smooth (interpolated) surface.
Bounds< 3, fltp08 > selectionBounds() const
Returns the bounding box of the current selection area in local coordinates.
Buffer< UUID > grips
Collection of grip point UUIDs associated with the selection.
ParseResult process(Model &model, Geometry &geo) override
Processes a model with its associated geometry for selection.
void updateLineEndPoint(PrimitiveMode mode, Vertex< 3, fltp08 > vec)
Updates the endpoint of the selection line for a given primitive mode.
void prepareSelection()
Prepares internal state before beginning a new selection pass.
Vertex< 3, fltp08 > world_nearest_location
The world-space position of the nearest hit.
Material override_material
Material used to override rendering of selected objects.
bool processGeometry(const Model &model, const Geometry &geo, PrimitiveProperty primitive_property, UUID selection_id)
Evaluates a specific geometry primitive for selection hits.
SelectionArea< 3, fltp08 > last_selection
The previous selection area, used for incremental updates.
DesignSelection selection
The resulting design selection produced by this operation.
bool is_exact
Whether exact intersection testing is used (vs. bounding-box only).
UUID m_id
Unique identifier for this SelectionInfo instance.
bool allowSolidInteraction() const
Returns whether solid (filled) geometry intersection testing is allowed.
ParseResult process(Model &model) override
Processes a model during iteration, evaluating it for selection.
void setCurrentSelection(const SelectionArea< 3, fltp08 > &new_selection)
Sets the current selection area used for hit testing.
void setNearestLayer(PrimitiveMode mode, const UUID &layer)
Sets the nearest layer UUID for a given primitive mode.
WindingMode selection_winding_mode
The winding mode used for determining enclosed geometry.
UUID nearestGeometry(PrimitiveMode mode) const
Returns the UUID of the nearest geometry for a specific primitive mode.
VertexIterator< Vertex< 3, fltp04 > > m_position_iter
Iterator for accessing vertex positions.
fltp08 screenClosestDistanceSqr(PrimitiveMode mode) const
Returns the squared screen-space distance to the closest element of a specific primitive mode.
bool mask_added
Whether additive mask mode is active.
UUID current_model
The UUID of the model currently being processed.
ClosestModelInfo nearest_line
Closest hit info for line primitives.
bool use_interaction_flag
Whether to respect the model's interaction flag when selecting.
ClosestModelInfo nearest_solid
Closest hit info for solid (triangle/face) primitives.
LineSegment< 3, fltp08 > world_selection_line
The selection ray/line in world (screen) space.
bool is_edit
Whether this selection is for editing (vs. simple picking).
LineIterator< 3, fltp04 > m_line_position_iter
Iterator for accessing line segment positions.
void setNearestMaterial(PrimitiveMode mode, const UUID &material)
Sets the nearest material UUID for a given primitive mode.
Bounds< 3, fltp08 > globalSelectionBounds() const
Returns the bounding box of the current selection area in global coordinates.
UUID nearestModel() const
Returns the UUID of the nearest model across all primitive modes.
std::function< bool(const Model &)> selection_filter
Optional filter callback invoked after selection to validate the selected model's parent....
void setAllowSolidInteraction(bool allow_solid_intersection)
Sets whether solid (filled) geometry intersection testing is allowed.
fltp08 screen_line_bias
Bias added to line selection distances for priority tuning.
bool setNearestScreenPosition(PrimitiveMode mode, const Vertex< 3, fltp08 > &screen_point, fltp08 screen_distance)
Sets the nearest screen-space position for a given primitive mode.
Buffer< Model > m_valid_model_stack
Stack of models that passed validation during traversal.
ParseResult postProcess(Model &model) override
Post-processes a model after its children have been visited.
void setNearestGeometry(const Geometry &geo, PrimitiveMode primitive_mode, uint04 index, uint04 vertex)
Sets the nearest geometry hit for a given primitive mode.
fltp08 screenClosestDistanceSqr(bool outer_bound) const
Returns the squared screen-space distance to the closest selected element.
void clear()
Resets all selection state, clearing tracked results and selection areas.
fltp08 screen_point_bias
Bias added to point selection distances for priority tuning.
SelectionInfo()
Constructs a default SelectionInfo with initial state.
fltp08 min_screen_cutoff_distance
Minimum screen-space distance below which hits are ignored.
Dictionary< UUID, EnclosedModelInfo > enclosed_info
Map of model UUIDs to their enclosed selection information.
Vertex< 3, fltp08 > nearestScreenLocation() const
Returns the screen-space location of the nearest selection hit.
Buffer< SelectionArea< 3, fltp08 > > selection_masks
Collection of selection mask areas for complex selection shapes.
bool operator==(const SelectionInfo &) const
Equality operator.
void getEnclosedVertices(GeometryVertices &vertices) const
Populates the given GeometryVertices with all vertices enclosed by the current selection area.
TriangleIterator< 3, fltp04 > m_triangle_position_iter
Iterator for accessing triangle positions.
void finishSelection()
Finalizes selection state after a selection pass is complete.
void setNearestModel(PrimitiveMode mode, const Model &model)
Sets the nearest model for a given primitive mode.
UUID camera
The UUID of the camera used for screen-space projection.
bool m_allow_solid_intersection
Whether solid geometry intersection testing is enabled.
bool validModelSelection(const Model &model) const
Checks whether a model passes the current selection filters and is valid for selection.
void setGeometryTransform(PrimitiveMode mode, const Matrix< fltp08 > &mat)
Sets the geometry transform matrix for a given primitive mode.
Vertex< 3, fltp08 > nearestWorldLocation() const
Returns the world-space location of the nearest selection hit.
UUID uuid() const
Returns the unique identifier of this SelectionInfo instance.
void clearLastSelection()
Clears only the most recent selection data, preserving historical state.
bool mask_subtracted
Whether subtractive mask mode is active.
ParseResult process(Model &model, Material &mat) override
Processes a model with its associated material for selection.
SelectionArea< 3, fltp08 > current_selection
The current active selection area.
ClosestModelInfo nearest_point
Closest hit info for point primitives.
A class to easily iterate each triangle over a Geometry of triangles or meshes.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Typed vertex iterator providing array-style access to geometry vertex data.
A point in N-dimensional space, used primarily for spatial location information.
The primary namespace for the NDEVR SDK.
PrimitiveMode
Used with Geometry to describe how vertices and indices are used to form shapes.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
PrimitiveProperty
Describes which rendering property a primitive index buffer corresponds to.
WindingMode
Describes the vertex winding order used to determine front-facing direction of polygons.
A container for storing vertex data associated with geometry, including positions,...