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