00001
00004 #ifndef _FBXSDK_GEOMETRY_CONVERTER_H_
00005 #define _FBXSDK_GEOMETRY_CONVERTER_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 <kaydaradef.h>
00043 #ifndef KFBX_DLL
00044 #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046
00047 #include <kaydara.h>
00048
00049 #include <klib/karrayul.h>
00050
00051 #ifndef MB_FBXSDK
00052 #include <kbaselib_nsuse.h>
00053 #endif
00054 #include <kfbxplugins/kfbxobject.h>
00055
00056
00057 #include <fbxfilesdk_nsbegin.h>
00058
00059 class KFbxNode;
00060 class KFbxLayerContainer;
00061 class KFbxGeometryBase;
00062 class KFbxGeometry;
00063 class KFbxMesh;
00064 class KFbxPatch;
00065 class KFbxNurb;
00066 class KFbxCluster;
00067 class KFbxSdkManager;
00068 class KFBXSurfaceEvaluator;
00069 class KFbxWeightedMapping;
00070 class KFbxVector4;
00071 class KFbxNurbsSurface;
00072 class KFbxNurbsCurve;
00073
00078 class KFBX_DLL KFbxGeometryConverter : public KFbxObject
00079 {
00080 KFBXOBJECT_DECLARE(KFbxGeometryConverter);
00081 public:
00086
00092 KFbxMesh* TriangulateMesh(KFbxMesh* pMesh);
00093
00099 KFbxMesh* TriangulatePatch(KFbxPatch* pPatch);
00100
00106 KFbxMesh* TriangulateNurb(KFbxNurb* pNurb);
00107
00114 bool TriangulateInPlace(KFbxNode* pNode);
00115
00125 bool AddAlternateGeometry(
00126 KFbxNode* pNode,
00127 KFbxGeometry* pSrcGeom,
00128 KFbxGeometry* pAltGeom,
00129 KFbxWeightedMapping* pSrcToAltWeightedMapping,
00130 bool pConvertDeformations
00131 );
00132
00140 bool ConvertGeometryAnimation(
00141 KFbxNode* pNode,
00142 KFbxGeometry* pSrcGeom,
00143 KFbxGeometry* pDstGeom
00144 );
00145
00153 bool ComputeGeometryControlPointsWeightedMapping(
00154 KFbxGeometry* pSrcGeom,
00155 KFbxGeometry* pDstGeom,
00156 KFbxWeightedMapping* pSrcToDstWeightedMapping,
00157 bool pSwapUV = false
00158 );
00159
00161
00166
00172 KFbxNurb* ConvertPatchToNurb(KFbxPatch *pPatch);
00173
00179 bool ConvertPatchToNurbInPlace(KFbxNode* pNode);
00180
00186 KFbxNurbsSurface* ConvertPatchToNurbsSurface(KFbxPatch *pPatch);
00187
00193 bool ConvertPatchToNurbsSurfaceInPlace(KFbxNode* pNode);
00194
00199 KFbxNurbsSurface* ConvertNurbToNurbsSurface( KFbxNurb* pNurb );
00200
00205 KFbxNurb* ConvertNurbsSurfaceToNurb( KFbxNurbsSurface* pNurb );
00206
00211 bool ConvertNurbToNurbsSurfaceInPlace(KFbxNode* pNode);
00212
00217 bool ConvertNurbsSurfaceToNurbInPlace(KFbxNode* pNode);
00218
00220
00225
00232 KFbxNurb* FlipNurb(KFbxNurb* pNurb, bool pSwapUV, bool pSwapClusters);
00233
00240 KFbxNurbsSurface* FlipNurbsSurface(KFbxNurbsSurface* pNurb, bool pSwapUV, bool pSwapClusters);
00241
00243
00248
00262 bool EmulateNormalsByPolygonVertex(KFbxMesh* pMesh);
00263
00273 bool ComputeEdgeSmoothingFromNormals( KFbxMesh* pMesh ) const;
00274
00276
00277
00279
00280
00281
00282
00283
00284
00286
00287 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00288
00289 public:
00290
00298 bool AddTriangulatedMeshGeometry(KFbxNode* pNode, int pUVStepCoeff);
00299
00300 protected:
00301
00302 KFbxGeometryConverter(KFbxSdkManager& pManager,char const *pName);
00303 ~KFbxGeometryConverter();
00304
00305 bool ComputePatchToMeshControlPointsWeightedMapping
00306 (
00307 KFbxPatch* pSrcPatch,
00308 KFbxMesh* pDstMesh,
00309 KFbxWeightedMapping* pMapping,
00310 bool pSwapUV = false
00311 );
00312 bool ComputeNurbToMeshControlPointsWeightedMapping
00313 (
00314 KFbxNurbsSurface* pSrcNurb,
00315 KFbxMesh* pDstMesh,
00316 KFbxWeightedMapping* pMapping,
00317 bool pRescaleUVs = false,
00318 bool pSwapUV = false
00319 );
00320
00321 void InitializeWeightInControlPoints(KFbxGeometryBase* pGeometry);
00322 void InitializeWeightInNormals(KFbxLayerContainer* pLayerContainer);
00323 void TriangulateContinuousSurface
00324 (
00325 KFbxMesh* pMesh,
00326 KFBXSurfaceEvaluator* pSurface,
00327 kUInt pPointCountX,
00328 kUInt pPointCountY,
00329 bool ClockWise = false
00330 );
00331 void CheckForZeroWeightInShape(KFbxGeometry *pGeometry);
00332 KFbxMesh* CreateMeshFromParametricSurface(KFbxGeometry* pGeometry);
00333 KFbxNurb* CreateNurbFromPatch(KFbxPatch* pPatch);
00334 KFbxNurbsSurface* CreateNurbsSurfaceFromPatch(KFbxPatch* pPatch);
00335
00336 void ConvertShapes(KFbxGeometry* pSource,
00337 KFbxGeometry* pDestination,
00338 KFBXSurfaceEvaluator* pEvaluator,
00339 int pUCount,
00340 int pVCount);
00341 void ConvertShapes(KFbxGeometry* pSource,
00342 KFbxGeometry* pDestination,
00343 KFbxWeightedMapping* pSourceToDestinationMapping);
00344 void ConvertClusters(KFbxGeometry* pSource,
00345 KFbxGeometry* pDestination,
00346 KFbxWeightedMapping* pSourceToDestinationMapping);
00347 void ConvertClusters(KArrayTemplate<KFbxCluster*>& pSourceClusters,
00348 int pSourceControlPointsCount,
00349 KArrayTemplate<KFbxCluster*>& pDestinationClusters,
00350 int pDestinationControlPointsCount,
00351 KFbxWeightedMapping* pSourceToDestinationMapping);
00352 void BuildClusterToSourceMapping(KArrayTemplate<KFbxCluster*>& pSourceClusters,
00353 KFbxWeightedMapping* pClusterToSourceMapping);
00354 void CheckClusterToSourceMapping(KFbxWeightedMapping* pClusterToSourceMapping);
00355 void ConvertCluster(int pSourceClusterIndex,
00356 KFbxWeightedMapping* pClusterToSourceMapping,
00357 KFbxWeightedMapping* pSourceToDestinationMapping,
00358 KFbxCluster* pDestinationCluster);
00359 void DuplicateControlPoints(KArrayTemplate<KFbxVector4>& pControlPoints,
00360 KArrayTemplate<int>& pPolygonVertices);
00361 void UpdatePolygon(KFbxMesh *pNewMesh, KFbxMesh *pRefMesh,
00362 int pPolygonIndex, int* pNewIndex);
00363 void ClearPolygon(KFbxMesh *pNewMesh, int pNewCount = 0);
00364
00365 template <class T1, class T2>
00366 void ConvertNurbs( T1* pNewNurb, T2* pOldNurb );
00367
00368 bool CopyAnimationCurves(KFbxNode* pNode, KFbxGeometry* pNewGeometry );
00369
00370 bool FlipNurbsCurve( KFbxNurbsCurve* pCurve ) const;
00371
00372 void FlipControlPoints( KFbxGeometryBase* pPoints, int pUCount, int pVCount ) const;
00373
00374 KFbxSdkManager* mManager;
00375
00376 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00377
00378 };
00379
00380 #include <fbxfilesdk_nsend.h>
00381
00382 #endif // #ifndef _FBXSDK_GEOMETRY_CONVERTER_H_
00383
00384