fbxsubdiv.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_
00014 #define _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/math/fbxvector4.h>
00019 #include <fbxsdk/core/math/fbxvector2.h>
00020 #include <fbxsdk/core/base/fbxarray.h>
00021 #include <fbxsdk/scene/geometry/fbxgeometry.h>
00022 
00023 #include <fbxsdk/fbxsdk_nsbegin.h>
00024 
00025 class FbxMesh;
00026 class FbxManager;
00027 
00029 //  WARNING!
00030 //  Anything beyond these lines may not be documented accurately and is
00031 //  subject to change without notice.
00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00034 
00035 class FBXSDK_DLL FbxSubDiv : public FbxGeometry
00036 {
00037     FBXSDK_OBJECT_DECLARE(FbxSubDiv, FbxGeometry);
00038 
00039 public:
00040     enum EScheme
00041     {
00042         eCatmullClark,  //Catmull CClark subdivision surface
00043         eDooCSabin,      //Doo CSabin subdivision surface
00044         eLoop,           //Loop subdivision surface
00045         eLinear,         //Linear subdivision surface 
00046     };
00047 
00048     enum ETesselationPattern
00049     {
00050         eOddFractional,
00051         eEvenFractional,
00052         eInteger,
00053         ePower2,      //Max, Maya use this one
00054     };
00055 
00056     enum EDisplaySmoothness
00057     {
00058         eHull,
00059         eRough,
00060         eMedium,
00061         eFine,
00062     };
00063 
00069     void InitSubdivLevel(int pLevelCount, 
00070         EScheme pScheme = eCatmullClark, 
00071         ETesselationPattern pPattern = ePower2);
00072 
00073     FbxSubDiv(FbxManager& pManager, char const* pName);
00074 
00075     virtual void Destruct(bool pRecursive, bool pDependents);
00076 
00077     virtual FbxNodeAttribute::EType GetAttributeType() const;
00078 
00079 
00080     //max subdivision level number
00081     static const int MAX_SUBDIV_LEVEL = 16;
00082 
00083     //subdiv levels in subdivision, including the base mesh and each subdiv levels
00084     FbxArray<FbxMesh*> mSubDivLevel;
00085 
00086     //Get the base mesh
00087     FbxMesh* GetBaseMesh() const; 
00088 
00089     //Get the mesh from finest level
00090     FbxMesh* GetFinestMesh() const;
00091 
00092     //Set the finest mesh
00093     bool SetFinestMesh(FbxMesh* pMesh);
00094 
00095     //Set the finest mesh
00096     bool SetBaseMesh(FbxMesh* pMesh);
00097 
00098     //Get the mesh from specific level
00099     FbxMesh* GetMesh(int pLevel) const;
00100 
00106     void SetSubdivLevelMesh(int pLevel, FbxMesh* pMesh);
00107 
00108     int GetLevelCount() const;
00109     void SetLevelCount(int pLevelCount);
00110 
00111     int GetCurrentLevel() const;
00112     void SetCurrentLevel(int pCurrentLevel);
00113 
00114     FbxMesh* GetCurrentMesh() const;
00115 
00116     FbxSubDiv::EScheme GetSubdivScheme() const;
00117 
00118     FbxSubDiv::ETesselationPattern GetTessPattern() const;
00119 
00120     void SetSubdivScheme(FbxSubDiv::EScheme pScheme);
00121 
00122     void SetTessPattern(FbxSubDiv::ETesselationPattern pPattern);
00123 
00124     FbxSubDiv::EDisplaySmoothness GetDisplaySmoothness() const;
00125 
00126     void SetDisplaySmoothness(FbxSubDiv::EDisplaySmoothness pSmoothness);
00127 
00128 private:
00129 
00130     //base geometry mesh for subdivision
00131     FbxMesh* mBaseMesh;
00132 
00133     //finest geometry mesh for subdivision
00134     FbxMesh* mFinestMesh;
00135 
00136     //current operating subdivision level
00137     int mCurrLevel;
00138 
00139     //number of subdiv level
00140     int mLevelCount;
00141 
00142     //scheme of subdiv
00143     EScheme mScheme;
00144 
00145     //pattern of subdiv
00146     ETesselationPattern mPattern;
00147 
00148     //display smoothness of subdiv
00149     EDisplaySmoothness mSmoothness;
00150 };
00151 
00152 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00153 
00154 #include <fbxsdk/fbxsdk_nsend.h>
00155 
00156 #endif /* _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_ */