Artec 3D Scanning SDK  2.0
ICompositeMesh.h
Go to the documentation of this file.
1 /********************************************************************
2 *
3 * Project Artec 3D Scanning SDK
4 *
5 * Purpose: 3D mesh interface implementation - geometry only and textured.
6 *
7 * Copyright: Artec Group
8 *
9 ********************************************************************/
10 
11 #ifndef _ICOMPOSITEMESH_H_
12 #define _ICOMPOSITEMESH_H_
13 
15 #include <artec/sdk/base/IMesh.h>
16 #include <artec/sdk/base/Uuid.h>
17 
18 namespace artec { namespace sdk { namespace base
19 {
20 
21 class ITexture;
22 class ICompositeMesh;
23 
24 extern "C"
25 {
26 /**
27 * @brief Create composite mesh with given name and new uuid.
28 * @param mesh Composite mesh to return.
29 * @param vertexCount Number of points (vertices) to pre-allocate.
30 * @param triangleCount Number of triangles (index triplets) to pre-allocate.
31 */
33  createCompositeMesh(ICompositeMesh** mesh, int vertexCount = 0, int triangleCount = 0, const wchar_t* name = NULL);
34 
35 }
36 
37 /**
38 * @brief Indexed triangle mesh with optional unwrapped textures
39 *
40 * @details Designed to store complex textured mesh. Mesh may contain one or more textures.
41 * Each triangle can be associated with only one or no texture.
42 * @nosubgrouping
43 */
44 class ICompositeMesh : public IMesh
45 {
46 public:
47  /// @brief Check the presence of texture.
48  virtual bool isTextured() const = 0;
49 
50  /// @{ @name Texture access functions
51 
52  /// @brief Get number of textures.
53  /// @return Number of textures.
54  virtual int getTexturesCount() const = 0;
55 
56  /// @brief Add texture.
57  /// @param texture Texture to set.
58  virtual void addTexture(ITexture* texture) = 0;
59 
60  /// @brief Get i-th texture.
61  /// @return I-th texture interface.
62  virtual ITexture* getTexture(int index) const = 0;
63  /// @}
64 
65  /// @{ @name Triangle-index related functions.
66 
67  /// @brief Get texture status for i-th triangle.
68  /// @return True if the triangle is textured.
69  virtual bool isTriangleTextured(int i) const = 0;
70 
71  /// @brief Get texture for i-th triangle of the mesh.
72  /// @return For untextured triangles, it return empty ITexture object without IImage and UV coordinates.
73  virtual const ITexture* getTriangleTexture(int i) const = 0;
74 
75  /// @brief Get triplet of texture coordinates for i-th triangle.
76  /// @return Texture coordinates for triangle.
77  virtual TriangleUV getTriangleUV(int i) const = 0;
78  /// @}
79 
80  /// @brief Get textured triangles.
81  /// @details Return the texture index for each textured triangle (as arrays).
82  /// @param triangleIndices IArrayInt of triangle indices to return.
83  /// @param textureIndices IArrayInt of texture indices to return.
84  virtual void getTexturedTriangles(const IArrayInt** triangleIndices, const IArrayInt** textureIndices) const = 0;
85 
86  /// @brief Get untextured triangle indices (as array).
87  /// @return Array of untextured triangle indices.
88  virtual const IArrayInt* getUntexturedTriangles() const = 0;
89 
90  /// @brief Collect textured triangle indices.
91  /// @param clearEmpty Delete texture if either UV coordinates or texture image is empty.
92  virtual ErrorCode validateTextures(bool clearEmpty = true) = 0;
93 
94  /// @{ Access composite mesh uuid
95  virtual const Uuid& getUuid() const = 0;
96  virtual void setUuid(const Uuid& uuid) = 0;
97  /// @}
98 
99  /// @{ Access composite mesh name
100  virtual const wchar_t* getName() const = 0;
101  virtual void setName(const wchar_t* name) = 0;
102  /// @}
103 };
104 
105 } } } // namespace artec::sdk::base
106 
107 #endif // _IPOLYMESH_H_
Indexed triangle mesh.
Definition: IMesh.h:32
virtual ITexture * getTexture(int index) const =0
Get i-th texture.
virtual void setName(const wchar_t *name)=0
Access composite mesh name.
ErrorCode ABASESDK_LINK_SPEC createCompositeMesh(ICompositeMesh **mesh, int vertexCount=0, int triangleCount=0, const wchar_t *name=NULL)
Create composite mesh with given name and new uuid.
virtual const IArrayInt * getUntexturedTriangles() const =0
Get untextured triangle indices (as array).
Common texture handling interface.
Definition: ITexture.h:36
Interface for array of integer data that supports smart reference counting.
Definition: IArray.h:79
virtual bool isTriangleTextured(int i) const =0
Get texture status for i-th triangle.
Set of three texture coordinates.
Definition: Types.h:58
virtual void setUuid(const Uuid &uuid)=0
Access composite mesh uuid.
virtual int getTexturesCount() const =0
Get number of textures.
virtual const Uuid & getUuid() const =0
Access composite mesh uuid.
virtual ErrorCode validateTextures(bool clearEmpty=true)=0
Collect textured triangle indices.
Indexed triangle mesh with optional unwrapped textures.
virtual const ITexture * getTriangleTexture(int i) const =0
Get texture for i-th triangle of the mesh.
virtual void getTexturedTriangles(const IArrayInt **triangleIndices, const IArrayInt **textureIndices) const =0
Get textured triangles.
virtual void addTexture(ITexture *texture)=0
Add texture.
virtual const wchar_t * getName() const =0
Access composite mesh name.
#define ABASESDK_LINK_SPEC
virtual bool isTextured() const =0
Check the presence of texture.
virtual TriangleUV getTriangleUV(int i) const =0
Get triplet of texture coordinates for i-th triangle.