fbxgeometry.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_SCENE_GEOMETRY_H_
00014 #define _FBXSDK_SCENE_GEOMETRY_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/scene/geometry/fbxgeometrybase.h>
00019 #include <fbxsdk/scene/geometry/fbxdeformer.h>
00020 #include <fbxsdk/scene/geometry/fbxshape.h>
00021 #include <fbxsdk/scene/geometry/fbxblendshape.h>
00022 #include <fbxsdk/scene/geometry/fbxblendshapechannel.h>
00023 
00024 #include <fbxsdk/core/base/fbxarray.h>
00025 #include <fbxsdk/core/base/fbxerror.h>
00026 
00027 #include <fbxsdk/core/math/fbxaffinematrix.h>
00028 #include <fbxsdk/fbxsdk_nsbegin.h>
00029 
00030 class FbxGeometryWeightedMap;
00031 class FbxNode;
00032 class FbxShape;
00033 class FbxTexture;
00034 class FbxManager;
00035 class FbxVector4;
00036 class FbxAnimCurve;
00037 class FbxAnimLayer;
00038 class FbxScene;
00039 class FbxCluster;
00040 
00057 class FBXSDK_DLL FbxGeometry : public FbxGeometryBase
00058 {
00059     FBXSDK_OBJECT_DECLARE(FbxGeometry,FbxGeometryBase);
00060 
00061 public:
00068     virtual FbxNodeAttribute::EType GetAttributeType() const;
00069 
00074 
00080     int AddDeformer(FbxDeformer* pDeformer);
00081 
00087     FbxDeformer* RemoveDeformer(int pIndex);
00088 
00092     int GetDeformerCount() const;
00093 
00099     FbxDeformer* GetDeformer(int pIndex) const;
00100 
00105     int GetDeformerCount(FbxDeformer::EDeformerType pType) const;
00106 
00113     FbxDeformer* GetDeformer(int pIndex, FbxDeformer::EDeformerType pType) const;
00114 
00116 
00121 
00125     FbxGeometryWeightedMap* GetSourceGeometryWeightedMap();
00126 
00130     int GetDestinationGeometryWeightedMapCount() const;
00131 
00136     FbxGeometryWeightedMap* GetDestinationGeometryWeightedMap(int pIndex);
00137 
00139 
00144 
00152     bool AddShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, FbxShape* pShape, double pPercent = 100);
00153 
00158     void ClearShape();
00159 
00163     int GetShapeCount() const;
00164 
00170     int GetShapeCount(int pBlendShapeIndex, int pBlendShapeChannelIndex) const;
00171 
00179     FbxShape* GetShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, int pShapeIndex);
00180 
00188     FbxShape const* GetShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, int pShapeIndex) const;
00189 
00203     FbxAnimCurve* GetShapeChannel(int pBlendShapeIndex, int pBlendShapeChannelIndex, FbxAnimLayer* pLayer, bool pCreateAsNeeded = false);
00205 
00212     enum ESurfaceMode
00213     {
00214         eRaw,           
00215         eLowNoNormals,  
00216         eLow,           
00217         eHighNoNormals, 
00218         eHigh           
00219     };
00220 
00228 
00233     FbxAMatrix& GetPivot(FbxAMatrix& pXMatrix) const;
00234 
00238     void SetPivot(FbxAMatrix& pXMatrix);
00239 
00242     void ApplyPivot();
00243 
00245 
00252 
00261     void SetDefaultShape(int pBlendShapeIndex, int pBlendShapeChannelIndex, double pPercent);
00262 
00271     void SetDefaultShape(FbxBlendShapeChannel* pBlendShapeChannel,  double pPercent);
00272 
00280     double GetDefaultShape(int pBlendShapeIndex, int pBlendShapeChannelIndex) const;
00281 
00289     double GetDefaultShape(FbxBlendShapeChannel* pBlendShapeChannel) const;
00290 
00292 
00297 
00301     FbxError& GetError ();
00302 
00305     enum EErrorCode
00306     {
00307         eIndexOutOfRange,           
00308         eNullParameter,             
00309         eShapeAlreadyAdded,         
00310         eShapeInvalidName,          
00311         eShapeNameClash,                
00312         eShapeNoCurveFound,         
00313         eUnknownError,                  
00314         eErrorCount
00315     };
00316 
00320     EErrorCode GetLastErrorID() const;
00321 
00325     const char* GetLastErrorString() const;
00326 
00328 
00330 //
00331 //  WARNING!
00332 //
00333 //  Anything beyond these lines may not be documented accurately and is
00334 //  subject to change without notice.
00335 //
00337 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00338 
00339     virtual FbxObject& Copy(const FbxObject& pObject);
00340 
00341 protected:
00342     FbxGeometry(FbxManager& pManager, char const* pName);
00343     virtual void Destruct(bool pRecursive, bool pDependents);
00344 
00345     virtual void SetDocument(FbxDocument* pDocument);
00346 
00347 public:
00349     void CleanShapeChannels(FbxAnimLayer* pAnimLayer);
00351     void CleanShapeChannel(FbxAnimLayer* pAnimLayer, int pShapeIndex);
00352 
00353     void CreateShapeChannelProperties(FbxString& pShapeName);
00354 
00355 protected:
00356     // Shape channel name creation for nurb and patch.
00357     FbxString CreateShapeChannelName(int pShapeIndex);
00358 
00359     // Shape channel name creation for mesh.
00360     FbxString CreateShapeChannelName(FbxString pShapeName);
00361 
00362 public:
00363     void ConvertShapeNamesToV5Format(FbxString pTakeNodeName);
00364     void ConvertShapeNamesToV5Format(FbxString pTakeNodeName, int pShapeIndex);
00365     void RevertShapeNamesToV6Format(FbxString pTakeNodeName);
00366     void RevertShapeNamesToV6Format(FbxString pTakeNodeName, int pShapeIndex);
00367     void ClearTemporaryShapeNames();
00368 
00369 protected:
00370     void CopyDeformers(FbxGeometry const* pGeometry);
00371     void CopyPivot(FbxGeometry const* pSource);
00372 
00373     // Used during FBX v5 file store
00374     FbxArray<FbxString*> mShapeNameArrayV6;
00375     FbxArray<FbxString*> mShapeNameArrayV5;
00376     FbxArray<FbxString*> mShapeChannelNameArrayV5;
00377 
00378     FbxAMatrix* mPivot;
00379 
00380 
00381     mutable FbxError mError;
00382 
00383     friend class FbxScene;
00384 
00385 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00386 
00387 };
00388 
00389 #include <fbxsdk/fbxsdk_nsend.h>
00390 
00391 #endif /* _FBXSDK_SCENE_GEOMETRY_H_ */