NDEVR
API Documentation
GeometryBoolean.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/SoftwareService.h>
4#include <NDEVR/GeometryVertices.h>
5#include <NDEVR/Model.h>
6#include <NDEVR/Buffer.h>
7#include <NDEVR/GenericOption.h>
8namespace NDEVR
9{
10 class DesignSelection;
20 class DesignObjectLookup;
24 struct NDEVR_DESIGN_API BooleanDescription : public GenericOptionGroup
25 {
31 BooleanDescription(const TranslatedString& filter_name, const String& filter_id);
32 };
33
51
58 class NDEVR_DESIGN_API GeometryBoolean : public SoftwareService, public SoftwareServiceManager
59 {
60 protected:
66 explicit GeometryBoolean(const TranslatedString& name, const String& id);
67 public:
73 static void SetupDefaultSurfaceObject(Model& target_surface_location, const void* lock);
84
94 static void ExecuteBoolean(const JSONNode& active_filters, const DesignSelection& selection_to_surface, Model& target_surface_location, DesignObjectLookup* lookup, InfoPipe* log, const void* lock);
103 static void ExecuteBoolean(const JSONNode& active_filters, const Buffer<Model>& models_to_surface, Model& target_surface_location, InfoPipe* log, const void* lock);
110 static void ExecuteBoolean(const JSONNode& active_filters, GeometryBooleanParameters& params, Model& target_surface_location);
129 public:
130 GeometryBoolean(const GeometryBoolean& filter) = delete;
131 GeometryBoolean(const GeometryBoolean&& filter) = delete;
132 virtual ~GeometryBoolean() = default;
138 virtual bool runBoolean(GeometryBooleanParameters& parameters) = 0;
144 virtual bool canRunBoolean(const GeometryBooleanParameters&) { return true; }
154 [[nodiscard]] const TranslatedString& BooleanName() const { return m_name; }
159 [[nodiscard]] const String& BooleanID() const { return m_id; }
160 protected:
163 protected:
170 static void PrepareForBoolean(const Matrix<fltp08>& transform, const Geometry& geo, GeometryBooleanParameters& params);
177 static void ClearAllBoolean(Geometry& geo, InfoPipe* log, const void* lock);
184 static void FinishBoolean(const Matrix<fltp08>& transform, Geometry& geo, const GeometryBooleanParameters& params);
185 protected:
187 };
188}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core class where all Design Objects including models, materials, and geometries are stored.
A simple structure for storing a collection of data.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
GenericOptionGroup()=default
Default constructor.
const String & BooleanID() const
Returns the internal string identifier of this boolean engine.
static void ClearAllBoolean(Geometry &geo, InfoPipe *log, const void *lock)
Clears all boolean-related data from the given geometry.
virtual bool runBoolean(GeometryBooleanParameters &parameters)=0
Executes the boolean operation defined by this engine on the given parameters.
String m_id
The internal string identifier of this boolean engine.
GeometryBoolean(const GeometryBoolean &filter)=delete
Copy constructor is deleted; boolean engines are not copyable.
static Buffer< BooleanDescription > GetAvailableDescriptions()
Retrieves the list of all available BooleanDescription options from registered engines.
GeometryBoolean(const GeometryBoolean &&filter)=delete
Move constructor is deleted; boolean engines are not movable.
virtual bool canRunBoolean(const GeometryBooleanParameters &)
Returns whether or not the boolean operation can be applied given the target parameters.
virtual Buffer< BooleanDescription > defaultBooleanArguments()
Returns the default set of BooleanDescription arguments for this engine.
GeometryBoolean(const TranslatedString &name, const String &id)
Constructs a GeometryBoolean engine with the given display name and identifier.
static void AddAvailableBooleanEngine(GeometryBoolean *filter)
Registers a GeometryBoolean engine so it becomes available for boolean operations.
TranslatedString m_name
The user-facing translated display name of this boolean engine.
static const Dictionary< String, GeometryBoolean * > & AvailableBoolean()
Returns the dictionary of all registered GeometryBoolean engines keyed by their string ID.
static Dictionary< String, GeometryBoolean * > s_global_available_boolean_engines
Global registry of all available boolean engines keyed by string ID.
static String ToCommandString(const Buffer< BooleanDescription > &descriptions)
Serializes a buffer of BooleanDescription objects into a command string representation.
static void ExecuteBoolean(const JSONNode &active_filters, GeometryBooleanParameters &params, Model &target_surface_location)
Executes boolean operations using pre-populated parameters, writing results into the target model.
static uint04 AvailableBooleanDescriptionCount()
Returns the number of available boolean description entries across all registered engines.
virtual ~GeometryBoolean()=default
Virtual destructor for proper cleanup of derived classes.
static void ExecuteBoolean(const JSONNode &active_filters, const Buffer< Model > &models_to_surface, Model &target_surface_location, InfoPipe *log, const void *lock)
Executes boolean operations on a buffer of Models, writing results into the target model.
static void FinishBoolean(const Matrix< fltp08 > &transform, Geometry &geo, const GeometryBooleanParameters &params)
Writes boolean operation results back into the geometry, applying the inverse transform.
static void ExecuteBoolean(const JSONNode &active_filters, const DesignSelection &selection_to_surface, Model &target_surface_location, DesignObjectLookup *lookup, InfoPipe *log, const void *lock)
Executes boolean operations on a DesignSelection, writing results into the target model.
static void PrepareForBoolean(const Matrix< fltp08 > &transform, const Geometry &geo, GeometryBooleanParameters &params)
Prepares geometry data for a boolean operation by transforming and extracting mesh data.
static void SetupDefaultSurfaceObject(Model &target_surface_location, const void *lock)
Configures a Model as a default surface object suitable for receiving boolean operation results.
const TranslatedString & BooleanName() const
Returns the user-facing translated name of this boolean engine.
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:143
A light-weight base class for Log that allows processes to update, without the need for additional in...
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text ...
Definition JSONParser.h:149
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
A core class that represents a node on model hierarchy.
Definition Model.h:292
Software Service Managers take a Software service to modify the behavior of the software.
Base interface for services that extend or modify software behavior through modules.
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
GeometryBooleanOperation
Types of GeometryBoolean operations supported natively by the NDEVR engine.
@ e_subtract
Subtracts one geometry volume from another.
@ e_cut
Cuts geometry along an intersection boundary.
@ e_concatinate
Concatenates (unions) geometry from multiple sources into one mesh.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
BooleanDescription(const TranslatedString &filter_name, const String &filter_id)
Constructs a BooleanDescription with the given display name and identifier.
Stores a groups of options for performing GeometryBoolean operations.
Buffer< Buffer< uint04 > > surface_polygons
Buffer of polygon index lists for non-triangulated surface faces.
Buffer< RGBColor > surface_colors
Buffer of per-vertex colors for the resulting surface.
Buffer< Vector< 3, uint04 > > surface_triangles
Buffer of triangle index triplets defining the resulting surface mesh.
const void * lock
Optional mutex or lock pointer used to synchronize access during the boolean operation.
Buffer< Vertex< 3, fltp04 > > surface_positions
Buffer of 3D vertex positions for the resulting surface.
GeometryBooleanParameters()
Constructs default GeometryBooleanParameters with empty buffers and null lock.
LogPtr log
Logger for reporting progress and errors during the boolean operation.
Buffer< Ray< 3, fltp04 > > surface_normals
Buffer of 3D surface normals for the resulting surface.
A container for storing vertex data associated with geometry, including positions,...