Artec 3D Scanning SDK  2.0
BuffIO.h
Go to the documentation of this file.
1 /********************************************************************
2 *
3 * Project Artec 3D Scanning SDK
4 *
5 * Purpose: Internal BUFF file format support.
6 *
7 * Copyright: Artec Group
8 *
9 ********************************************************************/
10 
11 #ifndef _BUFFIO_H_
12 #define _BUFFIO_H_
13 
16 
17 namespace artec { namespace sdk { namespace base
18 {
19 
20 class ICancellationToken;
21 class IProgressInfo;
22 
23 namespace io {
24 
25 extern "C" {
26 
27 /** Save IFrameMesh to BUFF file
28 * @param path - file path where to save mesh
29 * @param mesh - mesh to save
30 * @param progr - progress interface
31 * @param cncl - cancellation interface
32 */
34  saveBuffFrameToFile(const wchar_t* path, const IFrameMesh* mesh, IProgressInfo* progr = 0, ICancellationToken* cncl = 0);
35 
36 /** Save IFrameMesh to BUFF blob
37 * @note Saves only geometry without texture (image is stored in a separate blob)
38 * @param data - blob where to save mesh
39 * @param mesh - mesh to save
40 * @param progr - progress interface
41 * @param cncl - cancellation interface
42 */
44  saveBuffFrameToBlob(IBlob** data, const IFrameMesh* mesh, IProgressInfo* progr = 0, ICancellationToken* cncl = 0);
45 
46 /** Load IFrameMesh from BUFF file
47 * @param mesh - loaded mesh
48 * @param path - file path to load image from
49 * @param progr - progress interface
50 * @param cncl - cancellation interface
51 */
53  loadBuffFrameFromFile(IFrameMesh** mesh, const wchar_t* path, IProgressInfo* progr = 0, ICancellationToken* cncl = 0);
54 
55 /** Load IFrameMesh from BUFF blob
56 * @note Loads only geometry without texture (image is stored in a separate blob)
57 * @param mesh - loaded mesh
58 * @param data - blob to load image from
59 * @param progr - progress interface
60 * @param cncl - cancellation interface
61 */
63  loadBuffFrameFromBlob(IFrameMesh** mesh, const IBlob* data, IProgressInfo* progr = 0, ICancellationToken* cncl = 0);
64 
65 }
66 
67 /**
68 * Class to save/load BUFF (simple format to store mesh data).
69 * It provides convenient static methods to save and load meshes to and from BUFF files.
70 * It is composed of the following fields:
71 *
72 * - number of points : 32 bits
73 * - number of triangles : 32 bits
74 * - point coordinates : contiguous array of floats in the form x1, y1, z1, x2, y2, z2, ...,
75 * without any padding between elements
76 * - triangles indicies : contiguous array of ints in the form t11, t12, t13, t21, t22, t23, ...,
77 * without any padding between elements
78 *
79 * In other words, point array takes up 3 * sizeof(float) * (number of points) bytes. Triangle
80 * array takes up 3 * sizeof(int) * (number of triangles) bytes.
81 */
82 class Buff
83 {
84 public:
85 
86  /** Save IFrameMesh to BUFF file
87  * @param path - file path where to save mesh
88  * @param mesh - mesh to save
89  * @param progr - progress interface
90  * @param cncl - cancellation interface
91  */
92  static ErrorCode save(const wchar_t* path, const IFrameMesh* mesh, IProgressInfo* progr = 0, ICancellationToken* cncl = 0)
93  {
94  return saveBuffFrameToFile(path, mesh, progr, cncl);
95  }
96 
97  /** Save IFrameMesh to BUFF blob
98  * @note Saves only geometry without texture (image is stored in a separate blob)
99  * @param data - blob where to save mesh
100  * @param mesh - mesh to save
101  * @param progr - progress interface
102  * @param cncl - cancellation interface
103  */
104  static ErrorCode save(IBlob** data, const IFrameMesh* mesh, IProgressInfo* progr = 0, ICancellationToken* cncl = 0)
105  {
106  return saveBuffFrameToBlob(data, mesh, progr, cncl);
107  }
108 
109  /** Load IFrameMesh from BUFF file
110  * @param mesh - loaded mesh
111  * @param path - file path to load image from
112  * @param progr - progress interface
113  * @param cncl - cancellation interface
114  */
115  static ErrorCode load(IFrameMesh** mesh, const wchar_t* path, IProgressInfo* progr = 0, ICancellationToken* cncl = 0)
116  {
117  return loadBuffFrameFromFile(mesh, path, progr, cncl);
118  }
119 
120  /** Load IFrameMesh from BUFF blob
121  * @note Loads only geometry without texture (image is stored in a separate blob)
122  * @param mesh - loaded mesh
123  * @param data - blob to load image from
124  * @param progr - progress interface
125  * @param cncl - cancellation interface
126  */
127  static ErrorCode load(IFrameMesh** mesh, const IBlob* data, IProgressInfo* progr = 0, ICancellationToken* cncl = 0)
128  {
129  return loadBuffFrameFromBlob(mesh, data, progr, cncl);
130  }
131 };
132 
133 } } } } // namespace artec::sdk::base::io
134 
135 #endif // _BUFFIO_H_
ErrorCode ABASESDK_LINK_SPEC saveBuffFrameToFile(const wchar_t *path, const IFrameMesh *mesh, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Save IFrameMesh to BUFF file.
ErrorCode ABASESDK_LINK_SPEC loadBuffFrameFromBlob(IFrameMesh **mesh, const IBlob *data, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Load IFrameMesh from BUFF blob.
ErrorCode ABASESDK_LINK_SPEC saveBuffFrameToBlob(IBlob **data, const IFrameMesh *mesh, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Save IFrameMesh to BUFF blob.
static ErrorCode load(IFrameMesh **mesh, const IBlob *data, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Load IFrameMesh from BUFF blob.
Definition: BuffIO.h:127
Class to save/load BUFF (simple format to store mesh data).
Definition: BuffIO.h:82
Indexed triangle mesh with optional texture.
Definition: IFrameMesh.h:42
static ErrorCode load(IFrameMesh **mesh, const wchar_t *path, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Load IFrameMesh from BUFF file.
Definition: BuffIO.h:115
Callback interface to notify process about cancellation.
Interface for Binary Large Object (memory chunk) with smart reference counting.
Definition: IBlob.h:35
Interface for a progress notification listener.
Definition: IProgressInfo.h:76
ErrorCode ABASESDK_LINK_SPEC loadBuffFrameFromFile(IFrameMesh **mesh, const wchar_t *path, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Load IFrameMesh from BUFF file.
static ErrorCode save(const wchar_t *path, const IFrameMesh *mesh, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Save IFrameMesh to BUFF file.
Definition: BuffIO.h:92
#define ABASESDK_LINK_SPEC
static ErrorCode save(IBlob **data, const IFrameMesh *mesh, IProgressInfo *progr=0, ICancellationToken *cncl=0)
Save IFrameMesh to BUFF blob.
Definition: BuffIO.h:104