kfbxtrimnurbssurface.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_TRIM_NURBS_SURFACE_H_
00005 #define _FBXSDK_TRIM_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/kfbxgeometry.h>
00050 #include <kfbxplugins/kfbxnurbssurface.h>
00051 #include <kfbxplugins/kfbxnurbscurve.h>
00052 #include <kfbxplugins/kfbxgenericnode.h>
00053 
00054 
00055 #include <fbxfilesdk_nsbegin.h>
00056 
00057 class KFbxTrimNurbsSurface_internal;
00058 class KFbxBoundary_internal;
00059 
00066 class KFBX_DLL KFbxBoundary : public KFbxGeometry
00067 {
00068     KFBXOBJECT_DECLARE(KFbxBoundary);
00069 
00070 public:
00071 
00072     // Properties
00073     static const char* sOuterFlag;
00074 
00078     void AddCurve( KFbxNurbsCurve* pCurve );
00079 
00082     int GetCurveCount() const;
00083 
00090     KFbxNurbsCurve* GetCurve( int pIndex );
00091 
00098     KFbxNurbsCurve const* GetCurve( int pIndex ) const;
00099 
00100     virtual EAttributeType GetAttributeType() const { return KFbxNodeAttribute::eBOUNDARY; }
00101 
00102     bool IsPointInControlHull( KFbxVector4& pPoint );
00103 
00104     KFbxVector4 ComputePointInBoundary();
00105 
00106 
00107 
00108 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00110 //
00111 //  WARNING!
00112 //
00113 //  Anything beyond these lines may not be documented accurately and is 
00114 //  subject to change without notice.
00115 //
00117 
00118 protected:
00119     static char const* GetNamePrefix() { return 0; }
00120 
00121     KFbxBoundary(KFbxSdkManager& pManager, char const* pName);
00122     virtual ~KFbxBoundary();
00123 
00124     void Destruct(bool pRecursive, bool pDependents);
00125 
00127     KFbxBoundary& operator = (KFbxBoundary const& pBoundary);
00128 
00129     virtual KString GetTypeName() const;
00130     virtual KStringList GetTypeFlags() const;
00131 
00132     void Reset();
00133 
00134     
00135     bool LineSegmentIntersect( KFbxVector4 & pStart1, KFbxVector4 & pEnd1, 
00136                                KFbxVector4 & pStart2, KFbxVector4 & pEnd2 ) const;
00137 
00138 
00139 public:
00140     virtual KObject*  GetFbxObject_internal();
00141     virtual KObject const*  GetFbxObject_internal() const;
00142 
00143     // Clone
00144     virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const;
00145 
00146     void ClearCurves();
00147 
00148     void CopyCurves( KFbxBoundary const& pOther );
00149 
00150     bool IsValid();
00151 
00152     bool IsCounterClockwise();
00153 
00154 private:
00155     KFbxBoundary_internal* mPH;
00156 
00157 #endif // DOXYGEN_SHOULD_SKIP_THIS
00158 
00159 public:
00160     friend class KFbxReaderFbx;
00161 };
00162 
00163 
00167 class KFBX_DLL KFbxTrimNurbsSurface : public KFbxGeometry 
00168 {
00169     KFBXOBJECT_DECLARE(KFbxTrimNurbsSurface);
00170 public:
00172     virtual EAttributeType GetAttributeType() const { return KFbxNodeAttribute::eTRIM_NURBS_SURFACE; }
00173 
00174 
00179     int GetTrimRegionCount() const;
00180 
00184     void BeginTrimRegion();
00185 
00190     void EndTrimRegion();
00191 
00202     bool              AddBoundary( KFbxBoundary* pBoundary );
00203 
00211     KFbxBoundary*     GetBoundary( int pIndex, int pRegionIndex = 0 );
00212 
00213     KFbxBoundary const*     GetBoundary( int pIndex, int pRegionIndex = 0 ) const;
00214 
00218     int               GetBoundaryCount(int pRegionIndex = 0) const;
00219 
00223     void       SetNurbsSurface( KFbxNurbsSurface const* pNurbs );
00224 
00228     KFbxNurbsSurface* GetNurbsSurface();
00229 
00233     KFbxNurbsSurface const* GetNurbsSurface() const;
00234 
00238     inline void SetFlipNormals( bool pFlip ) { mFlipNormals = pFlip; }
00239 
00243     inline bool GetFlipNormals() const { return  mFlipNormals; }
00244 
00245 
00246 
00251 
00256     virtual int AddShape(KFbxShape* pShape, char const* pShapeName);
00257 
00262     virtual void ClearShape();
00263 
00268     virtual int GetShapeCount() const;
00269 
00274     virtual KFbxShape* GetShape(int pIndex);
00275 
00280     virtual KFbxShape const* GetShape(int pIndex) const;
00281 
00282 
00287     virtual char const* GetShapeName(int pIndex) const;
00288     
00289 
00294     virtual KFCurve* GetShapeChannel(KFbxTakeNode* pTakeNode, int pShapeIndex);
00295 
00297     
00298 
00299     virtual int GetControlPointsCount() const;
00300 
00301     virtual void SetControlPointAt(KFbxVector4 &pCtrlPoint, KFbxVector4 &pNormal , int pIndex);
00302 
00303     virtual KFbxVector4* GetControlPoints();
00304 
00305 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00307 //
00308 //  WARNING!
00309 //
00310 //  Anything beyond these lines may not be documented accurately and is 
00311 //  subject to change without notice.
00312 //
00314 
00315 public:
00316     virtual KObject*  GetFbxObject_internal();
00317     virtual KObject const*  GetFbxObject_internal() const;
00318 
00319     // Clone
00320     virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const;
00321 
00322     bool IsValid();
00323 
00324 protected:
00325     static char const* GetNamePrefix() { return 0; }
00326 
00327     KFbxTrimNurbsSurface(KFbxSdkManager& pManager, char const* pName);
00328     virtual ~KFbxTrimNurbsSurface();
00329 
00331     KFbxTrimNurbsSurface& operator = (KFbxTrimNurbsSurface const& pTrimmedNurbs);
00332 
00333     virtual KString GetTypeName() const;
00334     virtual KStringList GetTypeFlags() const;
00335 
00336     void Destruct(bool pRecursive, bool pDependents);
00337 
00338     void ClearBoundaries();
00339 
00340     void CopyBoundaries( KFbxTrimNurbsSurface const& pOther );
00341 
00342     bool IsValid(int pRegion);
00343 
00344     void RebuildRegions();
00345 
00346 private:
00347 
00348     // Internal Property Handler
00349     KFbxTrimNurbsSurface_internal* mPH;
00350 
00351     bool mFlipNormals;
00352 
00353     KArrayTemplate<int> mRegionIndices;
00354 
00355     bool mNewRegion;
00356 
00357 #endif // DOXYGEN_SHOULD_SKIP_THIS
00358 
00359 public:
00360 
00361     friend class KFbxReaderFbx6;
00362 
00363 };
00364 
00365 typedef KFbxTrimNurbsSurface*   HKFbxTrimNurbsSurface;
00366 typedef KFbxBoundary*           HKFbxBoundary;
00367 
00368 #include <fbxfilesdk_nsend.h>
00369 
00370 #endif // _FBXSDK_TRIM_NURBS_SURFACE_H_
00371