00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRY_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRY_H
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00044 
00045 #include <fbxfilesdk/kfbxplugins/kfbxgeometrybase.h>
00046 #include <fbxfilesdk/kfbxplugins/kfbxdeformer.h>
00047 
00048 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00049 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00050 
00051 #include <fbxfilesdk/components/kfcurve/kfcurve_forward.h>
00052 
00053 #include <fbxfilesdk/kfbxmath/kfbxxmatrix.h>
00054 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00055 
00056 class KFbxGeometryWeightedMap;
00057 class KFbxNode;
00058 class KFbxShape;
00059 class KFbxTexture;
00060 class KFbxSdkManager;
00061 class KFbxVector4;
00062 class KFbxTakeNode;
00063 class KFbxScene;
00064 class KFbxCluster;
00065 typedef class KFbxCluster KFbxLink;
00066 
00074 class KFBX_DLL KFbxGeometry : public KFbxGeometryBase
00075 {
00076     KFBXOBJECT_DECLARE(KFbxGeometry,KFbxGeometryBase);
00077 
00078 public:
00082     virtual EAttributeType GetAttributeType() const;
00083 
00088 
00093     int AddDeformer(KFbxDeformer* pDeformer);
00094 
00098     int GetDeformerCount() const;
00099 
00105     KFbxDeformer* GetDeformer(int pIndex) const;
00106 
00111     int GetDeformerCount(KFbxDeformer::EDeformerType pType) const;
00112 
00119     KFbxDeformer* GetDeformer(int pIndex, KFbxDeformer::EDeformerType pType) const;
00120 
00122 
00127 
00131     KFbxGeometryWeightedMap* GetSourceGeometryWeightedMap();
00132 
00136     int GetDestinationGeometryWeightedMapCount();
00137 
00142     KFbxGeometryWeightedMap* GetDestinationGeometryWeightedMap(int pIndex);
00143 
00145 
00150 
00164     virtual int AddShape(KFbxShape* pShape, char const* pShapeName);
00165 
00170     virtual void ClearShape();
00171 
00175     virtual int GetShapeCount() const;
00176 
00182     virtual KFbxShape* GetShape(int pIndex);
00183 
00189     virtual KFbxShape const* GetShape(int pIndex) const;
00190 
00196     virtual char const* GetShapeName(int pIndex) const;
00197 
00209     virtual KFCurve* GetShapeChannel(char const* pShapeName, bool pCreateAsNeeded = false, char const* pTakeName = NULL);
00210 
00222     virtual KFCurve* GetShapeChannel(int pIndex, bool pCreateAsNeeded = false, char const* pTakeName = NULL);
00223 
00225 
00237     typedef enum
00238     {
00239         eRAW,
00240         eLOW_NO_NORMALS,
00241         eLOW,
00242         eHIGH_NO_NORMALS,
00243         eHIGH
00244     } ESurfaceMode;
00245 
00253 
00258     KFbxXMatrix& GetPivot(KFbxXMatrix& pXMatrix) const;
00259 
00263     void SetPivot(KFbxXMatrix& pXMatrix);
00264 
00267     void ApplyPivot();
00268 
00270 
00279 
00287     void SetDefaultShape(int pIndex, double pPercent);
00295     void SetDefaultShape(char const* pShapeName, double pPercent);
00296 
00303     double GetDefaultShape(int pIndex);
00310     double GetDefaultShape(char const* pShapeName);
00311 
00313 
00318 
00322     KError& GetError ();
00323 
00337     typedef enum
00338     {
00339         eINDEX_OUT_OF_RANGE,
00340         eNULL_PARAMETER,
00341         eMATERIAL_NOT_FOUND,
00342         eMATERIAL_ALREADY_ADDED,
00343         eTEXTURE_NOT_FOUND,
00344         eTEXTURE_ALREADY_ADDED,
00345         eSHAPE_ALREADY_ADDED,
00346         eSHAPE_INVALID_NAME,
00347         eSHAPE_NAME_CLASH,
00348         eSHAPE_NO_CURVE_FOUND,
00349         eUNKNOWN_ERROR,
00350         eERROR_COUNT
00351     } EError;
00352 
00356     EError GetLastErrorID() const;
00357 
00361     const char* GetLastErrorString() const;
00362 
00364 
00365     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00366 
00368 
00369 
00370 
00371 
00372 
00373 
00375 
00376 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00377 
00378 protected:
00379     KFbxGeometry(KFbxSdkManager& pManager, char const* pName);
00380 
00382     KFbxGeometry& operator=(KFbxGeometry const& pGeometry);
00383 
00384     virtual void Destruct(bool pRecursive, bool pDependents);
00385 
00386     virtual void SetDocument(KFbxDocument* pDocument);
00387 
00392     virtual void SetNode(KFbxNode& pNode);
00393 
00397     virtual void UnsetNode();
00398 
00402     bool AddShapeChannel(KString pTakeNodeName, int pShapeIndex);
00403 
00407     bool RemoveShapeChannel(KString pTakeNodeName, int pShapeIndex);
00408 
00409 public:
00410     
00411     
00412     
00413     
00414     
00415     
00416     
00417     void CleanShapeChannels(KString pTakeNodeName);
00418     void CleanShapeChannel(KString pTakeNodeName, int pShapeIndex);
00419 
00420 protected:
00421     
00422     KString CreateShapeChannelName(int pShapeIndex);
00423 
00424     
00425     KString CreateShapeChannelName(KString pShapeName);
00426 
00427     void CreateShapeChannelProperties(KString& pShapeName);
00428 
00429 public:
00430     void ConvertShapeNamesToV5Format(KString pTakeNodeName);
00431     void ConvertShapeNamesToV5Format(KString pTakeNodeName, int pShapeIndex);
00432     void RevertShapeNamesToV6Format(KString pTakeNodeName);
00433     void RevertShapeNamesToV6Format(KString pTakeNodeName, int pShapeIndex);
00434     void ClearTemporaryShapeNames();
00435 
00436 protected:
00442     KFbxDeformer* RemoveDeformer(int pIndex);
00443 
00449     
00450     
00451     
00452 
00453     void CopyDeformers(KFbxGeometry const* pGeometry);
00454     void CopyShapes(KFbxGeometry const* pGeometry);
00455 
00456     void CopyPivot(KFbxGeometry const* pSource);
00457 
00458     KArrayTemplate <KFbxShape*> mShapeArray;
00459 
00460     KArrayTemplate <KString*> mShapeNameArray;
00461 
00462     
00463     KArrayTemplate<KString*> mShapeNameArrayV6;
00464     KArrayTemplate<KString*> mShapeNameArrayV5;
00465     KArrayTemplate<KString*> mShapeChannelNameArrayV5;
00466 
00467     KFbxXMatrix* mPivot;
00468 
00469 
00470     mutable KError mError;
00471 
00472     friend class KFbxScene;
00473 
00474 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00475 
00476 };
00477 
00478 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00479 
00480 #endif // FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRY_H
00481