kfbxnurbssurface.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_NURBS_SURFACE_H_
00005 #define _FBXSDK_NURBS_SURFACE_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2001 - 2007 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material
00013  (collectively the "Data") in these files contain unpublished information
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00015  Canada and United States of America federal copyright law and by international
00016  treaties.
00017 
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00028 
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE.
00039 
00040 **************************************************************************************/
00041 
00042 #include <kaydaradef.h>
00043 #ifndef KFBX_DLL 
00044     #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <kaydara.h>
00048 
00049 #include <kfbxplugins/kfbxnode.h>
00050 #include <kfbxplugins/kfbxgeometry.h>
00051 
00052 #include <fbxfilesdk_nsbegin.h>
00053 
00054 class KFbxPatch;
00055 class KFbxSdkManager;
00056 class KFbxNurbsSurface_internal;
00057 
00067 class KFBX_DLL KFbxNurbsSurface : public KFbxGeometry 
00068 {
00069     KFBXOBJECT_DECLARE(KFbxNurbsSurface);
00070 public:
00072     virtual EAttributeType GetAttributeType() const { return KFbxNodeAttribute::eNURBS_SURFACE; }
00073 
00075     void Reset();
00076 
00081 
00085     void SetSurfaceMode(KFbxGeometry::ESurfaceMode pMode);
00086 
00090     inline ESurfaceMode GetSurfaceMode() const {return mSurfaceMode;}
00091 
00097     typedef enum 
00098     {
00099         ePERIODIC, 
00100         eCLOSED, 
00101         eOPEN 
00102     } ENurbType;
00103 
00112     void InitControlPoints(int pUCount, ENurbType pUType, int pVCount, ENurbType pVType);
00113 
00117     inline int GetUCount() const {return mUCount;}
00118     
00122     inline int GetVCount() const {return mVCount;}
00123     
00127     inline ENurbType GetNurbUType() const {return mUType;}
00128     
00132     inline ENurbType GetNurbVType() const {return mVType;}
00133 
00137     int GetUKnotCount() const;
00138 
00142     double* GetUKnotVector() const;
00143     
00147     int GetVKnotCount() const;
00148 
00152     double* GetVKnotVector() const;
00153     
00159     //int* GetUMultiplicityVector();
00160     
00166     //int* GetVMultiplicityVector();
00167 
00172     void SetOrder(kUInt pUOrder, kUInt pVOrder);
00173 
00177     inline int GetUOrder() const {return mUOrder;}
00178     
00182     inline int GetVOrder() const {return mVOrder;}
00183 
00189     void SetStep(int pUStep, int pVStep);
00190 
00194     inline int GetUStep() const {return mUStep;}
00195     
00199     inline int GetVStep() const {return mVStep;}
00200 
00201     /* Calculates the number of spans in the surface in the U direction.
00202      * See KFbxNurbsCurve::GetSpanCount() for more information.
00203      * \returns The number of spans in U if the surface has been initialized, -1 otherwise.
00204      */
00205     int GetUSpanCount() const;
00206 
00207     /* Calculates the number of spans in the surface in the V direction.
00208      * See KFbxNurbsCurve::GetSpanCount() for more information.
00209      * \returns The number of spans in V if the surface has been initialized, -1 otherwise.
00210      */
00211     int GetVSpanCount() const; 
00212 
00214 
00219 
00223     void SetApplyFlipUV(bool pFlag);
00224 
00228     bool GetApplyFlipUV() const;
00229 
00233     void SetApplyFlipLinks(bool pFlag);
00234 
00238     bool GetApplyFlipLinks() const;
00239 
00243     bool GetApplyFlip() const { return GetApplyFlipUV() || GetApplyFlipLinks(); }
00244 
00249     void AddCurveOnSurface( KFbxNode* pCurve );
00250     
00251     /* Retrieves a curve on this surface
00252      * \param pIndex Index of the curve to retrieve. Valid range is 0 to GetCurveOnSurfaceCount() - 1
00253      * \return The curve at the specified index, or NULL if pIndex is out of range.
00254      */
00255     KFbxNode* GetCurveOnSurface( int pIndex );
00256     KFbxNode const* GetCurveOnSurface( int pIndex ) const;
00257 
00258     /* \return The number of curves on this surface
00259      */
00260     int GetCurveOnSurfaceCount() const;
00261     
00262     /* Removes a curve from this surface.
00263      * \param pCurve The curve to remove
00264      * \return True if the curve was removed, false otherwise.
00265      */
00266     bool RemoveCurveOnSurface( KFbxNode* pCurve );
00267 
00269 
00273     bool IsRational();
00274 
00275 
00277 //
00278 //  WARNING!
00279 //
00280 //  Anything beyond these lines may not be documented accurately and is 
00281 //  subject to change without notice.
00282 //
00284 
00285 
00286 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00287 
00288 public:
00289 
00290     void SetFlipNormals(bool pFlipNormals);
00291 
00292     bool GetFlipNormals() const;
00293 
00294 
00295     virtual KObject*  GetFbxObject_internal();
00296     virtual KObject const*  GetFbxObject_internal() const;
00297 
00298     // Clone
00299     virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const;
00300 
00301 protected:
00302 
00303     static char const* GetNamePrefix() { return 0; }
00304 
00305     KFbxNurbsSurface(KFbxSdkManager& pManager, char const* pName);
00306     virtual ~KFbxNurbsSurface();
00307 
00308     virtual void Destruct(bool pRecursive, bool pDependents);
00309 
00311     KFbxNurbsSurface& operator=(KFbxNurbsSurface const& pNurb);
00312 
00313     virtual KString     GetTypeName() const;
00314     virtual KStringList GetTypeFlags() const;
00315 
00316     kUInt mUOrder, mVOrder;
00317     int mUCount, mVCount;
00318     int mUStep, mVStep;
00319     ENurbType mUType, mVType;
00320     
00321     double* mUKnotVector;
00322     double* mVKnotVector;
00323     
00324     //int* mUMultiplicityVector;
00325     //int* mVMultiplicityVector;
00326 
00327     ESurfaceMode mSurfaceMode;
00328 
00329     // Export flags.
00330     bool mApplyFlipUV;
00331     bool mApplyFlipLinks;
00332 
00333     bool mFlipNormals;
00334 
00335     // Error identifiers, these are only used internally.
00336     typedef enum 
00337     {
00338         eNurbTypeUnknown,
00339         eWrongNumberOfControlPoint,
00340         eWeightTooSmall,
00341         //eUMultiplicityVectorError,
00342         //eVMultiplicityVectorError,
00343         eUKnotVectorError,
00344         eVKnotVectorError,
00345         eErrorCount
00346     } EError;
00347 
00348     // Internal Property Handler
00349     KFbxNurbsSurface_internal* mPH;
00350     
00351     friend class KFbxReaderFbx;
00352     friend class KFbxReaderFbx6;
00353     friend class KFbxWriterFbx;
00354     friend class KFbxWriterFbx6;
00355     friend class KFbxGeometryConverter;
00356 
00357 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00358 
00359 };
00360 
00361 typedef KFbxNurbsSurface* HKFbxNurbsSurface;
00362 
00363 #include <fbxfilesdk_nsend.h>
00364 
00365 #endif // #ifndef _FBXSDK_NURBS_SURFACE_H_
00366 
00367