![]() |
NDEVR
API Documentation
|
A controller for creating basic geometry with the mouse such as polylines, circles, or spheres TODO: Allow existing models to be used here. More...
Classes | |
| struct | GeoStructure |
| Holds the structural definition points used during interactive geometry creation, including center, normal, edge, corner, and plane constraint points. More... | |
Public Types | |
| enum | GeometryCreateMode : uint04 { e_no_creation , e_draw_points , e_draw_lines , e_draw_polyline , e_draw_spline , e_draw_triangles , e_draw_circle , e_draw_conic_arc , e_draw_oval , e_draw_square , e_draw_rectangle , e_draw_polygon , e_draw_sphere , e_draw_cylinder , e_draw_cone , e_draw_box , e_create_mode_size } |
| Internal key input handler for geometry creation shortcuts. More... | |
| enum | GeometrySpecMode : uint04 { e_center , e_edge , e_corner , e_orient , e_normal , e_on_plane , e_spec_mode_size } |
| Enumerates the specification modes that control how geometry dimensions are defined relative to user input points (e.g., from center, from edge, from corner). More... | |
| Public Types inherited from SnapController | |
| enum | LockMode { e_lock_ignore_snap , e_lock_to_nearest_snap , e_lock_if_no_snap , e_only_allow_snap , e_ignore } |
| Controls how axis/plane locking interacts with snapping behavior. More... | |
| enum | PointsDrawMode { e_points , e_triangle , e_lines , e_line_fan , e_polyline } |
| Determines how snapped points are drawn or connected visually in the viewport. More... | |
Public Member Functions | |
| GeometryMaker (DesignObjectLookup *manager) | |
| Constructs a GeometryMaker attached to the given design object lookup. | |
| virtual void | addPoint (const SnapPoint &point) override |
| Adds a snap point as the next input point for the geometry being created. | |
| virtual void | begin () override |
| Begins the geometry creation session, initializing state and enabling input handling. | |
| void | calculateSolid (Geometry &mesh) |
| Calculates and applies solid mesh properties to the given geometry. | |
| virtual void | cancel () override |
| Cancels the current geometry creation session, discarding any in-progress geometry. | |
| const Buffer< UUID > & | createdModels () |
| Returns the buffer of UUIDs for all models created during this session. | |
| void | createNewModel () |
| Creates a new empty model to hold the next piece of geometry being drawn. | |
| const Model & | currentModel () const |
| Returns the model currently being created or edited. | |
| uint04 | currentStep () const |
| Returns the current step index in the multi-step geometry creation process. | |
| void | deleteAllCreatedModels () |
| Deletes all models that were created during this geometry creation session. | |
| virtual bool | editingCurrentModel () const |
| Checks whether the maker is currently editing (modifying) an existing model. | |
| virtual void | finish () override |
| Finishes the current geometry creation session and finalizes all pending geometry. | |
| TranslatedString | getHint () const |
| Returns a translated hint string describing the next expected user action. | |
| bool | hasCommandLock () |
| Checks whether this maker currently holds the command lock. | |
| void | lockMovement (bool lock_movement) |
| Sets whether cursor movement is locked (prevented from updating the preview). | |
| const UUID & | material () const |
| Returns the UUID of the default material applied to newly created geometry. | |
| bool | movementLocked () const |
| Checks whether cursor movement is currently locked. | |
| uint04 | numberOfSteps () const |
| Returns the total number of steps required for the current geometry creation mode. | |
| const UUID & | rootModel () const |
| Returns the UUID of the root model under which new geometry models are created. | |
| void | setAutoWind (bool auto_wind_shapes) |
| Sets whether created shapes should be automatically wound (vertex order corrected). | |
| void | setGenerateNormals (bool generate_normals) |
| Sets whether surface normals should be automatically generated for created geometry. | |
| void | setIsTouch (bool touch_mode) |
| Sets whether the maker is operating in touch input mode. | |
| void | setRootModel (UUID model, UUID material=Constant< UUID >::Invalid) |
| Sets the root model and optional material under which new geometry will be created. | |
| void | setSpecMode (const Buffer< GeometrySpecMode > &spec_mode) |
| Sets the specification mode sequence that controls how geometry dimensions are defined. | |
| const Buffer< GeometrySpecMode > & | specMode () |
| Returns the current specification mode sequence. | |
| bool | tryCommandLock () |
| Attempts to acquire the command lock for exclusive geometry editing. | |
| virtual void | updateLocation (const Vertex< 3, fltp08 > &location, bool is_select, Camera *camera) override |
| Updates the preview geometry location based on current cursor position. | |
| Public Member Functions inherited from SnapController | |
| SnapController (DesignObjectLookup *manager) | |
| Constructs a SnapController associated with the given DesignObjectLookup. | |
| void | clearSnapSelection () |
| Clears all currently accumulated snap selection points and resets the visual state. | |
| Vertex< 3, fltp08 > | currentLocation () const |
| Returns the current snap location in 3D space. | |
| Vertex< 3, fltp08 > | lastPoint () const |
| Returns the most recent snap location. | |
| const Buffer< SnapPoint > & | lastSnapPoints () const |
| Returns the buffer of snap points from the most recent snap calculation. | |
| void | lockAxis (uint01 axis, fltp08 lock) |
| Locks a specific axis to a fixed coordinate value. | |
| uint04 | pointCount () const |
| Returns the number of points currently recorded by the snap controller. | |
| const Buffer< Vertex< 3, fltp08 > > & | points () const |
| Returns the buffer of all accumulated snap points. | |
| SelectionMode | selectionMode () const |
| Returns the current selection mode. | |
| void | setCustomSnapManager (const ConstPointer< SnapsManager > &snap_manager) |
| Sets a custom snap manager to override the default snapping behavior. | |
| virtual void | setFinishedCallback (const std::function< void(bool is_accepted)> &callback) |
| Sets a callback invoked when the snap operation finishes. | |
| void | setLocation (const Vertex< 3, fltp08 > &location, bool is_click=false, Camera *camera=nullptr) |
| Sets the current snap location, optionally registering it as a click. | |
| void | setLockLine (const LineSegment< 3, fltp08 > &line) |
| Sets a line segment to constrain snap positions along. | |
| void | setLockMode (LockMode mode) |
| Sets the lock mode that controls how axis/plane locking interacts with snapping. | |
| void | setLockPlane (const Plane< 3, fltp08 > &plane) |
| Sets a plane to constrain snap positions onto. | |
| void | setPointsDrawMode (PointsDrawMode mode) |
| Sets the visual draw mode for how accumulated points are rendered. | |
| void | setSelectionMode (SelectionMode mode) |
| Sets the selection mode used during snap interaction. | |
| void | setShowLengthLabels (bool show) |
| Sets whether length labels are displayed along guide lines. | |
| void | setShowPointLabels (bool show) |
| Sets whether coordinate labels are displayed at snap points. | |
| virtual void | setUpdateCallback (const std::function< void()> &callback) |
| Sets a callback invoked whenever the snap location or state is updated. | |
Public Attributes | |
| Resource< GeometryCreateMode > | create_mode |
| Resource binding for the active geometry creation mode. | |
| Public Attributes inherited from SnapController | |
| Resource< SnapPoint > | current_snap_point |
| The currently active snap point resource, updated as the mouse moves. | |
Protected Member Functions | |
| void | createRootModel () |
| Creates the root model container if one does not already exist. | |
| void | onSelect (Camera *camera) |
| Handles a selection (click) action during geometry creation. | |
| virtual bool | processKeyEvent (const KeyEvent &event, DesignObjectLookup *lookup, Camera *camera) override |
| Processes a keyboard event during geometry creation. | |
| virtual bool | processMouseEvent (MouseControllerEvent &event, SelectionInfo &info) override |
| Processes a mouse controller event during geometry creation. | |
| void | processResizeEvent (const GeoStructure &spec, Model &model, Camera *camera) |
| Processes a resize event to update geometry dimensions from the given specification. | |
| virtual void | setupSelectionInfo (const MouseEvent &event, Camera *camera, SelectionInfo &info) override |
| Sets up selection info from a mouse event for snap and geometry picking. | |
| void | updatePrimitive (const Vertex< 3, fltp08 > &world_location) |
| Updates the in-progress geometry primitive based on the current world location. | |
| Protected Member Functions inherited from SnapController | |
| void | addGuideLineModel () |
| Adds a guide line model to the scene for visual feedback. | |
| void | addGuidePlaneModel () |
| Adds a guide plane model to the scene for visual feedback. | |
| void | addGuidePointModel () |
| Adds a guide point model to the scene for visual feedback. | |
| virtual void | addPoint (const Vertex< 3, fltp08 > &point) |
| Adds a 3D point to the accumulated points buffer. | |
| void | calcLockLineLocation (SnapPoint &point, const SelectionInfo &info) |
| Calculates the constrained snap point position along a lock line. | |
| void | calcLockPlaneLocation (SnapPoint &point, const SelectionInfo &info) |
| Calculates the constrained snap point position on a lock plane. | |
| SnapPoint | calcSnapPoint (const SelectionInfo &info, DesignObjectLookup *lookup) |
| Calculates the best snap point for the current selection context. | |
| void | drawDefaultGuideLines (const SnapPoint &point) |
| Draws the default set of guide lines based on the current snap point context. | |
| void | drawDefaultGuidePlane (const SnapPoint &point) |
| Draws the default guide plane based on the current snap point context. | |
| UUID | lineMaterial (const SnapPoint &point) |
| Returns the material UUID appropriate for the given snap point's guide line type. | |
| UUID | pointMaterial (const SnapPoint &point) |
| Returns the material UUID appropriate for the given snap point type. | |
| bool | processMouseSelection (MouseControllerEvent &event) |
| Processes a mouse event for object selection (non-snap interaction). | |
| bool | processMouseSnap (MouseControllerEvent &event, SelectionInfo &info) |
| Processes a mouse event specifically for snapping logic. | |
| void | processUserInput () |
| Processes any pending user text input for dimension locking. | |
| void | setGuideLine (uint04 index, const Vertex< 3, fltp08 > &p1, const Vector< 3, fltp08 > &p2, const UUID &material) |
| Sets the start position, direction, and material of a guide line at the given index. | |
| void | setGuideLineVisible (bool visible) |
| Sets the visibility of all guide lines. | |
| void | setGuideLineVisible (uint04 index, bool visible) |
| Sets the visibility of a specific guide line by index. | |
| void | setGuidePlane (uint04 index, const Vector< 3, fltp08 > &normal, const Vertex< 3, fltp08 > &location, fltp08 radius) |
| Sets the orientation, position, and size of a guide plane at the given index. | |
| void | setGuidePlaneVisible (bool visible) |
| Sets the visibility of all guide planes. | |
| void | setGuidePlaneVisible (uint04 index, bool visible) |
| Sets the visibility of a specific guide plane by index. | |
| void | setGuidePoint (uint04 index, const Vertex< 3, fltp08 > &p1, const UUID &material) |
| Sets the position and material of a guide point at the given index. | |
| void | setGuidePointVisible (bool visible) |
| Sets the visibility of all guide points. | |
| void | setGuidePointVisible (uint04 index, bool visible) |
| Sets the visibility of a specific guide point by index. | |
| Model | setupGuideModel () |
| Creates and returns a Model configured as a guide visual element. | |
| void | updateRecentGeometry (const SnapPoint &point) |
| Updates the recent geometry cache with the latest snap point for extending/snapping to nearby geometry in future operations. | |
Static Protected Member Functions | |
| static Vector< 3, Angle< fltp08 > > | getOrientation (const Vector< 3, fltp08 > &lookat, const Vector< 3, fltp08 > &up) |
| Computes Euler orientation angles from a look-at direction and up vector. | |
Protected Attributes | |
| bool | m_auto_wind_shapes |
| Whether to automatically correct vertex winding order. | |
| CommandLockObject | m_command_lock |
| Lock object for exclusive command access during creation. | |
| Buffer< UUID > | m_created_models |
| All model UUIDs created during this session. | |
| Model | m_current_model |
| The model currently being created or edited. | |
| UUID | m_default_material |
| UUID of the default material for new geometry. | |
| Plane< 3, fltp08 > | m_draw_plane |
| The plane on which 2D geometry is drawn. | |
| bool | m_generate_normals |
| Whether to automatically generate surface normals. | |
| bool | m_is_moving |
| Whether the cursor is currently in a drag/move state. | |
| bool | m_is_touch_mode |
| Whether touch-optimized interaction is active. | |
| bool | m_lock_movement |
| Whether cursor movement updates are suppressed. | |
| uint04 | m_num_created [e_create_mode_size] = { 0,0,0,0,0,0,0,0,0,0,0,0,0 } |
| Count of models created per creation mode. | |
| uint04 | m_num_roots_created = 0 |
| Number of root model containers created. | |
| UUID | m_root_model |
| UUID of the parent model for created geometry. | |
| Buffer< GeometrySpecMode > | m_spec_mode |
| Ordered sequence of spec modes for multi-step creation. | |
| Protected Attributes inherited from SnapController | |
| UUID | m_blue_line_material = Constant<UUID>::Invalid |
| Material for Z-axis (blue) guide lines. | |
| UUID | m_center_point_material = Constant<UUID>::Invalid |
| Material for snap points at center points. | |
| UUID | m_current_line_material = Constant<UUID>::Invalid |
| Material UUID for the current guide line being drawn. | |
| ConstPointer< SnapsManager > | m_custom_snap_manager |
| Optional custom snap manager overriding default snap behavior. | |
| UUID | m_edge_point_material = Constant<UUID>::Invalid |
| Material for snap points on edges. | |
| UUID | m_end_point_material = Constant<UUID>::Invalid |
| Material for snap points at endpoints. | |
| UUID | m_extend_line_material = Constant<UUID>::Invalid |
| Material for extension guide lines. | |
| std::function< void(bool is_accepted)> | m_finished_callback |
| Callback invoked when the snap operation finishes. | |
| UUID | m_free_line_material = Constant<UUID>::Invalid |
| Material for free (unconstrained) guide lines. | |
| UUID | m_free_point_material = Constant<UUID>::Invalid |
| Material for free (unconstrained) snap points. | |
| UUID | m_green_line_material = Constant<UUID>::Invalid |
| Material for Y-axis (green) guide lines. | |
| Buffer< UUID > | m_guide_line_material |
| Materials assigned to each guide line. | |
| Buffer< UUID > | m_guide_line_model |
| UUIDs of individual guide line models. | |
| UUID | m_guide_model = Constant<UUID>::Invalid |
| UUID of the root guide model in the scene. | |
| Buffer< UUID > | m_guide_plane_material |
| Materials assigned to each guide plane. | |
| Buffer< UUID > | m_guide_plane_model |
| UUIDs of individual guide plane models. | |
| Buffer< UUID > | m_guide_point_material |
| Materials assigned to each guide point. | |
| Buffer< UUID > | m_guide_point_model |
| UUIDs of individual guide point models. | |
| bool | m_is_active |
| Whether the snap controller is currently active. | |
| bool | m_is_horizontal_locked = false |
| Whether horizontal axis locking is currently active. | |
| bool | m_is_using_lock_plane = false |
| Whether a lock plane is currently in use for constraining. | |
| bool | m_is_vertical_locked = false |
| Whether vertical axis locking is currently active. | |
| Camera * | m_last_camera = nullptr |
| The camera used in the last event processing. | |
| Buffer< std::pair< UUID, uint04 > > | m_last_lines |
| Recently snapped line geometry (UUID and vertex index pairs). | |
| DesignObjectLookup * | m_last_lookup = nullptr |
| The DesignObjectLookup used in the last event processing. | |
| Buffer< std::pair< UUID, uint04 > > | m_last_meshes |
| Recently snapped mesh geometry (UUID and face index pairs). | |
| MouseEvent | m_last_mouse_event |
| The most recently processed mouse event. | |
| Buffer< std::pair< UUID, uint04 > > | m_last_points |
| Recently snapped point geometry (UUID and vertex index pairs). | |
| UUID | m_last_selection_camera = Constant<UUID>::Invalid |
| UUID of the camera used in the last selection operation. | |
| Buffer< SnapPoint > | m_last_snap_points |
| The most recently computed set of candidate snap points. | |
| Buffer< UUID > | m_line_guide_text |
| UUIDs of text labels attached to guide lines. | |
| UUID | m_line_mesh = Constant<UUID>::Invalid |
| UUID of the mesh used for guide lines. | |
| Vertex< 3, fltp08 > | m_location |
| The current snap location in 3D space. | |
| Vertex< 3, fltp08 > | m_lock_axis |
| Per-axis lock values (NaN or invalid means unlocked). | |
| LineSegment< 3, fltp08 > | m_lock_line |
| The line segment used for line-lock constraining. | |
| Vertex< 3, fltp08 > | m_lock_location |
| The reference location used for lock calculations. | |
| LockMode | m_lock_mode |
| The active lock mode controlling snap-lock interaction. | |
| Plane< 3, fltp08 > | m_lock_plane |
| The plane used for plane-lock constraining. | |
| UUID | m_locked_line_material = Constant<UUID>::Invalid |
| Material for locked/constrained guide lines. | |
| DesignObjectLookup * | m_manager |
| The DesignObjectLookup this controller operates on. | |
| UUID | m_mid_point_material = Constant<UUID>::Invalid |
| Material for snap points at midpoints. | |
| UUID | m_on_face_point_material = Constant<UUID>::Invalid |
| Material for snap points on faces. | |
| SnapPoint | m_original_snap |
| The original snap point before lock adjustments. | |
| UUID | m_perpendicular_line_material = Constant<UUID>::Invalid |
| Material for perpendicular guide lines. | |
| UUID | m_plane_mesh = Constant<UUID>::Invalid |
| UUID of the mesh used for guide planes. | |
| PointsDrawMode | m_point_draw_mode |
| The current draw mode for accumulated points. | |
| Buffer< UUID > | m_point_guide_text |
| UUIDs of text labels attached to guide points. | |
| UUID | m_point_material = Constant<UUID>::Invalid |
| Material for generic snap points. | |
| UUID | m_point_mesh = Constant<UUID>::Invalid |
| UUID of the mesh used for guide points. | |
| Buffer< Vertex< 3, fltp08 > > | m_points |
| Accumulated 3D snap points from user clicks. | |
| UUID | m_red_line_material = Constant<UUID>::Invalid |
| Material for X-axis (red) guide lines. | |
| SelectionMode | m_selection_mode |
| The current selection mode used during interaction. | |
| bool | m_show_length_label |
| Whether length labels are displayed on guide lines. | |
| bool | m_show_location_label |
| Whether coordinate labels are displayed at snap points. | |
| UUID | m_tangent_line_material = Constant<UUID>::Invalid |
| Material for tangent guide lines. | |
| std::function< void()> | m_update_callback |
| Callback invoked when the snap state is updated. | |
| EditDimensionLockInformation | m_user_edit |
| Current user dimension lock edit state. | |
A controller for creating basic geometry with the mouse such as polylines, circles, or spheres TODO: Allow existing models to be used here.
Definition at line 43 of file GeometryMaker.h.
Internal key input handler for geometry creation shortcuts.
Enumerates the types of geometry primitives that can be created interactively.
Definition at line 50 of file GeometryMaker.h.
Enumerates the specification modes that control how geometry dimensions are defined relative to user input points (e.g., from center, from edge, from corner).
Definition at line 75 of file GeometryMaker.h.
| GeometryMaker::GeometryMaker | ( | DesignObjectLookup * | manager | ) |
Constructs a GeometryMaker attached to the given design object lookup.
| [in] | manager | The design object lookup that manages models and geometry |
|
overridevirtual |
Adds a snap point as the next input point for the geometry being created.
| [in] | point | The snap point to add |
Reimplemented from SnapController.
|
overridevirtual |
Begins the geometry creation session, initializing state and enabling input handling.
Reimplemented from SnapController.
| void GeometryMaker::calculateSolid | ( | Geometry & | mesh | ) |
Calculates and applies solid mesh properties to the given geometry.
| [in] | mesh | The geometry to process as a solid |
|
overridevirtual |
Cancels the current geometry creation session, discarding any in-progress geometry.
Reimplemented from SnapController.
Returns the buffer of UUIDs for all models created during this session.
Definition at line 232 of file GeometryMaker.h.
References m_created_models.
| void GeometryMaker::createNewModel | ( | ) |
Creates a new empty model to hold the next piece of geometry being drawn.
|
protected |
Creates the root model container if one does not already exist.
|
inline |
Returns the model currently being created or edited.
Definition at line 148 of file GeometryMaker.h.
References m_current_model.
| uint04 GeometryMaker::currentStep | ( | ) | const |
Returns the current step index in the multi-step geometry creation process.
| void GeometryMaker::deleteAllCreatedModels | ( | ) |
Deletes all models that were created during this geometry creation session.
|
virtual |
Checks whether the maker is currently editing (modifying) an existing model.
|
overridevirtual |
Finishes the current geometry creation session and finalizes all pending geometry.
Reimplemented from SnapController.
| TranslatedString GeometryMaker::getHint | ( | ) | const |
Returns a translated hint string describing the next expected user action.
|
staticprotected |
Computes Euler orientation angles from a look-at direction and up vector.
| [in] | lookat | The forward direction vector |
| [in] | up | The up direction vector |
| bool GeometryMaker::hasCommandLock | ( | ) |
Checks whether this maker currently holds the command lock.
|
inline |
Sets whether cursor movement is locked (prevented from updating the preview).
| [in] | lock_movement | True to lock movement |
Definition at line 208 of file GeometryMaker.h.
References m_lock_movement.
|
inline |
Returns the UUID of the default material applied to newly created geometry.
Definition at line 136 of file GeometryMaker.h.
References m_default_material.
Referenced by setRootModel().
|
inline |
Checks whether cursor movement is currently locked.
Definition at line 214 of file GeometryMaker.h.
References m_lock_movement.
| uint04 GeometryMaker::numberOfSteps | ( | ) | const |
Returns the total number of steps required for the current geometry creation mode.
|
protected |
Handles a selection (click) action during geometry creation.
| [in] | camera | The active camera at the time of selection |
|
overrideprotectedvirtual |
Processes a keyboard event during geometry creation.
| [in] | event | The key event to process |
| [in] | lookup | The design object lookup for model access |
| [in] | camera | The active camera |
Reimplemented from SnapController.
|
overrideprotectedvirtual |
Processes a mouse controller event during geometry creation.
| [in] | event | The mouse controller event to process |
| [in] | info | The selection info context |
Reimplemented from SnapController.
|
protected |
Processes a resize event to update geometry dimensions from the given specification.
| [in] | spec | The geometry structure containing dimension specification points |
| [in] | model | The model to resize |
| [in] | camera | The active camera for view-dependent sizing |
|
inline |
Returns the UUID of the root model under which new geometry models are created.
Definition at line 142 of file GeometryMaker.h.
References m_root_model.
| void GeometryMaker::setAutoWind | ( | bool | auto_wind_shapes | ) |
Sets whether created shapes should be automatically wound (vertex order corrected).
| [in] | auto_wind_shapes | True to enable automatic winding |
| void GeometryMaker::setGenerateNormals | ( | bool | generate_normals | ) |
Sets whether surface normals should be automatically generated for created geometry.
| [in] | generate_normals | True to enable automatic normal generation |
| void GeometryMaker::setIsTouch | ( | bool | touch_mode | ) |
Sets whether the maker is operating in touch input mode.
| [in] | touch_mode | True to enable touch-optimized interaction |
Sets the root model and optional material under which new geometry will be created.
| [in] | model | The UUID of the root model |
| [in] | material | The UUID of the material to apply (defaults to Invalid for no material) |
References material().
|
inline |
Sets the specification mode sequence that controls how geometry dimensions are defined.
| [in] | spec_mode | The ordered buffer of spec modes for each creation step |
Definition at line 238 of file GeometryMaker.h.
References m_spec_mode.
|
overrideprotectedvirtual |
Sets up selection info from a mouse event for snap and geometry picking.
| [in] | event | The mouse event to process |
| [in] | camera | The active camera |
| [in] | info | The selection info structure to populate |
Reimplemented from SnapController.
|
inline |
Returns the current specification mode sequence.
Definition at line 244 of file GeometryMaker.h.
References m_spec_mode.
| bool GeometryMaker::tryCommandLock | ( | ) |
Attempts to acquire the command lock for exclusive geometry editing.
|
overridevirtual |
Updates the preview geometry location based on current cursor position.
| [in] | location | The current 3D world-space cursor position |
| [in] | is_select | Whether the update is part of a selection action |
| [in] | camera | The active camera for view-dependent calculations |
Reimplemented from SnapController.
Updates the in-progress geometry primitive based on the current world location.
| [in] | world_location | The 3D world-space position to use for the update |