kfbxsubdiv.h

Go to the documentation of this file.
00001 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXSUBDIV_H
00002 #define FBXFILESDK_KFBXPLUGINS_KFBXSUBDIV_H
00003 
00004 /**************************************************************************************
00005 
00006  Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors.
00007  All Rights Reserved.
00008 
00009  The coded instructions, statements, computer programs, and/or related material 
00010  (collectively the "Data") in these files contain unpublished information 
00011  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00012  Canada and United States of America federal copyright law and by international 
00013  treaties. 
00014  
00015  The Data may not be disclosed or distributed to third parties, in whole or in
00016  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00017 
00018  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00019  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00020  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00021  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00022  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00023  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00024  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00028  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00029  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00030  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00031  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00032  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00033  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00034  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00035  OR DAMAGE. 
00036 
00037 **************************************************************************************/
00038 #include <fbxfilesdk/fbxfilesdk_def.h>
00039 
00040 #include <fbxfilesdk/kfbxplugins/kfbxgeometry.h>
00041 
00042 #include <fbxfilesdk/kfbxmath/kfbxvector4.h>
00043 #include <fbxfilesdk/kfbxmath/kfbxvector2.h>
00044 
00045 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00046 
00047 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00048 
00049 class KFbxMesh;
00050 class KFbxSdkManager;
00051 
00052 class KFBX_DLL KFbxSubdiv : public KFbxGeometry
00053 {
00054     KFBXOBJECT_DECLARE(KFbxSubdiv,KFbxGeometry);
00055 
00056 public:
00057 
00058     enum SubdivScheme
00059     {
00060         CATMULL_CLARK,  //Catmull¨CClark subdivision surface
00061         DOO_SABIN,      //Doo¨CSabin subdivision surface
00062         LOOP,           //Loop subdivision surface
00063         LINEAR,         //Linear subdivision surface 
00064     };
00065 
00066     enum TessPattern
00067     {
00068         ODD_FRACTIONAL,
00069         EVEN_FRACTIONAL,
00070         INTEGER,
00071         POWER2,      //Max, Maya use this one
00072     };
00073 
00074     enum SubdivDisplaySmoothness
00075     {
00076         HULL,
00077         ROUGH,
00078         MEDIUM,
00079         FINE,
00080     };
00081 
00087     void InitSubdivLevel(int pLevelCount, 
00088         SubdivScheme pScheme = CATMULL_CLARK, 
00089         TessPattern pPattern = POWER2);
00090 
00091     KFbxSubdiv(KFbxSdkManager& pManager, char const* pName);
00092 
00093     virtual void Destruct(bool pRecursive, bool pDependents);
00094 
00095     virtual KString     GetTypeName() const;
00096     virtual KFbxNodeAttribute::EAttributeType GetAttributeType() const;
00097 
00098 
00099     //max subdivision level number
00100     static const int MAX_SUBDIV_LEVEL = 16;
00101 
00102     //subdiv levels in subdivision, including the base mesh and each subdiv levels
00103     KArrayTemplate<KFbxMesh*> mSubDivLevel;
00104 
00105     //Get the base mesh
00106     KFbxMesh* GetBaseMesh() const; 
00107 
00108     //Get the mesh from finest level
00109     KFbxMesh* GetFinestMesh() const;
00110 
00111     //Set the finest mesh
00112     bool SetFinestMesh(KFbxMesh* pMesh);
00113 
00114     //Set the finest mesh
00115     bool SetBaseMesh(KFbxMesh* pMesh);
00116 
00117     //Get the mesh from specific level
00118     KFbxMesh* GetMesh(int pLevel) const;
00119 
00125     void SetSubdivLevelMesh(int pLevel, KFbxMesh* pMesh);
00126 
00127     int GetLevelCount() const;
00128     void SetLevelCount(int pLevelCount);
00129 
00130     int GetCurrentLevel() const;
00131     void SetCurrentLevel(int pCurrentLevel);
00132 
00133     KFbxMesh* GetCurrentMesh() const;
00134 
00135     KFbxSubdiv::SubdivScheme GetSubdivScheme() const;
00136 
00137     KFbxSubdiv::TessPattern GetTessPattern() const;
00138 
00139     void SetSubdivScheme(KFbxSubdiv::SubdivScheme pScheme);
00140 
00141     void SetTessPattern(KFbxSubdiv::TessPattern pPattern);
00142 
00143     KFbxSubdiv::SubdivDisplaySmoothness GetDisplaySmoothness() const;
00144 
00145     void SetDisplaySmoothness(KFbxSubdiv::SubdivDisplaySmoothness pSmoothness);
00146 
00147 private:
00148 
00149     //base geometry mesh for subdivision
00150     KFbxMesh* mBaseMesh;
00151 
00152     //finest geometry mesh for subdivision
00153     KFbxMesh* mFinestMesh;
00154 
00155     //current operating subdivision level
00156     int mCurrLevel;
00157 
00158     //number of subdiv level
00159     int mLevelCount;
00160 
00161     //scheme of subdiv
00162     SubdivScheme mScheme;
00163 
00164     //pattern of subdiv
00165     TessPattern mPattern;
00166 
00167     //display smoothness of subdiv
00168     SubdivDisplaySmoothness mSmoothness;
00169 
00170     
00171 
00172 
00173 };
00174 
00175 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00176 
00177 #endif // FBXFILESDK_KFBXPLUGINS_KFBXSUBDIV_H