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 fbxsubdiv.h
13#ifndef _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_
14#define _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/base/fbxarray.h>
19#include <fbxsdk/scene/geometry/fbxgeometry.h>
20
21#include <fbxsdk/fbxsdk_nsbegin.h>
22
23class FbxMesh;
24
25/*****************************************************************************************************************************
26** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
27*****************************************************************************************************************************/
28#ifndef DOXYGEN_SHOULD_SKIP_THIS
29
30class FBXSDK_DLL FbxSubDiv : public FbxGeometry
31{
32 FBXSDK_OBJECT_DECLARE(FbxSubDiv, FbxGeometry);
33
34public:
35 enum EScheme
36 {
37 eCatmullClark, //Catmull CClark subdivision surface
38 eDooCSabin, //Doo CSabin subdivision surface
39 eLoop, //Loop subdivision surface
40 eLinear, //Linear subdivision surface
41 };
42
43 enum ETesselationPattern
44 {
45 eOddFractional,
46 eEvenFractional,
47 eInteger,
48 ePower2, //Max, Maya use this one
49 };
50
51 enum EDisplaySmoothness
52 {
53 eHull,
54 eRough,
55 eMedium,
56 eFine,
57 };
58
59 /** InitSubdivLevel Initialize the subdiv
60 * \param pLevelCount number of levels
61 * \param pScheme subdivision scheme
62 * \param pPattern Tessellation pattern
63 */
64 void InitSubdivLevel(int pLevelCount,
65 EScheme pScheme = eCatmullClark,
66 ETesselationPattern pPattern = ePower2);
67
68 virtual FbxNodeAttribute::EType GetAttributeType() const;
69
70
71 //max subdivision level number
72 static const int MAX_SUBDIV_LEVEL = 16;
73
74 //subdiv levels in subdivision, including the base mesh and each subdiv levels
75 FbxArray<FbxMesh*> mSubDivLevel;
76
77 //Get the base mesh
78 FbxMesh* GetBaseMesh() const;
79
80 //Get the mesh from finest level
81 FbxMesh* GetFinestMesh() const;
82
83 //Set the finest mesh
84 bool SetFinestMesh(FbxMesh* pMesh);
85
86 //Set the finest mesh
87 bool SetBaseMesh(FbxMesh* pMesh);
88
89 //Get the mesh from specific level
90 FbxMesh* GetMesh(int pLevel) const;
91
92 /** SetSubdivLevelMesh Set certain subdivision mesh
93 * \param pLevel working level
94 * \param pMesh new level mesh. pLevel = 0 means base mesh,
95 pLevel = MaxLevel -1 means finest mesh
96 */
97 void SetSubdivLevelMesh(int pLevel, FbxMesh* pMesh);
98
99 int GetLevelCount() const;
100 void SetLevelCount(int pLevelCount);
101
102 int GetCurrentLevel() const;
103 void SetCurrentLevel(int pCurrentLevel);
104
105 FbxMesh* GetCurrentMesh() const;
106
107 FbxSubDiv::EScheme GetSubdivScheme() const;
108
109 FbxSubDiv::ETesselationPattern GetTessPattern() const;
110
111 void SetSubdivScheme(FbxSubDiv::EScheme pScheme);
112
113 void SetTessPattern(FbxSubDiv::ETesselationPattern pPattern);
114
115 FbxSubDiv::EDisplaySmoothness GetDisplaySmoothness() const;
116
117 void SetDisplaySmoothness(FbxSubDiv::EDisplaySmoothness pSmoothness);
118
119private:
120
121 //base geometry mesh for subdivision
122 FbxMesh* mBaseMesh;
123
124 //finest geometry mesh for subdivision
125 FbxMesh* mFinestMesh;
126
127 //current operating subdivision level
128 int mCurrLevel;
129
130 //number of subdiv level
131 int mLevelCount;
132
133 //scheme of subdiv
134 EScheme mScheme;
135
136 //pattern of subdiv
137 ETesselationPattern mPattern;
138
139 //display smoothness of subdiv
140 EDisplaySmoothness mSmoothness;
141};
142
143#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
144
145#include <fbxsdk/fbxsdk_nsend.h>
146
147#endif /* _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_ */
148