35#include <NDEVR/SoftwareService.h>
36#include <NDEVR/GeometryVertices.h>
37#include <NDEVR/Model.h>
38#include <NDEVR/Material.h>
39#include <NDEVR/DesignCommand.h>
40#include <NDEVR/Buffer.h>
41#include <NDEVR/GenericOption.h>
42#include <NDEVR/JSONNode.h>
43#include <NDEVR/INIInterface.h>
46 template<u
int01 t_dims,
class t_type>
48 class DesignObjectLookup;
49 class DesignSelection;
53 class NDEVR_SURFACING_API SurfacingDescription :
public GenericOptionGroup,
public INIInterface
56 SurfacingDescription(
const TranslatedString& filter_name,
const String& filter_id);
57 virtual void getINI(INIFactory& factory)
override;
64 struct SurfacePostProcessingOptions
66 fltp08 combine_vertex_epsilon = 0.0;
67 bool combine_vertices =
false;
72 struct GenerateMaterialInformation
74 Material::UVMode mode = Material::UVMode::e_background;
75 RGBColor constant_color = Constant<RGBColor>::Invalid;
81 struct NDEVR_SURFACING_API GeometrySurfacingParameters :
public GenericOptionGroup,
public GeometryVertices
83 GeometrySurfacingParameters();
84 GeometrySurfacingParameters(
const SurfacingDescription& description);
85 void flipPositionElevations();
86 [[nodiscard]]
uint04 surfacePrimitiveSize()
const;
87 [[nodiscard]]
bool hasSameOptions(
const GeometrySurfacingParameters& params)
const;
88 GenerateMaterialInformation material_info;
89 const void* lock =
nullptr;
90 ProgressInfo* log =
nullptr;
91 NormalFlipper* normal_flipper =
nullptr;
92 DesignObjectLookup* lookup =
nullptr;
93 Buffer<Vertex<3, fltp04>> surface_positions;
94 Buffer<Ray<3, fltp04>> surface_normals;
95 Buffer<RGBColor> surface_colors;
96 Buffer<Vector<3, uint04>> surface_triangles;
97 Buffer<Buffer<uint04>> surface_polygons;
98 fltp08 linework_surface_delta = 0.01;
99 fltp08 mesh_surface_delta = 0.01;
100 bool surface_linework =
false;
101 bool surface_meshes =
false;
102 bool include_colors =
false;
103 SurfacePostProcessingOptions post_processing_options;
104 Model target_surface_location;
105 UUID normal_cache_id;
111 class NormalFlipper :
public SoftwareService
114 virtual bool shouldFlipNormal(uint04 idx, GeometrySurfacingParameters& parameters,
const Ray<3, fltp04>& normal) = 0;
123 explicit GeometrySurfacing(
const TranslatedString& name,
const String&
id);
125 GeometrySurfacing(
const GeometrySurfacing& filter) =
delete;
126 GeometrySurfacing(
const GeometrySurfacing&& filter) =
delete;
127 virtual ~GeometrySurfacing() =
default;
128 virtual bool runSurfacing(GeometrySurfacingParameters& parameters) = 0;
130 [[nodiscard]]
virtual bool canRunSurfacing(
const GeometrySurfacingParameters&) {
return true; }
131 [[nodiscard]]
virtual Buffer<SurfacingDescription> defaultSurfacingArguments();
132 [[nodiscard]]
const TranslatedString& surfacingName()
const {
return m_name; }
133 [[nodiscard]]
const String& surfacingID()
const {
return m_id; }
135 static void SetupDefaultSurfaceObject(GeometrySurfacingParameters& params);
136 static void SetupDefaultSurfaceMaterial(GeometrySurfacingParameters& params);
137 static const Dictionary<String, GeometrySurfacing*>& AvailableSurfacing();
138 static void AddAvailableSurfacingEngine(GeometrySurfacing* filter);
139 static void ExecuteSurfacing(GeometrySurfacingParameters& params,
const DesignSelection& selection_to_surface);
140 static void ExecuteSurfacing(GeometrySurfacingParameters& params,
const Buffer<Model>& models_to_surface);
141 static void ExecuteSurfacing(GeometrySurfacingParameters& params,
const Buffer<SelectionArea<3, fltp08>, uint04, ObjectAllocator<false>>& boundary_areas);
142 [[nodiscard]]
static Buffer<SurfacingDescription> GetAvailableDescriptions();
143 [[nodiscard]]
static uint04 AvailableSurfacingDescriptionCount();
144 [[nodiscard]]
static String ToCommandString(
const SurfacingDescription& descriptions);
145 static void ClearCache();
146 [[nodiscard]]
static String CreateDescription(GeometrySurfacingParameters& params);
147 static void FindSurfaceColors(GeometrySurfacingParameters& params, fltp04 max_distance = Constant<fltp04>::Max);
149 static void PrepareForSurfacing(
const Matrix<fltp08>& transform,
const Model& model,
const Geometry& geo, GeometrySurfacingParameters& params);
150 static void ClearAllSurfacing(Geometry& geo, ProgressInfo* log,
const void* lock);
151 static void FinishSurfacing(GeometrySurfacingParameters& params,
const Buffer<SelectionArea<3, fltp08>, uint04, ObjectAllocator<false>>& boundary_areas);
152 static void FinishSurfacing(
const Matrix<fltp08>& transform, Geometry& geo,
const GeometrySurfacingParameters& params,
const Buffer<SelectionArea<3, fltp08>, uint04, ObjectAllocator<false>>& boundary_areas);
154 static Dictionary<String, GeometrySurfacing*> s_global_available_surfacing_engines;
155 static Dictionary<UUID, GeometrySurfacingParameters> s_cached_geometry_cloud;
156 static Dictionary<UUID, Buffer<GeometrySurfacingParameters>> s_cached_geometry_params;
158 TranslatedString m_name;
167 GeometrySurfacingCommand(
const GeometrySurfacingParameters& params,
const UUID& output_id = Constant<UUID>::Invalid);
168 GeometrySurfacingCommand(
const SurfacingDescription& description,
bool include_colors,
bool include_lines,
const UUID& output_id = Constant<UUID>::Invalid);
169 virtual void execute(DesignObjectLookup* lookup)
override;
170 virtual bool isAsyncExecution()
const override {
return true; }
171 String icon()
const override;
172 TranslatedString name()
const override;
174 GeometrySurfacingParameters m_params;
175 UUID m_output_id = Constant<UUID>::Invalid;
176 UUID m_generated_id = Constant<UUID>::Invalid;
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149