1 | /**************************************************************************************** |
2 | |
3 | Copyright (C) 2015 Autodesk, Inc. |
4 | All rights reserved. |
5 | |
6 | Use of this software is subject to the terms of the Autodesk license agreement |
7 | provided at the time of installation or download, or which otherwise accompanies |
8 | this software in either electronic or hard copy form. |
9 | |
10 | ****************************************************************************************/ |
11 | |
12 | //! \file fbxgeometrybase.h |
13 | #ifndef _FBXSDK_SCENE_GEOMETRY_BASE_H_ |
14 | #define _FBXSDK_SCENE_GEOMETRY_BASE_H_ |
15 | |
16 | #include <fbxsdk/fbxsdk_def.h> |
17 | |
18 | #include <fbxsdk/core/base/fbxarray.h> |
19 | #include <fbxsdk/core/math/fbxvector4.h> |
20 | #include <fbxsdk/scene/geometry/fbxlayercontainer.h> |
21 | |
22 | #include <fbxsdk/fbxsdk_nsbegin.h> |
23 | |
24 | class FbxStatus; |
25 | |
26 | /** This class is the base class for geometric object such as meshes, NURBS and patches. |
27 | * Use the FbxGeometryBase class to manage the control points, normals, binormals and tangents of the |
28 | * geometries. |
29 | * The meaning of "control point" is dependent of the geometry object type. For meshes, the "control point" |
30 | * is the physical 3D coordinate of polygon vertices while, for NURBS, it is the the actual control point on the curves |
31 | * defining the surface. This class also allow you to define normals, binormals and tangents regardless of the type of |
32 | * geometric object. However, in reality, applying such definitions to NURBS and patches does not make much sense |
33 | * since these definitions would only exist at the control points and inbetween them, the interpolation would certainly not |
34 | * follow the curve. |
35 | * |
36 | * Geometric objects are using a system of layered data to extend their construction definition. For example, a typical |
37 | * layer for a Mesh contains Normals, UVs and Materials but client applications can decide to define another set of |
38 | * Normals and UVs and swap them during the rendering phase to produce some different results. The combinations are limitless |
39 | * and it would be impossible to discuss them all. This example has been presented to show one possible context where |
40 | * layers can be used. More information can be found in the FbxLayerContainer and FbxLayer classes description. |
41 | * \nosubgrouping |
42 | */ |
43 | class FBXSDK_DLL FbxGeometryBase : public FbxLayerContainer |
44 | { |
45 | FBXSDK_OBJECT_DECLARE(FbxGeometryBase, FbxLayerContainer); |
46 | |
47 | public: |
48 | /** |
49 | * \name Control Points, Normals, Binormals and Tangent Management. |
50 | */ |
51 | //@{ |
52 | |
53 | /** Allocates memory space for the array of control points. |
54 | * \param pCount The number of control points. |
55 | * \remarks Any previously allocated array of control points will be cleared. |
56 | */ |
57 | virtual void InitControlPoints(int pCount); |
58 | |
59 | /** Allocates memory space for the array of normals. |
60 | * \param pCount The desired size for the normal array. If pCount is specified, the array will be the same size as pCount. |
61 | * If pCount is not specified, the array will be the same length as the array of control points. |
62 | * \remarks This function must be called after function FbxLayerContainer::InitControlPoints(). |
63 | * \remarks The normals initialized with this function will have the ReferenceMode set to eDirect. Also, |
64 | * the array will always be defined on layer 0. |
65 | */ |
66 | void InitNormals(int pCount = 0 ); |
67 | |
68 | /** Allocates memory space for the array of normals cloned from the pSrc. |
69 | * \param pSrc The source geometry from which the normals information is cloned. |
70 | * \remarks This function must be called with the argument, otherwise it does not do anything. Also, |
71 | * it will only process the normals array defined on layer 0 of the pSrc. |
72 | */ |
73 | void InitNormals(FbxGeometryBase* pSrc); |
74 | |
75 | /** Allocates memory space for the array of tangents on specified layer. |
76 | * \param pCount The desired size of the tangent array. If pCount is specified, the array will be the same size as pCount. |
77 | * If pCount is not specified, the array will be the same length as the array of control points. |
78 | * \param pLayerIndex The specified layer index to allocate memory space for the array of tangents. |
79 | * \param pName The specified name for the allocated tangents array. |
80 | * \remarks This function must be called after function FbxLayerContainer::InitControlPoints(). |
81 | * The tangents initialized with this function will have the reference mode set to eDirect. |
82 | */ |
83 | void InitTangents(int pCount = 0, const int pLayerIndex = 0, const char* pName = "" ); |
84 | |
85 | /** Allocates memory space for the array of tangents cloned from the pSrc on the specified layer. |
86 | * \param pSrc The source geometry from which the tangents information is cloned. |
87 | * \param pLayerIndex The specified layer index to allocate memory space for cloned array of tangents from the pSrc. |
88 | * \remarks This function must be called with the argument, otherwise it does not do anything. |
89 | */ |
90 | void InitTangents(FbxGeometryBase* pSrc, const int pLayerIndex = 0); |
91 | |
92 | /** Allocates memory space for the array of binormals. |
93 | * \param pCount The desired size of the binormal array. If pCount is specified, the array will have the same size as pCount. |
94 | * If pCount is not specified, the array will be the same length as the array of control points. |
95 | * \param pLayerIndex The specified layer index to allocate memory space for the array of binormals. |
96 | * \param pName The specified name for the allocated binormals array. |
97 | * \remarks This function must be called after function FbxLayerContainer::InitControlPoints(). |
98 | * The binormals initialized with this function will have the reference mode set to eDirect. |
99 | */ |
100 | void InitBinormals(int pCount = 0, const int pLayerIndex = 0, const char* pName = "" ); |
101 | |
102 | /** Allocates memory space for the array of binormals cloned from the pSrc. |
103 | * \param pSrc The source geometry from which the binormals information is cloned. |
104 | * \param pLayerIndex The specified layer index to allocate memory space for cloned array of binormals from the pSrc. |
105 | * \remarks This function must be called with the argument, otherwise it does not do anything. |
106 | */ |
107 | void InitBinormals(FbxGeometryBase* pSrc, const int pLayerIndex = 0); |
108 | |
109 | /** Sets the control point and the normal values at the specified index. |
110 | * \param pCtrlPoint The value of the control point. |
111 | * \param pNormal The value of the normal. |
112 | * \param pIndex The specified index of the control point/normal. |
113 | * \param pI2DSearch When \c true AND the normals array reference mode is eIndexToDirect, search pNormal in the |
114 | * existing array to avoid inserting if it already exist. NOTE: This feature uses a linear |
115 | * search algorithm, therefore it can be time consuming if the DIRECT array of normals contains |
116 | * a huge number of elements. |
117 | * \remarks If the arrays (control points and normals) are not big enough to store the values at the |
118 | * specified index, they will be automatically resized to accommodate the new entries. |
119 | */ |
120 | virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , const FbxVector4 &pNormal , int pIndex, bool pI2DSearch = false); |
121 | |
122 | |
123 | /** Sets the control point at a specified index. |
124 | * \param pCtrlPoint The value of the control point. |
125 | * \param pIndex The specified index of the control point. |
126 | * |
127 | * \remarks If the array is not big enough to store the value at the specified index, it will be |
128 | * automatically resized to accommodate the new entry. |
129 | */ |
130 | virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , int pIndex); |
131 | |
132 | /** Gets the control point at the specified index. |
133 | * \param pIndex The specified index of the control point. |
134 | * \return The value of the specific control point. |
135 | * |
136 | * \remarks If index is out of range, FbxVector4(0, 0, 0) is returned. |
137 | */ |
138 | virtual FbxVector4 GetControlPointAt(int pIndex) const; |
139 | |
140 | /** Sets the control point normal value at the specified index. |
141 | * \param pNormal The value of the normal. |
142 | * \param pIndex The specified index of the normal. |
143 | * \param pI2DSearch When \c true AND the normals array reference mode is eIndexToDirect, search pNormal in the |
144 | * existing array to avoid inserting it if it already exist. NOTE: this feature uses a linear |
145 | * search algorithm, therefore it can be time consuming if the DIRECT array of normals contains |
146 | * a huge number of elements. |
147 | * \remarks If the array is not big enough to store the value at the specified index, it will be |
148 | * automatically resized to accommodate the new entry. |
149 | */ |
150 | virtual void SetControlPointNormalAt(const FbxVector4 &pNormal, int pIndex, bool pI2DSearch=false); |
151 | |
152 | /** Returns the number of control points. |
153 | * \return The number of control points allocated in the geometry. |
154 | */ |
155 | virtual int GetControlPointsCount() const; |
156 | |
157 | |
158 | /** Returns a pointer to the array of control points. |
159 | * \param pStatus Not used in the implementation of this class. |
160 | * \return Pointer to the array of control points, or \c NULL if the array has not been allocated. |
161 | * \remarks Use the function FbxGeometryBase::InitControlPoints() to allocate the array. |
162 | */ |
163 | virtual FbxVector4* GetControlPoints(FbxStatus* pStatus=NULL) const; |
164 | |
165 | /** Allocates memory space for the array of control points. |
166 | * \param pCount The number of control points. |
167 | * \remarks Any previously allocated array of control points will NOT be cleared. |
168 | */ |
169 | virtual void SetControlPointCount(int pCount); |
170 | |
171 | //@} |
172 | |
173 | |
174 | /** |
175 | * \name Public and fast access Properties |
176 | */ |
177 | //@{ |
178 | //! Control the geometry render state. Geometry can still cast shadows even if this is turned off. |
179 | FbxPropertyT<FbxBool> PrimaryVisibility; |
180 | |
181 | //! If true, the geometry will produce shadows. |
182 | FbxPropertyT<FbxBool> CastShadow; |
183 | |
184 | //! If true, the geometry will receive shadows. |
185 | FbxPropertyT<FbxBool> ReceiveShadow; |
186 | |
187 | //! The minimum value of the control points bounding box. |
188 | FbxPropertyT<FbxDouble3> BBoxMin; |
189 | |
190 | //! The maximum value of the control points bounding box. |
191 | FbxPropertyT<FbxDouble3> BBoxMax; |
192 | |
193 | /** Computes the control points Bounding box. |
194 | */ |
195 | void ComputeBBox(); |
196 | //@} |
197 | |
198 | |
199 | /** |
200 | * \name Geometry Element Management. |
201 | * A FbxGeometryElement describes how the geometry element (normals, UVs and etc.) is mapped to a geometry |
202 | * surface and how the mapping information is arranged in memory. |
203 | * FbxGeometryElement is exactly the same as FbxLayerElement but does not expose the geometry's layer information. |
204 | * Use the geometry element classes to decompose the geometry without dealing with layers. |
205 | */ |
206 | //@{ |
207 | |
208 | /** Creates a normal geometry element for this geometry. |
209 | * \return A pointer to the newly created geometry element. |
210 | * \remarks The created geometry element is associated with this geometry automatically. |
211 | */ |
212 | FbxGeometryElementNormal* CreateElementNormal(); |
213 | |
214 | /** Remove the normal geometry element from this geometry. |
215 | * \param pElementNormal A pointer to the normal element to be removed. |
216 | * \return \c True if the geometry element is removed, \c false otherwise. |
217 | */ |
218 | bool RemoveElementNormal(FbxGeometryElementNormal* pElementNormal); |
219 | |
220 | /** Returns this geometry's normal element. |
221 | * \param pIndex The normal geometry element index. |
222 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
223 | */ |
224 | FbxGeometryElementNormal* GetElementNormal(int pIndex = 0); |
225 | |
226 | /** Returns this geometry's normal element. |
227 | * \param pIndex The normal geometry element index. |
228 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
229 | */ |
230 | const FbxGeometryElementNormal* GetElementNormal(int pIndex = 0) const; |
231 | |
232 | /** Get the number of this geometry's normal geometry element. |
233 | * \return Total number of normal geometry elements for this geometry. |
234 | */ |
235 | int GetElementNormalCount() const; |
236 | |
237 | /** Creates a binormal geometry element for this geometry. |
238 | * \return A pointer to the newly created geometry element. |
239 | * \remarks The created geometry element is associated with this geometry automatically. |
240 | */ |
241 | FbxGeometryElementBinormal* CreateElementBinormal(); |
242 | |
243 | /** Remove the binormal geometry element from this geometry. |
244 | * \param pElementBinormal A pointer to the binormal element to be removed. |
245 | * \return \c True if the geometry element is removed, \c false otherwise. |
246 | */ |
247 | bool RemoveElementBinormal(FbxGeometryElementBinormal* pElementBinormal); |
248 | |
249 | /** Returns this geometry's binormal element. |
250 | * \param pIndex The binormal geometry element index. |
251 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
252 | */ |
253 | FbxGeometryElementBinormal* GetElementBinormal(int pIndex = 0); |
254 | |
255 | /** Returns this geometry's binormal element. |
256 | * \param pIndex The binormal geometry element index. |
257 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
258 | */ |
259 | const FbxGeometryElementBinormal* GetElementBinormal(int pIndex = 0) const; |
260 | |
261 | /** Get the number of this geometry's binormal geometry element. |
262 | * \return Total number of binormal geometry elements for this geometry. |
263 | */ |
264 | int GetElementBinormalCount() const; |
265 | |
266 | /** Creates a tangent geometry element for this geometry. |
267 | * \return A pointer to the newly created geometry element. |
268 | * \remarks The created geometry element is associated with this geometry automatically. |
269 | */ |
270 | FbxGeometryElementTangent* CreateElementTangent(); |
271 | |
272 | /** Remove the tangent geometry element from this geometry. |
273 | * \param pElementTangent A pointer to the tangent element to be removed. |
274 | * \return \c True if the geometry element is removed, \c false otherwise. |
275 | */ |
276 | bool RemoveElementTangent(FbxGeometryElementTangent* pElementTangent); |
277 | |
278 | /** Returns this geometry's tangent element. |
279 | * \param pIndex The tangent geometry element index. |
280 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
281 | */ |
282 | FbxGeometryElementTangent* GetElementTangent(int pIndex = 0); |
283 | |
284 | /** Returns this geometry's tangent element. |
285 | * \param pIndex The tangent geometry element index. |
286 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
287 | */ |
288 | const FbxGeometryElementTangent* GetElementTangent(int pIndex = 0) const; |
289 | |
290 | /** Get the number of this geometry's tangent geometry element. |
291 | * \return Total number of tangent geometry elements for this geometry. |
292 | */ |
293 | int GetElementTangentCount() const; |
294 | |
295 | /** Creates a material geometry element for this geometry. |
296 | * \return A pointer to the newly created geometry element. |
297 | * \remarks The created geometry element is associated with this geometry automatically. |
298 | */ |
299 | FbxGeometryElementMaterial* CreateElementMaterial(); |
300 | |
301 | /** Remove the material geometry element from this geometry. |
302 | * \param pElementMaterial A pointer to the material element to be removed. |
303 | * \return \c True if the geometry element is removed, \c false otherwise. |
304 | */ |
305 | bool RemoveElementMaterial(FbxGeometryElementMaterial* pElementMaterial); |
306 | |
307 | /** Returns this geometry's material element. |
308 | * \param pIndex The material geometry element index. |
309 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
310 | */ |
311 | FbxGeometryElementMaterial* GetElementMaterial(int pIndex = 0); |
312 | |
313 | /** Returns this geometry's material element. |
314 | * \param pIndex The material geometry element index. |
315 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
316 | */ |
317 | const FbxGeometryElementMaterial* GetElementMaterial(int pIndex = 0) const; |
318 | |
319 | /** Get the number of this geometry's material geometry element. |
320 | * \return Total number of material geometry elements for this geometry. |
321 | */ |
322 | int GetElementMaterialCount() const; |
323 | |
324 | /** Creates a polygon group geometry element for this geometry. |
325 | * \return A pointer to the newly created geometry element. |
326 | * \remarks The created geometry element is associated with this geometry automatically. |
327 | */ |
328 | FbxGeometryElementPolygonGroup* CreateElementPolygonGroup(); |
329 | |
330 | /** Remove the polygon group geometry element from this geometry. |
331 | * \param pElementPolygonGroup A pointer to the polygon group element to be removed. |
332 | * \return \c True if the geometry element is removed, \c false otherwise. |
333 | */ |
334 | bool RemoveElementPolygonGroup(FbxGeometryElementPolygonGroup* pElementPolygonGroup); |
335 | |
336 | /** Returns this geometry's polygon group element. |
337 | * \param pIndex The polygon group geometry element index. |
338 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
339 | */ |
340 | FbxGeometryElementPolygonGroup* GetElementPolygonGroup(int pIndex = 0); |
341 | |
342 | /** Returns this geometry's polygon group element. |
343 | * \param pIndex The polygon group geometry element index. |
344 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
345 | */ |
346 | const FbxGeometryElementPolygonGroup* GetElementPolygonGroup(int pIndex = 0) const; |
347 | |
348 | /** Get the number of this geometry's polygon group geometry element. |
349 | * \return Total number of polygon group geometry elements for this geometry. |
350 | */ |
351 | int GetElementPolygonGroupCount() const; |
352 | |
353 | /** Creates a vertex color geometry element for this geometry. |
354 | * \return A pointer to the newly created geometry element. |
355 | * \remarks The created geometry element is associated with this geometry automatically. |
356 | */ |
357 | FbxGeometryElementVertexColor* CreateElementVertexColor(); |
358 | |
359 | /** Remove the vertex color geometry element from this geometry. |
360 | * \param pElementVertexColor A pointer to the vertex color element to be removed. |
361 | * \return \c True if the geometry element is removed, \c false otherwise. |
362 | */ |
363 | bool RemoveElementVertexColor(FbxGeometryElementVertexColor* pElementVertexColor); |
364 | |
365 | /** Returns this geometry's vertex color element. |
366 | * \param pIndex The vertex color geometry element index. |
367 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
368 | */ |
369 | FbxGeometryElementVertexColor* GetElementVertexColor(int pIndex = 0); |
370 | |
371 | /** Returns this geometry's vertex color element. |
372 | * \param pIndex The vertex color geometry element index. |
373 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
374 | */ |
375 | const FbxGeometryElementVertexColor* GetElementVertexColor(int pIndex = 0) const; |
376 | |
377 | /** Get the number of this geometry's vertex color geometry element. |
378 | * \return Total number of vertex color geometry elements for this geometry. |
379 | */ |
380 | int GetElementVertexColorCount() const; |
381 | |
382 | /** Creates a smoothing geometry element for this geometry. |
383 | * \return A pointer to the newly created geometry element. |
384 | * \remarks The created geometry element is associated with this geometry automatically. |
385 | */ |
386 | FbxGeometryElementSmoothing* CreateElementSmoothing(); |
387 | |
388 | /** Remove the smoothing geometry element from this geometry. |
389 | * \param pElementSmoothing A pointer to the smoothing element to be removed. |
390 | * \return \c True if the geometry element is removed, \c false otherwise. |
391 | */ |
392 | bool RemoveElementSmoothing(FbxGeometryElementSmoothing* pElementSmoothing); |
393 | |
394 | /** Returns this geometry's smoothing element. |
395 | * \param pIndex The smoothing geometry element index. |
396 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
397 | */ |
398 | FbxGeometryElementSmoothing* GetElementSmoothing(int pIndex = 0); |
399 | |
400 | /** Returns this geometry's smoothing element. |
401 | * \param pIndex The smoothing geometry element index. |
402 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
403 | */ |
404 | const FbxGeometryElementSmoothing* GetElementSmoothing(int pIndex = 0) const; |
405 | |
406 | /** Get the number of this geometry's smoothing geometry element. |
407 | * \return Total number of smoothing geometry elements for this geometry. |
408 | */ |
409 | int GetElementSmoothingCount() const; |
410 | |
411 | /** Creates a vertex crease geometry element for this geometry. |
412 | * \return A pointer to the newly created geometry element. |
413 | * \remarks The created geometry element is associated with this geometry automatically. |
414 | */ |
415 | FbxGeometryElementCrease* CreateElementVertexCrease(); |
416 | |
417 | /** Remove the vertex crease geometry element from this geometry. |
418 | * \param pElementCrease A pointer to the vertex crease element to be removed. |
419 | * \return \c True if the geometry element is removed, \c false otherwise. |
420 | */ |
421 | bool RemoveElementVertexCrease(FbxGeometryElementCrease* pElementCrease); |
422 | |
423 | /** Returns this geometry's vertex crease element. |
424 | * \param pIndex The vertex crease geometry element index. |
425 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
426 | */ |
427 | FbxGeometryElementCrease* GetElementVertexCrease(int pIndex = 0); |
428 | |
429 | /** Returns this geometry's vertex crease element. |
430 | * \param pIndex The vertex crease geometry element index. |
431 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
432 | */ |
433 | const FbxGeometryElementCrease* GetElementVertexCrease(int pIndex = 0) const; |
434 | |
435 | /** Get the number of this geometry's vertex crease geometry element. |
436 | * \return Total number of vertex crease geometry elements for this geometry. |
437 | */ |
438 | int GetElementVertexCreaseCount() const; |
439 | |
440 | /** Creates an edge crease geometry element for this geometry. |
441 | * \return A pointer to the newly created geometry element. |
442 | * \remarks The created geometry element is associated with this geometry automatically. |
443 | */ |
444 | FbxGeometryElementCrease* CreateElementEdgeCrease(); |
445 | |
446 | /** Remove the edge crease geometry element from this geometry. |
447 | * \param pElementCrease A pointer to the edge crease element to be removed. |
448 | * \return \c True if the geometry element is removed, \c false otherwise. |
449 | */ |
450 | bool RemoveElementEdgeCrease(FbxGeometryElementCrease* pElementCrease); |
451 | |
452 | /** Returns this geometry's edge crease element. |
453 | * \param pIndex The edge crease geometry element index. |
454 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
455 | */ |
456 | FbxGeometryElementCrease* GetElementEdgeCrease(int pIndex = 0); |
457 | |
458 | /** Returns this geometry's edge crease element. |
459 | * \param pIndex The edge crease geometry element index. |
460 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
461 | */ |
462 | const FbxGeometryElementCrease* GetElementEdgeCrease(int pIndex = 0) const; |
463 | |
464 | /** Get the number of this geometry's edge crease geometry element. |
465 | * \return Total number of edge crease geometry elements for this geometry. |
466 | */ |
467 | int GetElementEdgeCreaseCount() const; |
468 | |
469 | /** Creates a hole geometry element for this geometry. |
470 | * \return A pointer to the newly created geometry element. |
471 | * \remarks The created geometry element is associated with this geometry automatically. |
472 | */ |
473 | FbxGeometryElementHole* CreateElementHole(); |
474 | |
475 | /** Remove the hole geometry element from this geometry. |
476 | * \param pElementHole A pointer to the hole element to be removed. |
477 | * \return \c True if the geometry element is removed, \c false otherwise. |
478 | */ |
479 | bool RemoveElementHole(FbxGeometryElementHole* pElementHole); |
480 | |
481 | /** Returns this geometry's hole element. |
482 | * \param pIndex The hole geometry element index. |
483 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
484 | */ |
485 | FbxGeometryElementHole* GetElementHole(int pIndex = 0); |
486 | |
487 | /** Returns this geometry's hole element. |
488 | * \param pIndex The hole geometry element index. |
489 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
490 | */ |
491 | const FbxGeometryElementHole* GetElementHole(int pIndex = 0) const; |
492 | |
493 | /** Get the number of this geometry's hole geometry element. |
494 | * \return Total number of hole geometry elements for this geometry. |
495 | */ |
496 | int GetElementHoleCount() const; |
497 | |
498 | /** Creates a user data geometry element for this geometry. |
499 | * \return A pointer to the newly created geometry element. |
500 | * \remarks The created geometry element is associated with this geometry automatically. |
501 | */ |
502 | FbxGeometryElementUserData* CreateElementUserData(); |
503 | |
504 | /** Remove the user data geometry element from this geometry. |
505 | * \param pElementUserData A pointer to the user data element to be removed. |
506 | * \return \c True if the geometry element is removed, \c false otherwise. |
507 | */ |
508 | bool RemoveElementUserData(FbxGeometryElementUserData* pElementUserData); |
509 | |
510 | /** Returns this geometry's user data element. |
511 | * \param pIndex The user data geometry element index. |
512 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
513 | */ |
514 | FbxGeometryElementUserData* GetElementUserData(int pIndex = 0); |
515 | |
516 | /** Returns this geometry's user data element. |
517 | * \param pIndex The user data geometry element index. |
518 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
519 | */ |
520 | const FbxGeometryElementUserData* GetElementUserData(int pIndex = 0) const; |
521 | |
522 | /** Get the number of this geometry's user data geometry element. |
523 | * \return Total number of user data geometry elements for this geometry. |
524 | */ |
525 | int GetElementUserDataCount() const; |
526 | |
527 | /** Creates a visibility geometry element for this geometry. |
528 | * \return A pointer to the newly created geometry element. |
529 | * \remarks The created geometry element is associated with this geometry automatically. |
530 | */ |
531 | FbxGeometryElementVisibility* CreateElementVisibility(); |
532 | |
533 | /** Remove the visibility geometry element from this geometry. |
534 | * \param pElementVisibility A pointer to the visibility element to be removed. |
535 | * \return \c True if the geometry element is removed, \c false otherwise. |
536 | */ |
537 | bool RemoveElementVisibility(FbxGeometryElementVisibility* pElementVisibility); |
538 | |
539 | /** Returns this geometry's visibility element. |
540 | * \param pIndex The visibility geometry element index. |
541 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
542 | */ |
543 | FbxGeometryElementVisibility* GetElementVisibility(int pIndex = 0); |
544 | |
545 | /** Returns this geometry's visibility element. |
546 | * \param pIndex The visibility geometry element index. |
547 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
548 | */ |
549 | const FbxGeometryElementVisibility* GetElementVisibility(int pIndex = 0) const; |
550 | |
551 | /** Get the number of this geometry's visibility geometry element. |
552 | * \return Total number of visibility geometry elements for this geometry. |
553 | */ |
554 | int GetElementVisibilityCount() const; |
555 | |
556 | /** Creates a UV geometry element for this geometry. |
557 | * \param pUVSetName The UV geometry element name. |
558 | * \param pTypeIdentifier The texture channel the UVIndex refers to. |
559 | * \return A pointer to the newly created geometry element. |
560 | * \remarks The created geometry element is associated with this geometry automatically. |
561 | */ |
562 | FbxGeometryElementUV* CreateElementUV(const char* pUVSetName, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse); |
563 | |
564 | /** Remove the UV geometry element from this geometry. |
565 | * \param pElementUV A pointer to the UV element to be removed. |
566 | * \return \c True if the geometry element is removed, \c false otherwise. |
567 | */ |
568 | bool RemoveElementUV(FbxGeometryElementUV* pElementUV); |
569 | |
570 | /** Returns this geometry's UV element. |
571 | * \param pIndex The UV geometry element index. |
572 | * \param pTypeIdentifier The texture channel the UVIndex refers to. |
573 | * \return A pointer to the geometry element or \c NULL if \e pIndex is out of range. |
574 | * \remarks If \e pTypeIdentifier is not specified, the function will return the geometry element |
575 | * regardless of its texture type. |
576 | */ |
577 | FbxGeometryElementUV* GetElementUV(int pIndex = 0, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eUnknown); |
578 | |
579 | /** Returns this geometry's UV element. |
580 | * \param pIndex The UV geometry element index. |
581 | * \param pTypeIdentifier The texture channel the UVIndex refers to. |
582 | * \return A const pointer to the geometry element or \c NULL if \e pIndex is out of range. |
583 | * \remarks If \e pTypeIdentifier is not specified, the function will return the geometry element |
584 | * regardless of its texture type. |
585 | */ |
586 | const FbxGeometryElementUV* GetElementUV(int pIndex = 0, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eUnknown) const; |
587 | |
588 | /** Get the number of this geometry's UV geometry element. |
589 | * \param pTypeIdentifier The texture channel the UVIndex refers to. |
590 | * \return Total number of UV geometry elements for this geometry. |
591 | * \remarks If \e pTypeIdentifier is not specified, the function will return the geometry element |
592 | * regardless of its texture type. |
593 | */ |
594 | int GetElementUVCount(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eUnknown) const; |
595 | |
596 | /** Returns this geometry's UV element. |
597 | * \param pUVSetName The UV set name of the UV geometry element. |
598 | * \return A pointer to the UV geometry element or \c NULL if no UV geometry element with this name exists. |
599 | */ |
600 | FbxGeometryElementUV* GetElementUV(const char* pUVSetName); |
601 | |
602 | /** Returns this geometry's UV element. |
603 | * \param pUVSetName The UV set name of the UV geometry element. |
604 | * \return A const pointer to the UV geometry element or \c NULL if no UV geometry element with this name exists. |
605 | */ |
606 | const FbxGeometryElementUV* GetElementUV(const char* pUVSetName) const; |
607 | |
608 | /** Returns this geometry's all UV set names. |
609 | * \param pUVSetNameList A reference to \c FbxStringList that will be filled with this geometry's all UV set names. |
610 | */ |
611 | void GetUVSetNames(FbxStringList& pUVSetNameList) const; |
612 | |
613 | //@} |
614 | |
615 | |
616 | /** |
617 | * \name Off-loading Serialization section |
618 | * The methods in this section are typically called by a peripheral (FbxPeripheral). There should be no |
619 | * real interest in calling them directly. The functions will write/read the memory dump of the data contained |
620 | * in this class. Each data block written/read will start with an (int) value representing the number of items |
621 | * in the array. If this value (v) is not zero, it will be followed by the array content. A block of data that is |
622 | * (v * sizeof(array item size)) bytes big. The methods will also call the parent class ones to dump the Layers content. |
623 | */ |
624 | //@{ |
625 | /** Writes the content of the geometry object to the specified stream. |
626 | * \param pStream The destination stream. |
627 | * \return \c True if the content is successfully processed |
628 | * by the receiving stream, \c false otherwise. |
629 | */ |
630 | virtual bool ContentWriteTo(FbxStream& pStream) const; |
631 | |
632 | /** Reads the content of the geometry object from the specified stream. |
633 | * \param pStream The source stream. |
634 | * \return \c True if the geometry object fills itself with the received data |
635 | * from the stream successfully, \c false otherwise. |
636 | */ |
637 | virtual bool ContentReadFrom(const FbxStream& pStream); |
638 | //@} |
639 | |
640 | /** Calculate the actual amount of memory used by this geometry object. |
641 | * \return The memory size in bytes (includes the amount use by the data defined in the layers). |
642 | */ |
643 | virtual int MemoryUsage() const; |
644 | |
645 | /***************************************************************************************************************************** |
646 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
647 | *****************************************************************************************************************************/ |
648 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
649 | virtual FbxObject& Copy(const FbxObject& pObject); |
650 | virtual void Compact(); |
651 | |
652 | FbxArray<FbxVector4> mControlPoints; |
653 | |
654 | bool GetNormals(FbxLayerElementArrayTemplate<FbxVector4>** pLockableArray) const; |
655 | bool GetNormalsIndices(FbxLayerElementArrayTemplate<int>** pLockableArray) const; |
656 | bool GetTangents(FbxLayerElementArrayTemplate<FbxVector4>** pLockableArray, const int pLayerIndex = 0) const; |
657 | bool GetTangentsIndices(FbxLayerElementArrayTemplate<int>** pLockableArray, const int pLayerIndex = 0) const; |
658 | bool GetBinormals(FbxLayerElementArrayTemplate<FbxVector4>** pLockableArray, const int pLayerIndex = 0) const; |
659 | bool GetBinormalsIndices(FbxLayerElementArrayTemplate<int>** pLockableArray, const int pLayerIndex = 0) const; |
660 | |
661 | protected: |
662 | virtual void ConstructProperties(bool pForceSet); |
663 | virtual void ContentClear(); |
664 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
665 | }; |
666 | |
667 | #include <fbxsdk/fbxsdk_nsend.h> |
668 | |
669 | #endif /* _FBXSDK_SCENE_GEOMETRY_BASE_H_ */ |
670 | |