Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
3DExtraData.h
Go to the documentation of this file.
1//! @file 3DExtraData.h
2//! @brief This file contains implementation of different extra data information that can be attached through CPointList::AddDataChunk or CFaceList::AddDataChunk
3//! Using these methods, you can attached any kind of information to your points or your faces. This information follow all the operations performed on the face list or point list.\n
4//! The following extra data allow to retrieve the original point or face index, which can be useful after an optimization or any operation that modify the order of these information.
5//!
6//////////////////////////////////////////////////////////////////////
7
8#ifndef CLASS_3DEXTRA_DATA_H
9#define CLASS_3DEXTRA_DATA_H
10
11#ifdef _MSC_VER
12#pragma once
13#endif // _MSC_VER
14
15#include "ElementArray.h"
16
17BEGIN_MOOTOOLS_NAMESPACE
18
19////////////////////////////////////////////////////////////////////////////////////////////
20// This file contains some extra data class that can be added to a face list or a point list
21// Using AddDataChunk method.
22
23////////////////////////////////////////////
24//! @class COriginalIndexData
25//! @brief Class for storing the original face index in CFaceList::SaveFacesIndex or CPointList::SavePointsIndex, in a data chunk
26
28{
29 public:
30 unsigned int index;
32};
33
34class DLL_3DFUNCTION COriginalIndexMethods : public CElementMethods
35{
36 DECLARE_SERIAL_XOBJECT(COriginalIndexMethods);
37
38 SIZET GetSizeof() const;
39 ElementType GetType() const;
40 ElementType GetBaseType() const;
41 void ConstructElement(void* pNewData);
42};
43
44///////////////////////////////////////////////////////////////////////////////////
45// COriginalIndexData / COriginalIndexMethods
46inline COriginalIndexData::COriginalIndexData()
47{
48 index = (unsigned int)-1;
49}
50
51inline SIZET COriginalIndexMethods::GetSizeof() const
52{
53 return sizeof(COriginalIndexData);
54}
55
56inline ElementType COriginalIndexMethods::GetType() const
57{
58 return MAKE_CUSTOM_ID('O', 'R', 'I', 'N');
59}
60
61inline ElementType COriginalIndexMethods::GetBaseType() const
62{
63 return MAKE_CUSTOM_ID('O', 'R', 'I', 'N');
64}
65
66// VS 2010 the compiler can generate an error compiling this file (pNewData unrecognized).
67// This sometimes occurs when the #include directive is placed after some code...
68inline void COriginalIndexMethods::ConstructElement(void* pNewData)
69{
70 xConstruct(COriginalIndexData, pNewData);
71}
72
73////////////////////////////////////////////
74//! @class CBackFaceMaterialData
75//! @brief Class for storing the back face material using FACE_BACK_MATERIAL id in C3DFaceList::AddDataChunk
76
78{
79 public:
80 MaterialID matid;
82};
83
84class DLL_3DFUNCTION CBackFaceMaterialMethods : public CElementMethods
85{
86 DECLARE_SERIAL_XOBJECT(CBackFaceMaterialMethods);
87
88 SIZET GetSizeof() const;
89 ElementType GetType() const;
90 ElementType GetBaseType() const;
91 void ConstructElement(void* pNewData);
92};
93
94///////////////////////////////////////////////////////////////////////////////////
95// CBackFaceMaterialData / CBackFaceMaterialMethods
96inline CBackFaceMaterialData::CBackFaceMaterialData()
97{
98 matid = MATERIAL_UNDEFINED; // MATERIAL_UNDEFINED means that the face does not use back material and front material is valid for both sides
99}
100
101inline SIZET CBackFaceMaterialMethods::GetSizeof() const
102{
103 return sizeof(CBackFaceMaterialData);
104}
105
106inline ElementType CBackFaceMaterialMethods::GetType() const
107{
108 return MAKE_CUSTOM_ID('B', 'K', 'M', 'T');
109}
110
111inline ElementType CBackFaceMaterialMethods::GetBaseType() const
112{
113 return MAKE_CUSTOM_ID('B', 'K', 'M', 'T');
114}
115
116// VS 2010 the compiler can generate an error compiling this file (pNewData unrecognized).
117// This sometimes occurs when the #include directive is placed after some code...
118inline void CBackFaceMaterialMethods::ConstructElement(void* pNewData)
119{
120 xConstruct(CBackFaceMaterialData, pNewData);
121}
122
123#if 0
124////////////////////////////////////////////
125// CFaceTagID
126// Class for storing a tag value that can be used with ConcatenateByTag
127class CFaceTagID
128{
129public:
130 unsigned int tagid;
131 CFaceTagID();
132};
133
134class DLL_3DFUNCTION CFaceTagIDMethods : public CElementMethods
135{
136 DECLARE_SERIAL_XOBJECT(CFaceTagIDMethods);
137
138 SIZET GetSizeof() const;
139 ElementType GetType() const;
140 ElementType GetBaseType() const;
141 void ConstructElement(void* pNewData);
142};
143
144///////////////////////////////////////////////////////////////////////////////////
145// CFaceTagID / CFaceTagIDMethods
146inline CFaceTagID::CFaceTagID()
147{
148 tagid = 0;
149}
150
151inline SIZET CFaceTagIDMethods::GetSizeof() const
152{
153 return sizeof(CFaceTagID);
154}
155
156inline ElementType CFaceTagIDMethods::GetType() const
157{
158 return MAKE_CUSTOM_ID('T', 'G', 'I', 'D');
159}
160
161inline ElementType CFaceTagIDMethods::GetBaseType() const
162{
163 return MAKE_CUSTOM_ID('T', 'G', 'I', 'D');
164}
165
166// VS 2010 the compiler can generate an error compiling this file (pNewData unrecognized).
167// This sometimes occurs when the #include directive is placed after some code...
168inline void CFaceTagIDMethods::ConstructElement(void* pNewData)
169{
170 xConstruct(CFaceTagIDMethods, pNewData);
171}
172#endif
173
174////////////////////////////////////////////
175//! @class CMaxFaceData
176//! @brief Class for storing the 3ds Max extra information
177
178#define FACE_3DSMAX_EXTRA_DATA MAKE_CUSTOM_ID('M', 'X', 'E', 'X')
179#define FACE_3DSMAX_EXTRA_DATA2 MAKE_CUSTOM_ID('M', 'X', 'E', '2')
180
181class CMaxFaceData
182{
183 public:
184 unsigned int smoothGroup;
185 CMaxFaceData();
186};
187
188////////////////////////////////////////////
189//! @class CMaxFaceData2
190//! @brief Class for storing the 3ds Max extra information
191
192class CMaxFaceData2 : public CMaxFaceData
193{
194 public:
195 unsigned int submat;
196
197 CMaxFaceData2();
198};
199
200inline CMaxFaceData::CMaxFaceData()
201{
202 smoothGroup = 0;
203}
204
205inline CMaxFaceData2::CMaxFaceData2()
206{
207 submat = 0;
208}
209
210class DLL_3DFUNCTION CMaxFaceMethods : public CElementMethods
211{
212 DECLARE_SERIAL_XOBJECT(CMaxFaceMethods);
213
214 SIZET GetSizeof() const;
215 ElementType GetType() const;
216 ElementType GetBaseType() const;
217 void ConstructElement(void* pNewData);
218};
219
220inline SIZET CMaxFaceMethods::GetSizeof() const
221{
222 return sizeof(CMaxFaceData);
223}
224
225inline ElementType CMaxFaceMethods::GetType() const
226{
227 return MAKE_CUSTOM_ID('M', 'X', 'D', 'T');
228}
229
230inline ElementType CMaxFaceMethods::GetBaseType() const
231{
232 return MAKE_CUSTOM_ID('M', 'X', 'D', 'T');
233}
234
235inline void CMaxFaceMethods::ConstructElement(void* pNewData)
236{
237 xConstruct(CMaxFaceData, pNewData);
238}
239
240class DLL_3DFUNCTION CMaxFaceMethods2 : public CMaxFaceMethods
241{
242 DECLARE_SERIAL_XOBJECT(CMaxFaceMethods2);
243
244 SIZET GetSizeof() const;
245 ElementType GetType() const;
246 void ConstructElement(void* pNewData);
247};
248
249inline SIZET CMaxFaceMethods2::GetSizeof() const
250{
251 return sizeof(CMaxFaceData2);
252}
253
254inline ElementType CMaxFaceMethods2::GetType() const
255{
256 return MAKE_CUSTOM_ID('M', 'X', 'D', '2');
257}
258
259inline void CMaxFaceMethods2::ConstructElement(void* pNewData)
260{
261 xConstruct(CMaxFaceData2, pNewData);
262}
263
264END_MOOTOOLS_NAMESPACE
265
266#endif
An advanced array class containing data that needs to be construct / destruct.
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
Class for storing the back face material using FACE_BACK_MATERIAL id in C3DFaceList::AddDataChunk.
Definition 3DExtraData.h:78
CElementMethods is provided to CElementArray and give some information on the data as well as the met...
Definition ElementArray.h:22
Class for storing the original face index in CFaceList::SaveFacesIndex or CPointList::SavePointsIndex...
Definition 3DExtraData.h:28