fbxsubdiv.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /****************************************************************************************
  2. Copyright (C) 2015 Autodesk, Inc.
  3. All rights reserved.
  4. Use of this software is subject to the terms of the Autodesk license agreement
  5. provided at the time of installation or download, or which otherwise accompanies
  6. this software in either electronic or hard copy form.
  7. ****************************************************************************************/
  8. //! \file fbxsubdiv.h
  9. #ifndef _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_
  10. #define _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_
  11. #include <fbxsdk/fbxsdk_def.h>
  12. #include <fbxsdk/core/base/fbxarray.h>
  13. #include <fbxsdk/scene/geometry/fbxgeometry.h>
  14. #include <fbxsdk/fbxsdk_nsbegin.h>
  15. class FbxMesh;
  16. /*****************************************************************************************************************************
  17. ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
  18. *****************************************************************************************************************************/
  19. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  20. class FBXSDK_DLL FbxSubDiv : public FbxGeometry
  21. {
  22. FBXSDK_OBJECT_DECLARE(FbxSubDiv, FbxGeometry);
  23. public:
  24. enum EScheme
  25. {
  26. eCatmullClark, //Catmull CClark subdivision surface
  27. eDooCSabin, //Doo CSabin subdivision surface
  28. eLoop, //Loop subdivision surface
  29. eLinear, //Linear subdivision surface
  30. };
  31. enum ETesselationPattern
  32. {
  33. eOddFractional,
  34. eEvenFractional,
  35. eInteger,
  36. ePower2, //Max, Maya use this one
  37. };
  38. enum EDisplaySmoothness
  39. {
  40. eHull,
  41. eRough,
  42. eMedium,
  43. eFine,
  44. };
  45. /** InitSubdivLevel Initialize the subdiv
  46. * \param pLevelCount number of levels
  47. * \param pScheme subdivision scheme
  48. * \param pPattern Tessellation pattern
  49. */
  50. void InitSubdivLevel(int pLevelCount,
  51. EScheme pScheme = eCatmullClark,
  52. ETesselationPattern pPattern = ePower2);
  53. virtual FbxNodeAttribute::EType GetAttributeType() const;
  54. //max subdivision level number
  55. static const int MAX_SUBDIV_LEVEL = 16;
  56. //subdiv levels in subdivision, including the base mesh and each subdiv levels
  57. FbxArray<FbxMesh*> mSubDivLevel;
  58. //Get the base mesh
  59. FbxMesh* GetBaseMesh() const;
  60. //Get the mesh from finest level
  61. FbxMesh* GetFinestMesh() const;
  62. //Set the finest mesh
  63. bool SetFinestMesh(FbxMesh* pMesh);
  64. //Set the finest mesh
  65. bool SetBaseMesh(FbxMesh* pMesh);
  66. //Get the mesh from specific level
  67. FbxMesh* GetMesh(int pLevel) const;
  68. /** SetSubdivLevelMesh Set certain subdivision mesh
  69. * \param pLevel working level
  70. * \param pMesh new level mesh. pLevel = 0 means base mesh,
  71. pLevel = MaxLevel -1 means finest mesh
  72. */
  73. void SetSubdivLevelMesh(int pLevel, FbxMesh* pMesh);
  74. int GetLevelCount() const;
  75. void SetLevelCount(int pLevelCount);
  76. int GetCurrentLevel() const;
  77. void SetCurrentLevel(int pCurrentLevel);
  78. FbxMesh* GetCurrentMesh() const;
  79. FbxSubDiv::EScheme GetSubdivScheme() const;
  80. FbxSubDiv::ETesselationPattern GetTessPattern() const;
  81. void SetSubdivScheme(FbxSubDiv::EScheme pScheme);
  82. void SetTessPattern(FbxSubDiv::ETesselationPattern pPattern);
  83. FbxSubDiv::EDisplaySmoothness GetDisplaySmoothness() const;
  84. void SetDisplaySmoothness(FbxSubDiv::EDisplaySmoothness pSmoothness);
  85. private:
  86. //base geometry mesh for subdivision
  87. FbxMesh* mBaseMesh;
  88. //finest geometry mesh for subdivision
  89. FbxMesh* mFinestMesh;
  90. //current operating subdivision level
  91. int mCurrLevel;
  92. //number of subdiv level
  93. int mLevelCount;
  94. //scheme of subdiv
  95. EScheme mScheme;
  96. //pattern of subdiv
  97. ETesselationPattern mPattern;
  98. //display smoothness of subdiv
  99. EDisplaySmoothness mSmoothness;
  100. };
  101. #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
  102. #include <fbxsdk/fbxsdk_nsend.h>
  103. #endif /* _FBXSDK_SCENE_GEOMETRY_SUB_DIV_H_ */