33#include <NDEVR/SnapController.h>
35#include <NDEVR/CommandLockObject.h>
325 uint04 m_num_created[
e_create_mode_size] = { 0,0,0,0,0,0,0,0,0,0,0,0,0 };
The equivelent of std::vector but with a bit more control.
A core object representing a user view as well as convenience functions for moving this view through ...
Used with DesignObjectLookups to lock the application for a critical process.
A core class where all Design Objects including models, materials, and geometries are stored.
const Buffer< GeometrySpecMode > & specMode()
Returns the current specification mode sequence.
virtual void setupSelectionInfo(const MouseEvent &event, Camera *camera, SelectionInfo &info) override
Sets up selection info from a mouse event for snap and geometry picking.
virtual void addPoint(const SnapPoint &point) override
Adds a snap point as the next input point for the geometry being created.
void createRootModel()
Creates the root model container if one does not already exist.
bool m_is_moving
Whether the cursor is currently in a drag/move state.
UUID m_default_material
UUID of the default material for new geometry.
Buffer< GeometrySpecMode > m_spec_mode
Ordered sequence of spec modes for multi-step creation.
virtual bool processMouseEvent(MouseControllerEvent &event, SelectionInfo &info) override
Processes a mouse controller event during geometry creation.
uint04 m_num_roots_created
Number of root model containers created.
UUID m_root_model
UUID of the parent model for created geometry.
void setRootModel(UUID model, UUID material=Constant< UUID >::Invalid)
Sets the root model and optional material under which new geometry will be created.
CommandLockObject m_command_lock
Lock object for exclusive command access during creation.
virtual void begin() override
Begins the geometry creation session, initializing state and enabling input handling.
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).
virtual bool processKeyEvent(const KeyEvent &event, DesignObjectLookup *lookup, Camera *camera) override
Processes a keyboard event during geometry creation.
Buffer< UUID > m_created_models
All model UUIDs created during this session.
void setIsTouch(bool touch_mode)
Sets whether the maker is operating in touch input mode.
bool m_lock_movement
Whether cursor movement updates are suppressed.
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.
void deleteAllCreatedModels()
Deletes all models that were created during this geometry creation session.
Resource< GeometryCreateMode > create_mode
Resource binding for the active geometry creation mode.
bool m_auto_wind_shapes
Whether to automatically correct vertex winding order.
void onSelect(Camera *camera)
Handles a selection (click) action during geometry creation.
const Buffer< UUID > & createdModels()
Returns the buffer of UUIDs for all models created during this session.
virtual void updateLocation(const Vertex< 3, fltp08 > &location, bool is_select, Camera *camera) override
Updates the preview geometry location based on current cursor position.
TranslatedString getHint() const
Returns a translated hint string describing the next expected user action.
const UUID & material() const
Returns the UUID of the default material applied to newly created geometry.
Model m_current_model
The model currently being created or edited.
const Model & currentModel() const
Returns the model currently being created or edited.
uint04 numberOfSteps() const
Returns the total number of steps required for the current geometry creation mode.
virtual void finish() override
Finishes the current geometry creation session and finalizes all pending geometry.
virtual void cancel() override
Cancels the current geometry creation session, discarding any in-progress geometry.
virtual bool editingCurrentModel() const
Checks whether the maker is currently editing (modifying) an existing model.
bool tryCommandLock()
Attempts to acquire the command lock for exclusive geometry editing.
bool m_generate_normals
Whether to automatically generate surface normals.
GeometryMaker(DesignObjectLookup *manager)
Constructs a GeometryMaker attached to the given design object lookup.
uint04 m_num_created[e_create_mode_size]
Count of models created per creation mode.
GeometryCreateMode
Internal key input handler for geometry creation shortcuts.
@ e_draw_lines
Draw discrete line segments.
@ e_draw_oval
Draw an oval (ellipse).
@ e_draw_triangles
Draw individual triangles.
@ e_draw_spline
Draw a smooth spline curve.
@ e_draw_box
Draw a 3D box.
@ e_draw_conic_arc
Draw a conic arc segment.
@ e_draw_sphere
Draw a 3D sphere.
@ e_draw_polygon
Draw a regular polygon.
@ e_create_mode_size
Total number of creation modes (used for array sizing).
@ e_draw_square
Draw a square (equal-sided rectangle).
@ e_draw_circle
Draw a circle.
@ e_draw_cylinder
Draw a 3D cylinder.
@ e_no_creation
No geometry creation active.
@ e_draw_cone
Draw a 3D cone.
@ e_draw_points
Draw individual point vertices.
@ e_draw_polyline
Draw a connected polyline.
@ e_draw_rectangle
Draw a rectangle.
void setSpecMode(const Buffer< GeometrySpecMode > &spec_mode)
Sets the specification mode sequence that controls how geometry dimensions are defined.
GeometrySpecMode
Enumerates the specification modes that control how geometry dimensions are defined relative to user ...
@ e_orient
Specify orientation of the geometry.
@ e_normal
Specify the surface normal direction.
@ e_center
Define geometry outward from a center point.
@ e_on_plane
Constrain geometry creation to a plane.
@ e_corner
Define geometry from a corner point.
@ e_spec_mode_size
Total number of spec modes (used for array sizing).
@ e_edge
Define geometry from an edge midpoint.
bool movementLocked() const
Checks whether cursor movement is currently locked.
void createNewModel()
Creates a new empty model to hold the next piece of geometry being drawn.
uint04 currentStep() const
Returns the current step index in the multi-step geometry creation process.
Plane< 3, fltp08 > m_draw_plane
The plane on which 2D geometry is drawn.
void lockMovement(bool lock_movement)
Sets whether cursor movement is locked (prevented from updating the preview).
bool hasCommandLock()
Checks whether this maker currently holds the command lock.
void processResizeEvent(const GeoStructure &spec, Model &model, Camera *camera)
Processes a resize event to update geometry dimensions from the given specification.
void setGenerateNormals(bool generate_normals)
Sets whether surface normals should be automatically generated for created geometry.
bool m_is_touch_mode
Whether touch-optimized interaction is active.
void updatePrimitive(const Vertex< 3, fltp08 > &world_location)
Updates the in-progress geometry primitive based on the current world location.
void calculateSolid(Geometry &mesh)
Calculates and applies solid mesh properties to the given geometry.
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
Describes a user key press event used to trigger behavior in the NDEVR API.
A core class that represents a node on model hierarchy.
Describes a mouse or touch input event with position, button, and modifier information.
Logic for a given plane or N-dimensions.
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
SnapController(DesignObjectLookup *manager)
Constructs a SnapController associated with the given DesignObjectLookup.
Contains information about a particular point of interest created from a user mouse interaction.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
A point in N-dimensional space, used primarily for spatial location information.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Holds the structural definition points used during interactive geometry creation, including center,...
Vertex< 3, fltp08 > edge[4]
Edge definition points (up to 4).
Vertex< 3, fltp08 > corner[4]
Corner definition points (up to 4).
uint04 num_of_points
Number of points specified so far during creation.
Vertex< 3, fltp08 > center
Center point of the geometry being created.
Vertex< 3, fltp08 > plane[4]
Plane constraint points (up to 4).
Ray< 3, fltp08 > normal
Normal direction ray for the geometry surface.
A wrapper for a mouse event that is used by MouseControllerBase.