API Documentation
Loading...
Searching...
No Matches
Model.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: Model
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/DesignObject.h>
34namespace NDEVR
35{
36 enum class UVType;
37 enum class PrimitiveProperty;
38 enum class WindingMode;
39 class Scene;
40 class Database;
41 class File;
42 class Material;
43 class Geometry;
44#if NDEVR_SUPPORTS_BONES
45 class Bone;
46#endif
47 class Effect;
48 class Log;
49 class ProgressInfo;
50 template<class t_type>
51 class Set;
52
54 {
55 public:
56 enum class MaterialMode
57 {
58 e_by_parent
60 , e_custom
61 , e_hidden
62 };
64 {
65 e_ignore_offset = 0
66 , e_ignore_scale = 1
67 , e_ignore_rotation = 2
68 , e_ignore_scale_distortion = 3
69 , e_use_only_for_offset = 4
70 , e_orient_to_camera = 5
71 , e_follow_camera = 6
72 , e_scale_to_camera = 7
73 };
74
76 {
77 e_inherited_is_visible = 0
78 , e_inherited_has_no_focus = 1
79 , e_inherited_is_tree_visible = 2
80 , e_inherited_not_selected = 3
81 , e_inherited_is_manager_visible = 4
82 , e_inherited_can_delete = 5
83 , e_inherited_does_not_follow_camera = 6
84 , e_inherited_does_not_orient_to_camera = 7
85 , e_inherited_does_not_scale_to_camera = 8
86 , e_inherited_not_deleted = 9
87 , e_inherited_not_application_owned = 10
88 , e_inherited_exportable = 11
89 };
90
92 {
93 e_descendent_selected = 0
94 , e_descendent_focussed = 1
95 , e_descendent_deletion_blocked = 2
96 };
97
99 {
100 e_type
101 , e_fixed_bounding_box
102 , e_visible_box
103 , e_calculation_ignored
104 , e_can_select_children
105 , e_complete_transform
106 , e_material_mode_solid
107 , e_material_mode_outline
108 , e_material_mode_vertices
109 , e_parent_matrix_flags
110 , e_global_bounds
111 , e_global_selection_bounds
112 , e_model_color
113 , e_inherited_flags//recursive lookup
114 , e_personal_inherited_flags
115 , e_export_ignored //do not export this item
116 , e_descended_flags//recursive lookup
117 , e_personal_descended_flags
118 , e_application_constructed
119 , e_application_constructed_parent_base
120 , e_model_property_size//always last
121 };
122
123 public:
124 Model(){};
125 Model(DesignObjectBase* base);
126 Model(uint04 index, DesignObjectBase* base);
127 explicit Model(const DesignObject& obj);
128 [[nodiscard]] bool isSelected() const;
129 [[nodiscard]] bool isApplicationOwned() const;
130 [[nodiscard]] bool isVisible() const;
131 [[nodiscard]] bool isTreeVisible() const;
132 [[nodiscard]] bool hasFocus() const;
133 [[nodiscard]] bool exportIgnored() const;
134 [[nodiscard]] TranslatedString displayName() const;
135 [[nodiscard]] TranslatedString displayNamePath(const String& seperator = ":") const;
136 template<class t_type>
137 void setModelProperty(ModelProperty property, const t_type& value)
138 {
139 m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].set(m_design_index, value);
140 }
141 template<class t_type>
142 void updateModelProperty(ModelProperty property, const t_type& type, const void* lock_ptr = nullptr)
143 {
144 if (getModelProperty<t_type>(property) != type)
145 {
146 WLock wLock(lock_ptr);
147 setModelProperty(property, type);
148 updateModifiedTime();
149 }
150 }
151 template<class t_type>
152 t_type getModelProperty(ModelProperty property) const
153 {
154 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].get<t_type>(m_design_index);
155 }
156 bool isModelProperty(ModelProperty property, const String& value) const
157 {
158 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].isSame(m_design_index, value);
159 }
160 bool isModelProperty(ModelProperty property, const char* value) const
161 {
162 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].isSame(m_design_index, value);
163 }
164 bool doesModelPropertyContain(ModelProperty property, const String& value, bool ignore_case) const
165 {
166 return propertyTable().get()[m_base->model_property_index[cast<uint04>(property)]].contains(m_design_index, value, ignore_case);
167 }
168 bool doesModelPropertyContain(ModelProperty property, const char* value, bool ignore_case) const
169 {
170 return propertyTable().get()[m_base->model_property_index[cast<uint04>(property)]].contains(m_design_index, value, ignore_case);
171 }
172 void restoreModel();
173 void eraseModel();
174 void deleteModel(bool delete_children, bool remove_from_parent = true);
176 [[nodiscard]] bool canExplode() const;
177 [[nodiscard]] bool isOfType(const String& type) const;
178 [[nodiscard]] bool isOfType(const char* type) const;
179
180 Model createChild();
181 Model createChild(uint04 child_slot);
182 void createChildren(uint04 child_size);
183 Model createSceneModel() const;
184 Model createSceneLayer() const;
185 Model getSceneModel(UUID id) const;
186 Model getSceneLayer(UUID id) const;
187
188 void addChild(Model& child);
189 void addChild(uint04 child_index);
190 void swapChildren(uint04 a, uint04 b);
191 //Parent functions
192 void setParentMatrixFlags(BitFlag flags);
193 void setParentMatrixFlag(ParentMatrixFlags flag, bool value);
194 BitFlag parentMatrixFlags() const;
195 Model getParent() const;
196 uint04 getParentIndex() const;
197 enum class ModelColorMode
198 {
199 e_direct
200 , e_by_selectable_children
201 , e_by_material_root
202 , e_by_layer
203 };
204 RGBColor customModelColor(ModelColorMode mode) const;
205 void updateTransform(const Matrix<fltp08>& transform, const void* lock = nullptr);
206 void setTransform(const Matrix<fltp08>& transform);
207 String getModelIcon() const;
208
209
210 Effect createChildEffect();
211
212 //Geometry functions
213 Geometry createChildGeometry();
214
215 void setGeometryChild(uint04 geo_index);
216 void setGeometryChild(const Geometry& geo);
217 void updateVisible(bool is_visible);
218 void updateVisibleRecursive(bool is_visible);
219 Buffer<GeometryType> descendentGeometryTypes() const;
220 bool hasGeometryDescendent() const;
221 bool hasMeshDescendent() const;
222 bool hasLinearDescendent() const;
223 bool hasPointsDescendent() const;
224 void hasDescendents(bool& has_point, bool& has_line, bool& has_mesh) const;
225
226 MaterialMode getMaterialMode(PrimitiveProperty property) const;
227 void setMaterialMode(MaterialMode vertex, MaterialMode outline, MaterialMode solid);
228 void setMaterialMode(PrimitiveProperty property, MaterialMode option);
229 Material createChildMaterial(bool copy_child = false);
230 Material createChildMaterial(PrimitiveProperty property, bool copy_child = false);
231 void clearMaterialDescendents();
232 void overrideMaterialDescendents(PrimitiveProperty property, MaterialMode override_desc);
233 void overrideMaterialDescendents(MaterialMode vertex, MaterialMode outline, MaterialMode solid);
234 void setMaterial(PrimitiveProperty property, uint04 material_index);
235 void setMaterial(uint04 material_index);
236 void setMaterial(PrimitiveProperty property, const Material& material);
237 void setMaterial(const Material& material);
238 void colorByChannel(Material& mat, const String& channel, fltp08 avg = Constant<fltp08>::NaN) const;
239 void checkBounds();
240
241#if NDEVR_SUPPORTS_BONES
242 Bone createSceneBone() const;
243 bool hasBone(uint04 index = 0) const;
244 uint04 getNumOfBones() const;
245 Bone getBone(uint04 index = 0) const;
246 Bone getSceneBone(UUID id) const;
248 Matrix<fltp08> getBoneTransform(uint04 index = 0) const;
249 uint04 getBoneGroupIndex(uint04 child_index = 0) const;
250 void setBoneGroupIndex(uint04 bone_group_index, uint04 sub_index = 0);
251#endif
252 Effect createSceneEffect() const;
253
254 void setIsLayer(bool is_layer);
255 bool isLayer() const;
256 bool hasLayer() const;
257 [[nodiscard]] bool hasDirectLayer() const;
258 [[nodiscard]] Model getLayer() const;
259 [[nodiscard]] uint04 getDirectLayerIndex() const;
260
261 //Returns the center of rotation in global units
262 [[nodiscard]] Vertex<3, fltp08> globalCenterOfRotation() const;
263
264 [[nodiscard]] bool isLocked() const;
265 [[nodiscard]] bool canInteract() const;
266 [[nodiscard]] bool hasSelectedDescendent() const;
267 void updateModifiedTime(Time time = Time::SystemTime());
268 void updateAscTime(const Time& time, bool include_self);
269 void updateDescTime(const Time& time, bool include_self);
270 void setLayer(Model layer);
271 void clearLayer();
272 [[nodiscard]] uint04 getChildIndex() const;
273 [[nodiscard]] uint04 getChildLayerIndex() const;
274
275 void setChildIndex(uint04 child, uint04 id);
276 [[nodiscard]] Model getChild(uint04 child) const;
277 [[nodiscard]] uint04 getChildIndex(uint04 child) const;
278 [[nodiscard]] bool hasChild(uint04 child_index) const;
279 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getChildren() const;
280 [[nodiscard]] Buffer<UUID> getChildrenIDs() const;
281 [[nodiscard]] Buffer<uint04> getChildIndices() const;
282 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getChildrenByType(const String& type) const;
283 template<class t_type>
284 [[nodiscard]] Buffer<t_type> getTypeChildren(const String& type) const
285 {
286 Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> models = getChildrenByType(type);
287 Buffer<t_type> values(models.size());
288 for (uint04 i = 0; i < models.size(); i++)
289 {
290 values.add(t_type(models[i]));
291 }
292 return values;
293 }
294 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getChildrenByType(const Buffer<String>& type) const;
295 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getChildrenByName(const String& name) const;
296
297 template<class t_type>
298 [[nodiscard]] Buffer<t_type> getTypeDescendents(const String& type) const
299 {
300 Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> models = getDescendentsByType(type);
301 Buffer<t_type> values(models.size());
302 for (uint04 i = 0; i < models.size(); i++)
303 {
304 values.add(t_type(models[i]));
305 }
306 return values;
307 }
308 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getDescendentsByType(const String& type, uint04 max_count = Constant<uint04>::Max) const;
309 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getDescendentsByName(const String& name, uint04 max_count = Constant<uint04>::Max) const;
310 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getDescendentsByNameAndType(const String& name, const String& type, uint04 max_count = Constant<uint04>::Max) const;
311
312 [[nodiscard]] uint04 childCount() const;
313 [[nodiscard]] uint04 getNumOfEffects() const;
314 [[nodiscard]] bool hasEffect(uint04 index = 0) const;
315
316 [[nodiscard]] Effect getSceneEffect(UUID id) const;
317
318
319 [[nodiscard]] Geometry getGeometry() const;
320 [[nodiscard]] Geometry getSceneGeometry(uint04 index) const;
321 [[nodiscard]] Geometry getSceneGeometry(UUID id) const;
322 [[nodiscard]] Buffer<Geometry, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneGeometries() const;
323 [[nodiscard]] Buffer<std::pair<Model, Geometry>, uint04, ObjectAllocator<DESIGN_PRIM>> getClippingGeometry() const;
324 [[nodiscard]] Buffer<Geometry, uint04, ObjectAllocator<DESIGN_PRIM>> getGeometryDescendents(bool remove_redundant = true, uint04 max_count = Constant<uint04>::Max) const;
325 void removeGeometry();
326
327 [[nodiscard]] bool hasMaterial() const;
328 [[nodiscard]] bool hasMaterial(PrimitiveProperty property) const;
329 [[nodiscard]] Material getMaterial(PrimitiveProperty property) const;
330 [[nodiscard]] Material getSceneMaterial(uint04 index) const;
331 [[nodiscard]] Material getRootMaterial(PrimitiveProperty property) const;
332 [[nodiscard]] Material getSceneMaterial(UUID id) const;
333 [[nodiscard]] bool hasLayerRootMaterial(PrimitiveProperty property) const;
334 [[nodiscard]] Buffer<Material, uint04, ObjectAllocator<DESIGN_PRIM>> getMaterialChildren() const;
335 [[nodiscard]] Buffer<Material, uint04, ObjectAllocator<DESIGN_PRIM>> getMaterialDescendents(bool local_only = false) const;
336 [[nodiscard]] Buffer<Material, uint04, ObjectAllocator<DESIGN_PRIM>> getMaterialDescendents(PrimitiveProperty property) const;
337 [[nodiscard]] Buffer<Material, uint04, ObjectAllocator<DESIGN_PRIM>> getMaterialDescendentsByName(const String& name, uint04 max_count = Constant<uint04>::Max) const;
338 [[nodiscard]] Buffer<Material, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneMaterials() const;
339 void removeMaterial(const Material& material);
340 void removeMaterial(PrimitiveProperty property);
341
342
343 [[nodiscard]] Buffer<Effect, uint04, ObjectAllocator<false>> getEffectChildren() const;
344 [[nodiscard]] Buffer<Effect, uint04, ObjectAllocator<false>> getEffectDescendents() const;
345 [[nodiscard]] Buffer<Effect, uint04, ObjectAllocator<false>> getSceneEffects() const;
346 [[nodiscard]] Effect getEffect(uint04 index = 0) const;
347
348 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneModels(bool include_deleted = false, bool local_only = false) const;
349 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneModelsByType(const String& type, uint04 max_count = Constant<uint04>::Max, bool include_deleted = false) const;
350 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneModelsByName(const String& name, uint04 max_count = Constant<uint04>::Max, bool include_deleted = false) const;
351 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneLayers(bool include_deleted = false) const;
352 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getDescendents(bool include_deleted = false, bool local_only = false) const;
353
354 void clearChildren();
355 void removeChild(const Model& model);
356
357 [[nodiscard]] uint04 visibleVertexCount() const;
358 [[nodiscard]] uint04 vertexCount() const;
359
360 [[nodiscard]] Model getFamilyMember(uint04 index) const;
361 [[nodiscard]] Model findDescendentByName(const String& name) const;
362 [[nodiscard]] Model findDescendentByType(const String& type) const;
363
364 [[nodiscard]] bool hasDescendent(const Model& model) const;
365 [[nodiscard]] bool hasDescendent(const UUID& id) const;
366
367 void setWindingMode(WindingMode mode);
368
369 [[nodiscard]] Matrix<fltp08> getCompleteTransform() const;
370 [[nodiscard]] Matrix<fltp08> getParentTransform() const;
371
372
373
374 [[nodiscard]] Bounds<3, fltp08> getBounds() const;
375 [[nodiscard]] Bounds<3, fltp08> globalBounds() const;
376 [[nodiscard]] Bounds<3, fltp08> globalSelectionBounds() const;
377 [[nodiscard]] Bounds<3, fltp08> getBoundsOfVisible() const;
378 [[nodiscard]] Bounds<3, fltp08> getSelectionBounds() const;
379 [[nodiscard]] Vector<3, fltp08> size() const;
380 void setSize(const Vector<3, fltp08>& size);
381 Matrix<fltp08> applyTransformToParent(const Matrix<fltp08>& parent_mat) const;
382 //virtual bool processSelection(SelectionInfo& info) const override;
383 //Returns the greatest modified time of this + all descendents
384 [[nodiscard]] Time getDescModifiedTime(bool include_self) const;
385
386 //Returns the greatest modified time of this + all parents
387 [[nodiscard]] Time getAscModifiedTime(bool include_self, bool include_layer = true) const;
388
389 //Centers th
390 Vertex<3, fltp08> centerAlignModel();
391 void calculateIndexNeighborList();
392 void updateFrom(const Model& model, bool check_resources);
393 Dictionary<UUID, DesignObject> copyFrom(const Model& model, bool deep_copy, bool copy_ids = false, bool recursive = true);
394 Dictionary<UUID, DesignObject> copyMaterialProperties(const Model& model);
395 void calculateSmoothTextures(Vector<3, fltp08> origin, fltp08 scale);
396 void setNormalMode(NormalMode mode, Angle<fltp08> smoothing_angle, ProgressInfo* log);
397 void setOrientation(const Vector<3, Angle<sint04>>& new_orientation, const void* lock = nullptr);
398 void setOrientation(const Vector<3, Angle<fltp08>>& new_orientation, const void* lock = nullptr);
399 void calculateNormals(NormalMode mode, Angle<fltp08> smoothing_angle);
400 void removeDuplicateVertices(fltp08 epsilon, void* lock, ProgressInfo* log = nullptr);
401 bool isDeleted() const;
402 bool hasHoles(PrimitiveProperty property) const;
403 void calculateTangentSpace(bool calc_tan, bool calc_bitan);
404 void addPerVertexColorFromMaterialConstant(UVType constant_index);
405 bool isScene() const;
406 void validate(bool validate_children = true) const;
407 void invalidateBounds();
408 void invalidateVisibleBounds();
409 void invalidateGlobalBoundsAsc();
410 void invalidateGlobalBoundsDesc();
411 void invalidateTransformCache();
412
413 [[nodiscard]] fltp08 calculateVolume(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::NaN) const;
414 [[nodiscard]] fltp08 calculateSurfaceArea(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::NaN) const;
415 [[nodiscard]] Vector<2, fltp08> calculateVolumeAndSurfaceArea(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::NaN, const void* lock = nullptr) const;
416 [[nodiscard]] fltp08 calculateLength(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::NaN) const;
417 [[nodiscard]] Vector<3, fltp08> calculateAverageDirection(const Matrix<fltp08>& parent_transform = Constant<Matrix<fltp08>>::NaN) const;
418 [[nodiscard]] Vector<2, fltp08> calculateHVLength(const Matrix<fltp08>& parent_transform = Constant<Matrix<fltp08>>::NaN) const;
419 [[nodiscard]] uint04 getGeometryIndex() const;
420 [[nodiscard]] uint04 getMaterialIndex(PrimitiveProperty property) const;
421 [[nodiscard]] uint04 getEffectIndex(uint04 child_index = 0) const;
422 //uint04 getRootMaterialIndex(PrimitiveProperty property) const;
423
424
425 [[nodiscard]] Vector<32, bool> inheritedFlags() const;
426 void updateInheritedFlagsCache(bool force_update_all = false, bool update_personal_flags = false);
427 [[nodiscard]] Vector<32, bool> inheritedPersonalFlagsNoCache() const;
428 [[nodiscard]] Vector<32, bool> personalInheritedFlags() const;
429 [[nodiscard]] Vector<32, bool> inheritedFlagsNoCache(bool complete_cache_ignore) const;
430
431 [[nodiscard]] Model getRootMaterialModel(PrimitiveProperty property);
432 [[nodiscard]] BitFlag descendedFlags() const;
433 void updateDescendedFlagsCache(bool force_update_all = false);
434 [[nodiscard]] BitFlag descendedPersonalFlagsNoCache() const;
435 [[nodiscard]] BitFlag personalDescendedFlags() const;
436 [[nodiscard]] BitFlag descendedFlagsNoCache(bool complete_cache_ignore) const;
437 operator bool() const
438 {
439 return isValid();
440 }
441
442 Geometry createSceneGeometry() const;
443 Material createSceneMaterial() const;
446 , const std::function<bool(const Model&, const Set<Model>&)>& filter);
447 protected:
448 //Returns the greatest modified time of this + all descendents
449 Model getRootMaterialModel(PrimitiveProperty property, const Model& value_to_return, bool allow_layer) const;
450 Vertex<3, fltp08> _center();
451 Bounds<3, fltp08> _bounds(bool use_selection_bounds, bool get_global) const;
452 void setChildEffectSize(uint04 child_size);
453 void setChildSize(uint04 child_size);
454 void setGeometryIndex(uint04 geo_index);
455 void setMaterialIndex(PrimitiveProperty property, uint04 material_index);
456 void setMaterialIndex(uint04 material_index);
457 void setEffectIndex(uint04 material_index, uint04 sub_index = 0);
458
459 void setPersonalInheritedFlags(const Vector<32, bool>& flags);
460 void setPersonalInheritedFlag(InheritedFlags flag, bool value);
461
462 void _copyFrom(const Model& model, bool deep_copy, bool copy_ids, bool recursive_copy, Dictionary<UUID, DesignObject>& copy_to_index, bool is_root_copy);
463 uint04 childToParentReference() const;
464 uint04 parentToChildReference() const;
465 DesignObjectBase* childBase() const;
466 DesignObjectBase* parentBase() const;
467 };
468
469 template<>
470 struct ObjectInfo<Model, false, false>
471 {
472 static const uint01 Dimensions = 0;
473 static const bool Vector = false;
474 static const bool Buffer = false;
475 static const bool Primitive = DESIGN_PRIM;
476 static const bool Pointer = false;
477 static const bool Unsigned = false;
478 static const bool Float = false;
479 static const bool Integer = false;
480 static const bool Number = false;
481 static const bool Enum = false;
482 static const bool String = false;
483 static const bool Color = false;
484 static const bool Boolean = false;
486 };
487
488 //static_assert(!std::is_polymorphic<Model>(), "Model should not be polymorphic");
489
491 {
492 public:
493 Scene();//Invalid object
494 Scene(const TranslatedString& name, DesignObjectBase* base = nullptr);
495 Scene(const File& file, DesignObjectBase* base = nullptr);
496 Scene(const String& file, DesignObjectBase* base = nullptr) = delete;
497 Scene(const TranslatedString& name, Scene& application_scene, DesignObjectBase* base = nullptr);
498 Scene(DesignObjectBase* base);
499
500 explicit Scene(const Model& model);
501
502 void createDefaultMaterial();
503 bool hasVertexColumn(const String& name) const;
504 bool hasVertexColumn(VertexProperty property) const;
505 bool hasVertexIndexColumn() const;
506 bool isApplicationOwned() const;
507 void deleteBase() const;
508 Buffer<UUID> allObjectIDs(bool include_deleted) const;
509 Scene applicationScene() const;
510
511 TableColumn& vertexColumn(const String& name);
512 const TableColumn& vertexColumn(const String& name) const;
513 const TableColumn& vertexColumn(VertexProperty property) const;
514 const TableColumn& vertexIndexColumn() const;
515 static const Scene CreateApplicationScene(const TranslatedString& string);
516 };
517
518 template<>
519 struct ObjectInfo<Scene, false, false>
520 {
521 static const uint01 Dimensions = 0;
522 static const bool Vector = false;
523 static const bool Buffer = false;
524 static const bool Primitive = DESIGN_PRIM;
525 static const bool Pointer = false;
526 static const bool Unsigned = false;
527 static const bool Float = false;
528 static const bool Integer = false;
529 static const bool Number = false;
530 static const bool Enum = false;
531 static const bool String = false;
532 static const bool Color = false;
533 static const bool Boolean = false;
535 };
536 template<>
538 {
539 /** The NaN. */
540 static const Model NaN;
541 };
542
544}
545namespace std//Define things to allow use within std libs
546{
547 template <>
548 struct hash<NDEVR::Model>
549 {
550 std::size_t operator()(const NDEVR::Model& d) const noexcept
551 {
552 NDEVR::UUID s = d.uuid();
553 std::size_t value = 0;
554 for (NDEVR::uint01 i = 0; i < 8; i++)
555 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
556 return value;
557 }
558 };
559 template <>
560 struct hash<NDEVR::Scene>
561 {
562 std::size_t operator()(const NDEVR::Scene& d) const noexcept
563 {
564 NDEVR::UUID s = d.uuid();
565 std::size_t value = 0;
566 for (NDEVR::uint01 i = 0; i < 8; i++)
567 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
568 return value;
569 }
570 };
571};
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
Stores an angle in an optimized format.
Definition StringStream.h:352
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:68
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:57
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
void add(t_type &&object)
Definition Buffer.hpp:199
constexpr t_index_type size() const
Definition Buffer.hpp:1461
Definition Color.h:36
Definition DesignObjectBase.h:140
Definition DesignObject.h:66
Definition Dictionary.h:48
Definition Effect.h:42
Definition File.h:47
Definition Geometry.h:64
Definition Material.h:45
Definition Matrix.hpp:173
Definition Model.h:54
bool doesModelPropertyContain(ModelProperty property, const char *value, bool ignore_case) const
Definition Model.h:168
Buffer< t_type > getTypeDescendents(const String &type) const
Definition Model.h:298
ModelColorMode
Definition Model.h:198
void updateModelProperty(ModelProperty property, const t_type &type, const void *lock_ptr=nullptr)
Definition Model.h:142
Model()
Definition Model.h:124
bool doesModelPropertyContain(ModelProperty property, const String &value, bool ignore_case) const
Definition Model.h:164
MaterialMode
Definition Model.h:57
bool isModelProperty(ModelProperty property, const String &value) const
Definition Model.h:156
DescendedFlags
Definition Model.h:92
bool isModelProperty(ModelProperty property, const char *value) const
Definition Model.h:160
InheritedFlags
Definition Model.h:76
Buffer< t_type > getTypeChildren(const String &type) const
Definition Model.h:284
void setModelProperty(ModelProperty property, const t_type &value)
Definition Model.h:137
t_type getModelProperty(ModelProperty property) const
Definition Model.h:152
ParentMatrixFlags
Definition Model.h:64
ModelProperty
Definition Model.h:99
Definition MemoryManager.h:283
Definition Pointer.hpp:62
Definition ProgressInfo.hpp:43
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Definition Model.h:491
Scene(const String &file, DesignObjectBase *base=nullptr)=delete
Definition Model.h:51
Definition String.h:40
Definition StringStream.h:62
Definition TableColumn.h:68
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition TranslatedString.h:9
Definition UUID.h:66
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
A vertex.
Definition Vertex.hpp:54
Definition RWLock.h:99
Definition ACIColor.h:37
NormalMode
Definition DesignObjectBase.h:105
VertexProperty
Definition DesignObjectBase.h:52
@ e_by_layer
Definition CADEntities.h:45
constexpr bool DESIGN_PRIM
Definition DesignObject.h:47
PrimitiveProperty
Definition DesignObjectBase.h:44
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
@ e_type
Definition ModuleResourceManager.h:40
WindingMode
Definition DesignObjectBase.h:97
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
UVType
Definition DesignObjectBase.h:127
Definition File.h:213
static const Model NaN
Definition Model.h:540
Definition BaseValues.hpp:272
static constexpr ObjectInfo< Model, false, false > VectorSub()
Definition Model.h:485
static constexpr ObjectInfo< Scene, false, false > VectorSub()
Definition Model.h:534
Information about the object.
Definition ObjectInfo.h:56
std::size_t operator()(const NDEVR::Model &d) const noexcept
Definition Model.h:550
std::size_t operator()(const NDEVR::Scene &d) const noexcept
Definition Model.h:562