00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRYCONVERTER_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRYCONVERTER_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 #include <fbxfilesdk/fbxfilesdk_def.h>
00042
00043 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00044
00045 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00046
00047 class KFbxSdkManager;
00048 class KFbxScene;
00049 class KFbxNode;
00050 class KFbxNodeAttribute;
00051 class KFbxGeometryBase;
00052 class KFbxMesh;
00053 class KFbxPatch;
00054 class KFbxNurb;
00055 class KFbxNurbsCurve;
00056 class KFbxNurbsSurface;
00057 class KFbxGeometry;
00058 class KFbxCluster;
00059 class KFbxWeightedMapping;
00060 class KFbxLayerContainer;
00061 class KFBXSurfaceEvaluator;
00062 class KFbxVector4;
00063
00070 class KFBX_DLL KFbxGeometryConverter
00071 {
00072 public:
00073 KFbxGeometryConverter(KFbxSdkManager* pManager);
00074 ~KFbxGeometryConverter();
00075
00085 KFbxMesh* TriangulateMesh(KFbxMesh const* pMesh);
00086
00093 KFbxMesh* TriangulatePatch(KFbxPatch const* pPatch);
00094
00101 KFbxMesh* TriangulateNurb(KFbxNurb const* pNurb);
00102
00109 bool TriangulateInPlace(KFbxNode* pNode);
00110
00122 bool AddAlternateGeometry(KFbxNode* pNode, KFbxGeometry* pSrcGeom, KFbxGeometry* pAltGeom, KFbxWeightedMapping* pSrcToAltWeightedMapping, bool pConvertDeformations);
00123
00133 bool ConvertGeometryAnimation(KFbxNode* pNode, KFbxGeometry* pSrcGeom, KFbxGeometry* pDstGeom);
00134
00143 bool ComputeGeometryControlPointsWeightedMapping(KFbxGeometry* pSrcGeom, KFbxGeometry* pDstGeom, KFbxWeightedMapping* pSrcToDstWeightedMapping, bool pSwapUV=false);
00145
00155 KFbxNurb* ConvertPatchToNurb(KFbxPatch *pPatch);
00156
00163 bool ConvertPatchToNurbInPlace(KFbxNode* pNode);
00164
00170 KFbxNurbsSurface* ConvertPatchToNurbsSurface(KFbxPatch *pPatch);
00171
00178 bool ConvertPatchToNurbsSurfaceInPlace(KFbxNode* pNode);
00179
00184 KFbxNurbsSurface* ConvertNurbToNurbsSurface( KFbxNurb* pNurb );
00185
00190 KFbxNurb* ConvertNurbsSurfaceToNurb( KFbxNurbsSurface* pNurb );
00191
00197 bool ConvertNurbToNurbsSurfaceInPlace(KFbxNode* pNode);
00198
00204 bool ConvertNurbsSurfaceToNurbInPlace(KFbxNode* pNode);
00206
00217 KFbxNurb* FlipNurb(KFbxNurb* pNurb, bool pSwapUV, bool pSwapClusters);
00218
00225 KFbxNurbsSurface* FlipNurbsSurface(KFbxNurbsSurface* pNurb, bool pSwapUV, bool pSwapClusters);
00227
00245 bool EmulateNormalsByPolygonVertex(KFbxMesh* pMesh);
00246
00256 bool ComputeEdgeSmoothingFromNormals( KFbxMesh* pMesh ) const;
00257
00267 bool ComputePolygonSmoothingFromEdgeSmoothing( KFbxMesh* pMesh, int pIndex=0 ) const;
00268
00276 bool ComputeEdgeSmoothingFromPolygonSmoothing( KFbxMesh* pMesh, int pIndex=0 ) const;
00278
00280
00281
00282
00283
00284
00285
00287 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00288 public:
00295 void ReplaceNodeAttribute(KFbxNode* pNode, KFbxNodeAttribute* pNewNodeAttr);
00296
00305 bool AddTriangulatedMeshGeometry(KFbxNode* pNode, int pUVStepCoeff);
00306
00320 bool SplitMeshPerMaterial(KFbxMesh* pMesh);
00321
00326 bool SplitMeshesPerMaterial(KFbxScene* pScene);
00327
00333 bool CreateAndCopyLayerElement(KFbxMesh *pNewMesh, KFbxMesh *pRefMesh);
00334
00340 bool SetLayerElements(KFbxMesh *pNewMesh, KFbxMesh *pMesh, int pPolygonIndex, int pPolyPointIndex, int pLoopIndex, bool pIsSearched, bool pIsEndPolygon);
00341
00348 KFbxMesh* TriangulateMeshAdvance(KFbxMesh const* pMesh, bool& pStatus);
00349
00362 K_DEPRECATED int TriangulatePolygon(KFbxMesh *pNewMesh, KFbxVector4 *pControlPoints, int* pVertexIndices, int * pPolyVertexIndices, int pStartVertexIndex, KFbxVector4& pNormal, int pMaterialIndex, int pPolygonSize, int polygonIndex);
00363
00364 protected:
00365 bool ComputePatchToMeshControlPointsWeightedMapping(KFbxPatch* pSrcPatch, KFbxMesh* pDstMesh, KFbxWeightedMapping* pMapping, bool pSwapUV=false);
00366 bool ComputeNurbToMeshControlPointsWeightedMapping(KFbxNurbsSurface* pSrcNurb, KFbxMesh* pDstMesh, KFbxWeightedMapping* pMapping, bool pRescaleUVs=false, bool pSwapUV=false);
00367
00368 void InitializeWeightInControlPoints(KFbxGeometryBase* pGeometry);
00369 void InitializeWeightInNormals(KFbxLayerContainer* pLayerContainer);
00370 void TriangulateContinuousSurface(KFbxMesh* pMesh, KFBXSurfaceEvaluator* pSurface, kUInt pPointCountX, kUInt pPointCountY, bool ClockWise=false);
00371 void CheckForZeroWeightInShape(KFbxGeometry *pGeometry);
00372 KFbxMesh* CreateMeshFromParametricSurface(KFbxGeometry const* pGeometry);
00373 KFbxNurb* CreateNurbFromPatch(KFbxPatch* pPatch);
00374 KFbxNurbsSurface* CreateNurbsSurfaceFromPatch(KFbxPatch* pPatch);
00375
00376 void ConvertShapes(KFbxGeometry const* pSource, KFbxGeometry* pDestination, KFBXSurfaceEvaluator* pEvaluator, int pUCount, int pVCount);
00377 void ConvertShapes(KFbxGeometry const* pSource, KFbxGeometry* pDestination, KFbxWeightedMapping* pSourceToDestinationMapping);
00378 void ConvertClusters(KFbxGeometry const* pSource, KFbxGeometry* pDestination, KFbxWeightedMapping* pSourceToDestinationMapping);
00379 void ConvertClusters(KArrayTemplate<KFbxCluster*> const& pSourceClusters, int pSourceControlPointsCount, KArrayTemplate<KFbxCluster*>& pDestinationClusters, int pDestinationControlPointsCount, KFbxWeightedMapping* pSourceToDestinationMapping);
00380 void BuildClusterToSourceMapping(KArrayTemplate<KFbxCluster*> const& pSourceClusters, KFbxWeightedMapping* pClusterToSourceMapping);
00381 void CheckClusterToSourceMapping(KFbxWeightedMapping* pClusterToSourceMapping);
00382 void ConvertCluster(int pSourceClusterIndex, KFbxWeightedMapping* pClusterToSourceMapping, KFbxWeightedMapping* pSourceToDestinationMapping, KFbxCluster* pDestinationCluster);
00383 void DuplicateControlPoints(KArrayTemplate<KFbxVector4>& pControlPoints, KArrayTemplate<int>& pPolygonVertices);
00384 void UpdatePolygon(KFbxMesh *pNewMesh, KFbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated);
00385 void UpdatePolygon(KFbxMesh *pNewMesh, KFbxMesh const *pRefMesh, int pPolygonIndex, int* pNewIndex, int &pVerticeIndexMeshTriangulated, int &pPolygonIndexMeshTriangulated, int pTriangleNum);
00386 void ResizePolygon(KFbxMesh *pNewMesh, int pNewCountVertices = 0, int pNewCountPolygons =0, bool pClearFlag = true);
00387
00388 template <class T1, class T2> void ConvertNurbs(T1* pNewNurb, T2* pOldNurb);
00389
00390 bool CopyAnimationCurves(KFbxNode* pNode, KFbxGeometry* pNewGeometry);
00391 bool FlipNurbsCurve(KFbxNurbsCurve* pCurve) const;
00392 void FlipControlPoints(KFbxGeometryBase* pPoints, int pUCount, int pVCount) const;
00393 bool ConvertMaterialReferenceMode(KFbxMesh* pMeshRef) const;
00394 void RevertMaterialReferenceModeConversion(KFbxMesh* pMeshRef) const;
00395
00396 KFbxSdkManager* mManager;
00397
00398 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00399 };
00400
00401 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00402
00403 #endif // FBXFILESDK_KFBXPLUGINS_KFBXGEOMETRYCONVERTER_H
00404