fbxpatch.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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 fbxpatch.h
  9. #ifndef _FBXSDK_SCENE_GEOMETRY_PATCH_H_
  10. #define _FBXSDK_SCENE_GEOMETRY_PATCH_H_
  11. #include <fbxsdk/fbxsdk_def.h>
  12. #include <fbxsdk/scene/geometry/fbxgeometry.h>
  13. #include <fbxsdk/fbxsdk_nsbegin.h>
  14. /** A patch is a type of node attribute with parametric surface.
  15. * A patch object is useful for creating gently curved surfaces, and provides very detailed control for manipulating complex geometry.
  16. * \nosubgrouping
  17. */
  18. class FBXSDK_DLL FbxPatch : public FbxGeometry
  19. {
  20. FBXSDK_OBJECT_DECLARE(FbxPatch,FbxGeometry);
  21. public:
  22. //! Returns the FbxNodeAttribute::EType::ePatch node attribute type.
  23. virtual FbxNodeAttribute::EType GetAttributeType() const;
  24. //! Resets the patch to its default values.
  25. void Reset();
  26. /**
  27. * \name Patch Properties
  28. */
  29. //@{
  30. /** Sets the surface mode.
  31. * \param pMode Surface mode identifier (see Class FbxGeometry).
  32. */
  33. void SetSurfaceMode(FbxGeometry::ESurfaceMode pMode);
  34. /** Returns the surface mode.
  35. * \return The current surface mode identifier.
  36. */
  37. inline FbxGeometry::ESurfaceMode GetSurfaceMode() const {return mSurfaceMode;}
  38. /** \enum EType Patch types.
  39. * - \e eBezier
  40. * - \e eBezierQuadric
  41. * - \e eCardinal
  42. * - \e eBSpline
  43. * - \e eLinear
  44. */
  45. enum EType
  46. {
  47. eBezier,
  48. eBezierQuadric,
  49. eCardinal,
  50. eBSpline,
  51. eLinear
  52. };
  53. /** Allocates memory space for the control points array.
  54. * \param pUCount Number of U-dimension control points.
  55. * \param pUType U-dimension patch type.
  56. * \param pVCount Number of V-dimension control points.
  57. * \param pVType V-dimension patch type.
  58. */
  59. void InitControlPoints(int pUCount, EType pUType, int pVCount, EType pVType);
  60. /** Returns the number of control points in the U-dimension.
  61. * \return The number of control points in the U-dimension.
  62. */
  63. inline int GetUCount() const {return mUCount;}
  64. /** Returns the number of control points in the V-dimension.
  65. * \return The number of control points in the V-dimension.
  66. */
  67. inline int GetVCount() const {return mVCount;}
  68. /** Returns the U-dimension patch type.
  69. * \return Patch type identifier in the U-dimension.
  70. */
  71. inline EType GetPatchUType() const {return mUType;}
  72. /** Returns the V-dimension patch type.
  73. * \return Patch type identifier in the V-dimension.
  74. */
  75. inline EType GetPatchVType () const {return mVType;}
  76. /** Sets the patch step.
  77. * The step is the number of divisions between adjacent control points.
  78. * \param pUStep Steps in U-dimension.
  79. * \param pVStep Steps in V-dimension.
  80. */
  81. void SetStep(int pUStep, int pVStep);
  82. /** Returns the number of divisions between adjacent control points in the U-dimension.
  83. * \return Step value in the U-dimension.
  84. */
  85. inline int GetUStep() const {return mUStep;}
  86. /** Returns the number of divisions between adjacent control points in the V-dimension.
  87. * \return Step value in the V-dimension.
  88. */
  89. inline int GetVStep() const {return mVStep;}
  90. /** Sets closed flags.
  91. * \param pU Set to \c true if the patch is closed in U dimension.
  92. * \param pV Set to \c true if the patch is closed in V dimension.
  93. */
  94. void SetClosed(bool pU, bool pV);
  95. /** Returns state of the U closed flag.
  96. * \return \c True if the patch is closed in U dimension.
  97. */
  98. inline bool GetUClosed() const {return mUClosed;}
  99. /** Returns state of the V closed flag.
  100. * \return \c True if the patch is closed in V dimension.
  101. */
  102. inline bool GetVClosed() const {return mVClosed;}
  103. /** Sets U-capped flags.
  104. * \param pUBottom Set to \c true if the patch is capped at the bottom in the U-dimension.
  105. * \param pUTop \c Set to \c true if the patch is capped on the top in the U-dimension.
  106. * \remarks Capping options are saved but not loaded by Motionbuilder because they
  107. * are computed from the patch topography.
  108. */
  109. void SetUCapped(bool pUBottom, bool pUTop);
  110. /** Returns state of the bottom U-capped flag.
  111. * \return \c True if the patch is capped at the bottom in the U-dimension.
  112. */
  113. inline bool GetUCappedBottom() const {return mUCappedBottom;}
  114. /** Returns state of the top U-capped flag.
  115. * \return \c True if the patch is capped on the top in the U-dimension.
  116. */
  117. inline bool GetUCappedTop() const {return mUCappedTop;}
  118. /** Sets V-capped flags.
  119. * \param pVBottom Sets to \c true if the patch is capped at the bottom in the V-dimension.
  120. * \param pVTop Sets to \c true if the patch is capped on the top in the V-dimension.
  121. * \remarks Capping options are saved but not loaded by Motionbuilder because they
  122. * are computed from the patch topography.
  123. */
  124. void SetVCapped(bool pVBottom, bool pVTop);
  125. /** Returns state of the bottom V-capped flag.
  126. * \return \c True if the patch is capped at the bottom.
  127. */
  128. inline bool GetVCappedBottom() const {return mVCappedBottom;}
  129. /** Returns state of the top V-capped flag.
  130. * \return \c True if the patch is capped on the top.
  131. */
  132. inline bool GetVCappedTop() const {return mVCappedTop;}
  133. //@}
  134. /**
  135. * \name Off-loading Serialization section
  136. */
  137. //@{
  138. /** Writes the content of the patch to the given stream.
  139. * \param pStream The destination stream.
  140. * \return \c True if the content is successfully processed by the receiving stream.
  141. * If it is not successful, returns \c false.
  142. */
  143. virtual bool ContentWriteTo(FbxStream& pStream) const;
  144. /** Reads the content of the patch from the given stream.
  145. * \param pStream The source stream.
  146. * \return \c True if the patch completes with the data received from the stream successfully.
  147. * If it is not successful, returns \c false.
  148. */
  149. virtual bool ContentReadFrom(const FbxStream& pStream);
  150. //@}
  151. /*****************************************************************************************************************************
  152. ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
  153. *****************************************************************************************************************************/
  154. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  155. virtual FbxObject& Copy(const FbxObject& pObject);
  156. virtual void InitControlPoints(int pCount) { ParentClass::InitControlPoints(pCount); }
  157. virtual void SetControlPointAt(const FbxVector4 &pCtrlPoint , int pIndex) { ParentClass::SetControlPointAt(pCtrlPoint, pIndex); }
  158. protected:
  159. virtual void Construct(const FbxObject* pFrom);
  160. virtual void Destruct(bool pRecursive);
  161. EType mUType, mVType;
  162. int mUCount, mVCount;
  163. int mUStep, mVStep;
  164. bool mUClosed, mVClosed;
  165. bool mUCappedBottom, mUCappedTop;
  166. bool mVCappedBottom, mVCappedTop;
  167. FbxGeometry::ESurfaceMode mSurfaceMode;
  168. #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
  169. };
  170. #include <fbxsdk/fbxsdk_nsend.h>
  171. #endif /* _FBXSDK_SCENE_GEOMETRY_PATCH_H_ */