00001
00002
00003
00004
00005
00006
00007
00008
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 FbxScene;
00024 class FbxNode;
00025 class FbxNodeAttribute;
00026 class FbxGeometryBase;
00027 class FbxMesh;
00028 class FbxPatch;
00029 class FbxNurbs;
00030 class FbxNurbsCurve;
00031 class FbxNurbsSurface;
00032 class FbxGeometry;
00033 class FbxCluster;
00034 class FbxWeightedMapping;
00035 class FbxLayerContainer;
00036 class FbxSurfaceEvaluator;
00037 class FbxVector4;
00038
00045 class FBXSDK_DLL FbxGeometryConverter
00046 {
00047 public:
00051 FbxGeometryConverter(FbxManager* pManager);
00052
00055 ~FbxGeometryConverter();
00056
00066 FbxMesh* TriangulateMesh(FbxMesh const* pMesh);
00067
00074 FbxMesh* TriangulatePatch(FbxPatch const* pPatch);
00075
00082 FbxMesh* TriangulateNurbs(FbxNurbs const* pNurbs);
00083
00090 bool TriangulateInPlace(FbxNode* pNode);
00091
00103 bool AddAlternateGeometry(FbxNode* pNode, FbxGeometry* pSrcGeom, FbxGeometry* pAltGeom, FbxWeightedMapping* pSrcToAltWeightedMapping, bool pConvertDeformations);
00104
00114 bool ConvertGeometryAnimation(FbxNode* pNode, FbxGeometry* pSrcGeom, FbxGeometry* pDstGeom);
00115
00124 bool ComputeGeometryControlPointsWeightedMapping(FbxGeometry* pSrcGeom, FbxGeometry* pDstGeom, FbxWeightedMapping* pSrcToDstWeightedMapping, bool pSwapUV=false);
00126
00136 FbxNurbs* ConvertPatchToNurbs(FbxPatch *pPatch);
00137
00144 bool ConvertPatchToNurbsInPlace(FbxNode* pNode);
00145
00151 FbxNurbsSurface* ConvertPatchToNurbsSurface(FbxPatch *pPatch);
00152
00159 bool ConvertPatchToNurbsSurfaceInPlace(FbxNode* pNode);
00160
00165 FbxNurbsSurface* ConvertNurbsToNurbsSurface( FbxNurbs* pNurbs );
00166
00171 FbxNurbs* ConvertNurbsSurfaceToNurbs( FbxNurbsSurface* pNurbs );
00172
00178 bool ConvertNurbsToNurbsSurfaceInPlace(FbxNode* pNode);
00179
00185 bool ConvertNurbsSurfaceToNurbsInPlace(FbxNode* pNode);
00187
00198 FbxNurbs* FlipNurbs(FbxNurbs* pNurbs, bool pSwapUV, bool pSwapClusters);
00199
00206 FbxNurbsSurface* FlipNurbsSurface(FbxNurbsSurface* pNurbs, bool pSwapUV, bool pSwapClusters);
00208
00226 bool EmulateNormalsByPolygonVertex(FbxMesh* pMesh);
00227
00237 bool ComputeEdgeSmoothingFromNormals( FbxMesh* pMesh ) const;
00238
00248 bool ComputePolygonSmoothingFromEdgeSmoothing( FbxMesh* pMesh, int pIndex=0 ) const;
00249
00257 bool ComputeEdgeSmoothingFromPolygonSmoothing( FbxMesh* pMesh, int pIndex=0 ) const;
00259
00261
00262
00263
00264
00265
00266
00268 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00269 public:
00276 void ReplaceNodeAttribute(FbxNode* pNode, FbxNodeAttribute* pNewNodeAttr);
00277
00286 bool AddTriangulatedMeshGeometry(FbxNode* pNode, int pUVStepCoeff);
00287
00301 bool SplitMeshPerMaterial(FbxMesh* pMesh);
00302
00307 bool SplitMeshesPerMaterial(FbxScene* pScene);
00308
00314 bool CreateAndCopyLayerElement(FbxMesh *pNewMesh, FbxMesh *pRefMesh);
00315
00321 bool SetLayerElements(FbxMesh *pNewMesh, FbxMesh *pMesh, int pPolygonIndex, int pPolyPointIndex, int pLoopIndex, bool pIsSearched, bool pIsEndPolygon);
00322
00329 FbxMesh* TriangulateMeshAdvance(FbxMesh const* pMesh, bool& pStatus);
00330
00352 FbxNode* MergeMeshes(FbxArray<FbxNode*>& pMeshNodes, const char* pNodeName, FbxScene* pScene);
00353
00372 static void FbxTriangulation(int *Index, int pNumSide);
00373 protected:
00374 bool ComputePatchToMeshControlPointsWeightedMapping(FbxPatch* pSrcPatch, FbxMesh* pDstMesh, FbxWeightedMapping* pMapping, bool pSwapUV=false);
00375 bool ComputeNurbsToMeshControlPointsWeightedMapping(FbxNurbsSurface* pSrcNurbs, FbxMesh* pDstMesh, FbxWeightedMapping* pMapping, bool pRescaleUVs=false, bool pSwapUV=false);
00376
00377 void InitializeWeightInControlPoints(FbxGeometryBase* pGeometry);
00378 void InitializeWeightInNormals(FbxLayerContainer* pLayerContainer);
00379 void TriangulateContinuousSurface(FbxMesh* pMesh, FbxSurfaceEvaluator* pSurface, FbxUInt pPointCountX, FbxUInt pPointCountY, bool ClockWise=false);
00380 void CheckForZeroWeightInShape(FbxGeometry *pGeometry);
00381 FbxMesh* CreateMeshFromParametricSurface(FbxGeometry const* pGeometry);
00382 FbxNurbs* CreateNurbsFromPatch(FbxPatch* pPatch);
00383 FbxNurbsSurface* CreateNurbsSurfaceFromPatch(FbxPatch* pPatch);
00384
00385 void ConvertShapes(FbxGeometry const* pSource, FbxGeometry* pDestination, FbxSurfaceEvaluator* pEvaluator, int pUCount, int pVCount);
00386 void ConvertShapes(FbxGeometry const* pSource, FbxGeometry* pDestination, FbxWeightedMapping* pSourceToDestinationMapping);
00387 void ConvertClusters(FbxGeometry const* pSource, FbxGeometry* pDestination, FbxWeightedMapping* pSourceToDestinationMapping);
00388 void ConvertClusters(FbxArray<FbxCluster*> const& pSourceClusters, int pSourceControlPointsCount, FbxArray<FbxCluster*>& pDestinationClusters, int pDestinationControlPointsCount, FbxWeightedMapping* pSourceToDestinationMapping);
00389 void BuildClusterToSourceMapping(FbxArray<FbxCluster*> const& pSourceClusters, FbxWeightedMapping* pClusterToSourceMapping);
00390 void CheckClusterToSourceMapping(FbxWeightedMapping* pClusterToSourceMapping);
00391 void ConvertCluster(int pSourceClusterIndex, FbxWeightedMapping* pClusterToSourceMapping, FbxWeightedMapping* pSourceToDestinationMapping, FbxCluster* pDestinationCluster);
00392 void DuplicateControlPoints(FbxArray<FbxVector4>& pControlPoints, FbxArray<int>& pPolygonVertices);
00393 void UpdatePolygon(FbxMesh *pNewMesh, FbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated);
00394 void UpdatePolygon(FbxMesh *pNewMesh, FbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated, int pTriangleNum);
00395 void ResizePolygon(FbxMesh *pNewMesh, int pNewCountVertices = 0, int pNewCountPolygons =0, bool pClearFlag = true);
00396
00397 template <class T1, class T2> void ConvertNurbs(T1* pNewNurbs, T2* pOldNurb);
00398
00399 bool CopyAnimationCurves(FbxNode* pNode, FbxGeometry* pNewGeometry);
00400 bool FlipNurbsCurve(FbxNurbsCurve* pCurve) const;
00401 void FlipControlPoints(FbxGeometryBase* pPoints, int pUCount, int pVCount) const;
00402 bool ConvertMaterialReferenceMode(FbxMesh* pMeshRef) const;
00403 void RevertMaterialReferenceModeConversion(FbxMesh* pMeshRef) const;
00404
00405 FbxManager* mManager;
00406
00407 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00408 };
00409
00410 #include <fbxsdk/fbxsdk_nsend.h>
00411
00412 #endif