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 - 2010 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 KFbxNodeAttribute::EAttributeType GetAttributeType() const;
00096 
00097 
00098     //max subdivision level number
00099     static const int MAX_SUBDIV_LEVEL = 16;
00100 
00101     //subdiv levels in subdivision, including the base mesh and each subdiv levels
00102     KArrayTemplate<KFbxMesh*> mSubDivLevel;
00103 
00104     //Get the base mesh
00105     KFbxMesh* GetBaseMesh() const; 
00106 
00107     //Get the mesh from finest level
00108     KFbxMesh* GetFinestMesh() const;
00109 
00110     //Set the finest mesh
00111     bool SetFinestMesh(KFbxMesh* pMesh);
00112 
00113     //Set the finest mesh
00114     bool SetBaseMesh(KFbxMesh* pMesh);
00115 
00116     //Get the mesh from specific level
00117     KFbxMesh* GetMesh(int pLevel) const;
00118 
00124     void SetSubdivLevelMesh(int pLevel, KFbxMesh* pMesh);
00125 
00126     int GetLevelCount() const;
00127     void SetLevelCount(int pLevelCount);
00128 
00129     int GetCurrentLevel() const;
00130     void SetCurrentLevel(int pCurrentLevel);
00131 
00132     KFbxMesh* GetCurrentMesh() const;
00133 
00134     KFbxSubdiv::SubdivScheme GetSubdivScheme() const;
00135 
00136     KFbxSubdiv::TessPattern GetTessPattern() const;
00137 
00138     void SetSubdivScheme(KFbxSubdiv::SubdivScheme pScheme);
00139 
00140     void SetTessPattern(KFbxSubdiv::TessPattern pPattern);
00141 
00142     KFbxSubdiv::SubdivDisplaySmoothness GetDisplaySmoothness() const;
00143 
00144     void SetDisplaySmoothness(KFbxSubdiv::SubdivDisplaySmoothness pSmoothness);
00145 
00146 private:
00147 
00148     //base geometry mesh for subdivision
00149     KFbxMesh* mBaseMesh;
00150 
00151     //finest geometry mesh for subdivision
00152     KFbxMesh* mFinestMesh;
00153 
00154     //current operating subdivision level
00155     int mCurrLevel;
00156 
00157     //number of subdiv level
00158     int mLevelCount;
00159 
00160     //scheme of subdiv
00161     SubdivScheme mScheme;
00162 
00163     //pattern of subdiv
00164     TessPattern mPattern;
00165 
00166     //display smoothness of subdiv
00167     SubdivDisplaySmoothness mSmoothness;
00168 
00169     
00170 
00171 
00172 };
00173 
00174 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00175 
00176 #endif // FBXFILESDK_KFBXPLUGINS_KFBXSUBDIV_H