TDME2  1.9.200
ModelUtilitiesInternal.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <unordered_map>
5 
6 #include <tdme/tdme.h>
11 #include <tdme/math/Matrix4x4.h>
13 
14 using std::string;
15 using std::unordered_map;
16 
23 
24 /**
25  * Model utilities
26  * @author Andreas Drewke
27  */
29 {
30 public:
31  /**
32  * Creates a bounding box from given model
33  * @param model model
34  * @param overriddenNodeTransformMatrices overridden node transform matrices
35  * @return axis aligned bounding box
36  */
37  static BoundingBox* createBoundingBox(Model* model, const unordered_map<string, Matrix4x4*> overriddenNodeTransformMatrices = unordered_map<string, Matrix4x4*>());
38 
39  /**
40  * Invert normals of a model
41  * @param model model
42  */
43  static void invertNormals(Model* model);
44 
45  /**
46  * Compute model statistics
47  * @param model model
48  * @param modelStatistics model statistics
49  */
50  static void computeModelStatistics(Model* model, ModelStatistics* modelStatistics);
51 
52  /**
53  * Compute model statistics
54  * @param objectModelInternal object model internal
55  * @param modelStatistics model statistics
56  */
57  static void computeModelStatistics(ObjectModelInternal* objectModelInternal, ModelStatistics* modelStatistics);
58 
59  /**
60  * Compute if model 1 equals model 2
61  * @param model1 model 1
62  * @param model2 model 2
63  * @return model1 equals model2
64  */
65  static bool equals(Model* model1, Model* model2);
66 
67  /**
68  * Compute if model 1 equals model 2
69  * @param objectModel1Internal model 1
70  * @param objectModel2Internal model 2
71  * @return model1 equals model2
72  */
73  static bool equals(ObjectModelInternal* objectModel1Internal, ObjectModelInternal* objectModel2Internal);
74 
75 private:
76  /**
77  * Creates a bounding box from given object model
78  * @param objectModelInternal model
79  * @return axis aligned bounding box
80  */
81  static BoundingBox* createBoundingBox(ObjectModelInternal* objectModelInternal);
82 
83  /**
84  * Creates a bounding box from given object model without mesh
85  * @param objectModelInternal model
86  * @return boundingBox axis aligned bounding box
87  */
88  static BoundingBox* createBoundingBoxNoMesh(ObjectModelInternal* objectModelInternal);
89 
90  /**
91  * Invert normals recursive
92  * @param nodes nodes
93  */
94  static void invertNormals(const unordered_map<string, Node*>& nodes);
95 
96 };
Representation of a 3D model.
Definition: Model.h:35
Model node.
Definition: Node.h:32
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
Definition: BoundingBox.h:26
static void invertNormals(Model *model)
Invert normals of a model.
static void computeModelStatistics(Model *model, ModelStatistics *modelStatistics)
Compute model statistics.
static bool equals(Model *model1, Model *model2)
Compute if model 1 equals model 2.
static BoundingBox * createBoundingBox(Model *model, const unordered_map< string, Matrix4x4 * > overriddenNodeTransformMatrices=unordered_map< string, Matrix4x4 * >())
Creates a bounding box from given model.
static BoundingBox * createBoundingBoxNoMesh(ObjectModelInternal *objectModelInternal)
Creates a bounding box from given object model without mesh.
Object model To be used in non engine context.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23