FBX SDK Reference Guide: kfbxtrimnurbssurface.h Source File
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 - 2008 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 
00063 class KFBX_DLL KFbxBoundary : public KFbxGeometry
00064 {
00065     KFBXOBJECT_DECLARE(KFbxBoundary,KFbxGeometry);
00066 
00067 public:
00068 
00069     // Properties
00070     static const char* sOuterFlag;
00071 
00075     void AddCurve( KFbxNurbsCurve* pCurve );
00076 
00079     int GetCurveCount() const;
00080 
00087     KFbxNurbsCurve* GetCurve( int pIndex );
00088 
00095     KFbxNurbsCurve const* GetCurve( int pIndex ) const;
00096 
00097     virtual EAttributeType GetAttributeType() const { return KFbxNodeAttribute::eBOUNDARY; }
00098 
00099     bool IsPointInControlHull( KFbxVector4& pPoint );
00100 
00101     KFbxVector4 ComputePointInBoundary();
00102 
00103 
00104 
00105 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00107 //
00108 //  WARNING!
00109 //
00110 //  Anything beyond these lines may not be documented accurately and is
00111 //  subject to change without notice.
00112 //
00114 
00115 protected:
00116 
00117     KFbxBoundary(KFbxSdkManager& pManager, char const* pName);
00118     virtual ~KFbxBoundary();
00119 
00120     virtual void Construct(const KFbxBoundary* pFrom);
00121     virtual void Destruct(bool pRecursive, bool pDependents);
00122 
00124     KFbxBoundary& operator = (KFbxBoundary const& pBoundary);
00125 
00126     virtual KString GetTypeName() const;
00127     virtual KStringList GetTypeFlags() const;
00128 
00129     void Reset();
00130 
00131 
00132     bool LineSegmentIntersect( KFbxVector4 & pStart1, KFbxVector4 & pEnd1,
00133                                KFbxVector4 & pStart2, KFbxVector4 & pEnd2 ) const;
00134 
00135 
00136 public:
00137     // Clone
00138     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const;
00139 
00140     void ClearCurves();
00141 
00142     void CopyCurves( KFbxBoundary const& pOther );
00143 
00144     bool IsValid();
00145 
00146     bool IsCounterClockwise();
00147 
00148 #endif // DOXYGEN_SHOULD_SKIP_THIS
00149 
00150 public:
00151     friend class KFbxReaderFbx;
00152 };
00153 
00154 
00158 class KFBX_DLL KFbxTrimNurbsSurface : public KFbxGeometry
00159 {
00160     KFBXOBJECT_DECLARE(KFbxTrimNurbsSurface,KFbxGeometry);
00161 public:
00163     virtual EAttributeType GetAttributeType() const { return KFbxNodeAttribute::eTRIM_NURBS_SURFACE; }
00164 
00165 
00170     int GetTrimRegionCount() const;
00171 
00175     void BeginTrimRegion();
00176 
00181     void EndTrimRegion();
00182 
00193     bool              AddBoundary( KFbxBoundary* pBoundary );
00194 
00202     KFbxBoundary*     GetBoundary( int pIndex, int pRegionIndex = 0 );
00203 
00204     KFbxBoundary const*     GetBoundary( int pIndex, int pRegionIndex = 0 ) const;
00205 
00209     int               GetBoundaryCount(int pRegionIndex = 0) const;
00210 
00214     void       SetNurbsSurface( KFbxNurbsSurface const* pNurbs );
00215 
00219     KFbxNurbsSurface* GetNurbsSurface();
00220 
00224     KFbxNurbsSurface const* GetNurbsSurface() const;
00225 
00229     inline void SetFlipNormals( bool pFlip ) { mFlipNormals = pFlip; }
00230 
00234     inline bool GetFlipNormals() const { return  mFlipNormals; }
00235 
00236 
00237 
00242 
00247     virtual int AddShape(KFbxShape* pShape, char const* pShapeName);
00248 
00253     virtual void ClearShape();
00254 
00259     virtual int GetShapeCount() const;
00260 
00265     virtual KFbxShape* GetShape(int pIndex);
00266 
00271     virtual KFbxShape const* GetShape(int pIndex) const;
00272 
00273 
00278     virtual char const* GetShapeName(int pIndex) const;
00279 
00280 
00285     virtual KFCurve* GetShapeChannel(int pIndex, bool pCreateAsNeeded = false, char const* pTakeName = NULL);
00287 
00288 
00289     virtual int GetControlPointsCount() const;
00290 
00291     virtual void SetControlPointAt(KFbxVector4 &pCtrlPoint, KFbxVector4 &pNormal , int pIndex);
00292 
00293     virtual KFbxVector4* GetControlPoints() const;
00294 
00295 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00297 //
00298 //  WARNING!
00299 //
00300 //  Anything beyond these lines may not be documented accurately and is
00301 //  subject to change without notice.
00302 //
00304 
00305 public:
00306     // Clone
00307     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType = eDEEP_CLONE) const;
00308 
00309     bool IsValid();
00310 
00311 protected:
00312 
00313     KFbxTrimNurbsSurface(KFbxSdkManager& pManager, char const* pName);
00314     virtual ~KFbxTrimNurbsSurface();
00315 
00317     KFbxTrimNurbsSurface& operator = (KFbxTrimNurbsSurface const& pTrimmedNurbs);
00318 
00319     virtual KString GetTypeName() const;
00320     virtual KStringList GetTypeFlags() const;
00321 
00322     void Destruct(bool pRecursive, bool pDependents);
00323 
00324     void ClearBoundaries();
00325 
00326     void CopyBoundaries( KFbxTrimNurbsSurface const& pOther );
00327 
00328     bool IsValid(int pRegion);
00329 
00330     void RebuildRegions();
00331 
00332 private:
00333     bool mFlipNormals;
00334 
00335     KArrayTemplate<int> mRegionIndices;
00336 
00337     bool mNewRegion;
00338 
00339 #endif // DOXYGEN_SHOULD_SKIP_THIS
00340 
00341 public:
00342 
00343     friend class KFbxReaderFbx6;
00344     friend class KFbxReaderFbx7;
00345     friend struct KFbxReaderFbx7Impl;
00346 
00347 };
00348 
00349 typedef KFbxTrimNurbsSurface*   HKFbxTrimNurbsSurface;
00350 typedef KFbxBoundary*           HKFbxBoundary;
00351 
00352 #include <fbxfilesdk_nsend.h>
00353 
00354 #endif // _FBXSDK_TRIM_NURBS_SURFACE_H_
00355