fbxsdk/utils/fbxgeometryconverter.h Source File
 
 
 
fbxsdk/utils/fbxgeometryconverter.h
Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 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_UTILS_GEOMETRY_CONVERTER_H_
00014 #define _FBXSDK_UTILS_GEOMETRY_CONVERTER_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/base/fbxarray.h>
00019 
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021 
00022 class FbxManager;
00023 class FbxMesh;
00024 class FbxPatch;
00025 class FbxNurbs;
00026 class FbxNurbsSurface;
00027 class FbxNurbsCurve;
00028 class FbxWeightedMapping;
00029 class FbxSurfaceEvaluator;
00030 
00037 class FBXSDK_DLL FbxGeometryConverter
00038 {
00039 public:
00049                 bool Triangulate(FbxScene* pScene, bool pReplace, bool pLegacy=false);
00050 
00058                 FbxNodeAttribute* Triangulate(FbxNodeAttribute* pNodeAttribute, bool pReplace, bool pLegacy=false);
00059 
00067                 bool ComputeGeometryControlPointsWeightedMapping(FbxGeometry* pSrcGeom, FbxGeometry* pDstGeom, FbxWeightedMapping* pSrcToDstWeightedMapping, bool pSwapUV=false);
00068 
00073                 FBX_DEPRECATED FbxMesh* TriangulateMesh(const FbxMesh* pMesh);
00074 
00079                 FBX_DEPRECATED FbxMesh* TriangulateMeshAdvance(const FbxMesh* pMesh);
00080 
00085                 FBX_DEPRECATED FbxMesh* TriangulatePatch(const FbxPatch* pPatch);
00086 
00091                 FBX_DEPRECATED FbxMesh* TriangulateNurbs(const FbxNurbs* pNurbs);
00092 
00098                 FBX_DEPRECATED bool TriangulateInPlace(FbxNode* pNode);
00100 
00110                 FbxNurbs* ConvertPatchToNurbs(FbxPatch *pPatch);
00111 
00118                 bool ConvertPatchToNurbsInPlace(FbxNode* pNode);
00119 
00125                 FbxNurbsSurface* ConvertPatchToNurbsSurface(FbxPatch *pPatch);
00126 
00133                 bool ConvertPatchToNurbsSurfaceInPlace(FbxNode* pNode);
00134 
00139                 FbxNurbsSurface* ConvertNurbsToNurbsSurface( FbxNurbs* pNurbs );
00140 
00145                 FbxNurbs* ConvertNurbsSurfaceToNurbs( FbxNurbsSurface* pNurbs );
00146 
00152                 bool ConvertNurbsToNurbsSurfaceInPlace(FbxNode* pNode);
00153 
00159                 bool ConvertNurbsSurfaceToNurbsInPlace(FbxNode* pNode);
00161 
00172                 FbxNurbs* FlipNurbs(FbxNurbs* pNurbs, bool pSwapUV, bool pSwapClusters);
00173 
00180                 FbxNurbsSurface* FlipNurbsSurface(FbxNurbsSurface* pNurbs, bool pSwapUV, bool pSwapClusters);
00182 
00200                 bool EmulateNormalsByPolygonVertex(FbxMesh* pMesh);
00201 
00211                 bool ComputeEdgeSmoothingFromNormals( FbxMesh* pMesh ) const;
00212 
00222                 bool ComputePolygonSmoothingFromEdgeSmoothing( FbxMesh* pMesh, int pIndex=0 ) const;
00223 
00231                 bool ComputeEdgeSmoothingFromPolygonSmoothing( FbxMesh* pMesh, int pIndex=0 ) const;
00233 
00241                 bool SplitMeshesPerMaterial(FbxScene* pScene, bool pReplace);
00242 
00251                 bool SplitMeshPerMaterial(FbxMesh* pMesh, bool pReplace);
00253 
00275         FbxNode* MergeMeshes(FbxArray<FbxNode*>& pMeshNodes, const char* pNodeName, FbxScene* pScene);
00276 
00277 /*****************************************************************************************************************************
00278 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00279 *****************************************************************************************************************************/
00280 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00281     FbxGeometryConverter(FbxManager* pManager);
00282     ~FbxGeometryConverter();
00283 
00284 private:
00285         FbxMesh* TriangulateMeshInternal(const FbxMesh* pMesh);
00286         FbxMesh* TriangulateMeshInternalLegacy(const FbxMesh* pMesh);
00287         FbxMesh* TriangulatePatchInternal(const FbxPatch* pPatch);
00288         FbxMesh* TriangulateNurbsInternal(const FbxNurbs* pNurbs);
00289 
00290         bool AddAlternateGeometry(FbxNode* pNode, FbxGeometry* pSrcGeom, FbxGeometry* pAltGeom, FbxWeightedMapping* pSrcToAltWeightedMapping, bool pConvertDeformations);
00291         bool ConvertGeometryAnimation(FbxNode* pNode, FbxGeometry* pSrcGeom, FbxGeometry* pDstGeom);
00292         void ReplaceNodeAttribute(FbxNode* pNode, FbxNodeAttribute* pNewNodeAttr);
00293         bool AddTriangulatedMeshGeometry(FbxNode* pNode, int pUVStepCoeff);
00294         bool CreateAndCopyLayerElement(FbxMesh *pNewMesh, FbxMesh *pRefMesh);
00295         bool SetLayerElements(FbxMesh *pNewMesh, FbxMesh *pMesh, int pPolygonIndex, int pPolyPointIndex, int pLoopIndex, bool pIsSearched, bool pIsEndPolygon);
00296 
00314     static void FbxTriangulation(int *Index, int pNumSide);
00315 
00316     bool ComputePatchToMeshControlPointsWeightedMapping(FbxPatch* pSrcPatch, FbxMesh* pDstMesh, FbxWeightedMapping* pMapping, bool pSwapUV=false);
00317     bool ComputeNurbsToMeshControlPointsWeightedMapping(FbxNurbsSurface* pSrcNurbs, FbxMesh* pDstMesh, FbxWeightedMapping* pMapping, bool pRescaleUVs=false, bool pSwapUV=false);
00318 
00319     void InitializeWeightInControlPoints(FbxGeometryBase* pGeometry);
00320     void InitializeWeightInNormals(FbxLayerContainer* pLayerContainer);
00321     void TriangulateContinuousSurface(FbxMesh* pMesh, FbxSurfaceEvaluator* pSurface, FbxUInt pPointCountX, FbxUInt pPointCountY, bool ClockWise=false);
00322     void CheckForZeroWeightInShape(FbxGeometry *pGeometry);
00323     FbxMesh* CreateMeshFromParametricSurface(const FbxGeometry* pGeometry);
00324     FbxNurbs* CreateNurbsFromPatch(FbxPatch* pPatch);
00325     FbxNurbsSurface* CreateNurbsSurfaceFromPatch(FbxPatch* pPatch);
00326 
00327     void ConvertShapes(const FbxGeometry* pSource, FbxGeometry* pDestination, FbxSurfaceEvaluator* pEvaluator, int pUCount, int pVCount);
00328     void ConvertShapes(const FbxGeometry* pSource, FbxGeometry* pDestination, FbxWeightedMapping* pSourceToDestinationMapping);
00329     void ConvertClusters(const FbxGeometry* pSource, FbxGeometry* pDestination, FbxWeightedMapping* pSourceToDestinationMapping);
00330     void ConvertClusters(FbxArray<FbxCluster*> const& pSourceClusters, int pSourceControlPointsCount, FbxArray<FbxCluster*>& pDestinationClusters, int pDestinationControlPointsCount, FbxWeightedMapping* pSourceToDestinationMapping);
00331     void BuildClusterToSourceMapping(FbxArray<FbxCluster*> const& pSourceClusters, FbxWeightedMapping* pClusterToSourceMapping);
00332     void CheckClusterToSourceMapping(FbxWeightedMapping* pClusterToSourceMapping);
00333     void ConvertCluster(int pSourceClusterIndex, FbxWeightedMapping* pClusterToSourceMapping, FbxWeightedMapping* pSourceToDestinationMapping, FbxCluster* pDestinationCluster);
00334     void DuplicateControlPoints(FbxArray<FbxVector4>& pControlPoints, FbxArray<int>& pPolygonVertices);
00335     void UpdatePolygon(FbxMesh *pNewMesh, FbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated);
00336     void UpdatePolygon(FbxMesh *pNewMesh, FbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated, int pTriangleNum);
00337     void ResizePolygon(FbxMesh *pNewMesh, int pNewCountVertices = 0, int pNewCountPolygons =0, bool pClearFlag = true);
00338 
00339     template <class T1, class T2> void ConvertNurbs(T1* pNewNurbs, T2* pOldNurb);
00340 
00341     bool CopyAnimationCurves(FbxNode* pNode, FbxGeometry* pNewGeometry);
00342     bool FlipNurbsCurve(FbxNurbsCurve* pCurve) const;
00343     void FlipControlPoints(FbxGeometryBase* pPoints, int pUCount, int pVCount) const;
00344     bool ConvertMaterialReferenceMode(FbxMesh* pMeshRef) const;
00345     void RevertMaterialReferenceModeConversion(FbxMesh* pMeshRef) const;
00346 
00347     FbxManager* mManager;
00348 
00349         friend class FbxWriter3ds;
00350 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00351 };
00352 
00353 #include <fbxsdk/fbxsdk_nsend.h>
00354 
00355 #endif /* _FBXSDK_UTILS_GEOMETRY_CONVERTER_H_ */