FBX SDK Reference Guide: kfbxsurfaceevaluator.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_SURFACE_EVALUATOR_H_
00005 #define _FBXSDK_SURFACE_EVALUATOR_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2001 - 2008 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 
00042 #include <kaydaradef.h>
00043 #ifndef KFBX_DLL 
00044     #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <fbxfilesdk_nsbegin.h>
00048 
00049 class KFbxWeightedMapping;
00050 
00051 //#define KSURFACE_EVALUATOR_NORMALIZE
00052 #define KSURFACE_EVALUATOR_4D
00053 
00054 #ifdef KSURFACE_EVALUATOR_4D
00055 #define N_Dimension     4
00056 #else
00057 #define N_Dimension     3
00058 #endif
00059 
00060 enum
00061  {
00062     KSURFACE_NORMAL, 
00063     KSURFACE_CLOSE 
00064 };
00065 
00066 
00067 /***************************************************************************
00068   Class KFBXSurfaceEvaluator
00069  ***************************************************************************/
00070 
00071 class KFBXSurfaceEvaluator  
00072 {
00073 public :
00074 
00076     KFBXSurfaceEvaluator ();
00077 
00079     virtual ~KFBXSurfaceEvaluator ();
00080 
00082     virtual void EvaluateSurface (KFbxWeightedMapping* lWeightedMapping = NULL);
00083     
00084     // Evaluation settings function
00085     
00087     virtual void SetEvaluationModeU (int pModeU);
00088     
00090     virtual void SetEvaluationModeV (int pModeV);
00091     
00093     virtual void SetEvaluationStepU (kUInt pStepU);
00094     
00096     virtual void SetEvaluationStepV (kUInt pStepV);
00097     
00098     // Output Data
00099     
00101     virtual bool GetBottomCapU (void);
00102     
00104     virtual bool GetTopCapU (void);
00105     
00107     virtual bool GetBottomCapV (void);
00108     
00110     virtual bool GetTopCapV (void);
00111     
00113     virtual void SetDestinationArray (double* pArray);
00114     
00116     virtual kUInt GetCurvePointCountX (void);
00117     
00119     virtual kUInt GetCurvePointCountY (void);
00120     
00122     virtual void SetDestinationNormalArray (double* pArray);
00123     
00124     // Input Data
00125 
00127     virtual void SetSurfaceTensionU (double pTensionU);
00128 
00130     virtual void SetSurfaceTensionV (double pTensionV);
00131 
00133     virtual void SetSourceArray (double* pArray, kUInt NPointX, kUInt NPointY);
00134 
00136     virtual void SetAuxSourceArray (int pIdentification, double* pArray);
00137 
00139     void Destroy (int IsLocal = false);
00140 
00142     inline int GetEvaluationModeU () {return mEvaluation_Mode_U;}
00143 
00145     inline int GetEvaluationModeV () {return mEvaluation_Mode_V;}
00146 
00148     void Set_U_Blending_Parameters (const double pMatrice4x4[16]);
00149     
00151     void Set_V_Blending_Parameters (const double pMatrice4x4[16]);
00152 
00154     void SetOrderU (kUInt pOrderU);
00155     
00157     void SetOrderV (kUInt pOrderV);
00158     
00160     void SetAfterStepU (kUInt uf);
00161     
00163     void SetAfterStepV (kUInt vf);
00164 
00165 
00166 protected :
00167     
00168     inline kUInt ClipX (kUInt PosiX) 
00169     {   
00170         if (PosiX >= mSource_Point_Count_X)
00171             return PosiX -= mSource_Point_Count_X;
00172         return PosiX;
00173     }
00174 
00175     inline kUInt ClipY (kUInt PosiY) 
00176     {   
00177         if (PosiY >= mSource_Point_Count_Y)
00178             return PosiY -= mSource_Point_Count_Y;
00179         return PosiY;
00180     }
00181 
00182     inline double GetData (kUInt PosiX, kUInt PosiY, kUInt Dimension)
00183     {
00184         return mSource_Array [(PosiX + PosiY * mSource_Point_Count_X)* N_Dimension  + Dimension];
00185     }
00186        
00187     // Evaluation settings
00188 
00189     int mEvaluation_Mode_U;
00190     int mEvaluation_Mode_V;
00191 
00192     kUInt mOrder_U;
00193     kUInt mOrder_V;
00194 
00195     kUInt mN_Step_U;
00196     kUInt mN_Step_V;
00197 
00198     kUInt mAfter_Step_U;
00199     kUInt mAfter_Step_V;
00200 
00201     // Output Data
00202 
00203     kUInt mDestination_Point_Count_X;
00204     kUInt mDestination_Point_Count_Y;
00205 
00206     double* mDestination_Array;
00207     double* mNormal_Array;
00208 
00209     // Input Data
00210 
00211     double mTension_U;
00212     double mTension_V;
00213 
00214     kUInt mSource_Point_Count_X;
00215     kUInt mSource_Point_Count_Y;
00216     double* mSource_Array;
00217 
00218     // Internal Data
00219 
00220     double* mTangent_U;
00221     double* mTangent_V;
00222 
00223     kUInt mNeed_ReCompute_Table;
00224 
00225     kUInt mNeed_Check_Cap;
00226 
00227     bool mCap_Bottom_U;
00228     bool mCap_Top_U;
00229     bool mCap_Bottom_V;
00230     bool mCap_Top_V;
00231 
00232 
00233     double  ABi1, BBi1, CBi1, DBi1,
00234             ABi2, BBi2, CBi2, DBi2,
00235             ABi3, BBi3, CBi3, DBi3,
00236             ABi4, BBi4, CBi4, DBi4;
00237 
00238     double  ABj1, BBj1, CBj1, DBj1,
00239             ABj2, BBj2, CBj2, DBj2,
00240             ABj3, BBj3, CBj3, DBj3,
00241             ABj4, BBj4, CBj4, DBj4;
00242 
00243     double  BdBi1, CdBi1, DdBi1,
00244             BdBi2, CdBi2, DdBi2,
00245             BdBi3, CdBi3, DdBi3,
00246             BdBi4, CdBi4, DdBi4;
00247 
00248     double  BdBj1, CdBj1, DdBj1,
00249             BdBj2, CdBj2, DdBj2,
00250             BdBj3, CdBj3, DdBj3,
00251             BdBj4, CdBj4, DdBj4;
00252 
00253     kUInt mBi_Table_Count;
00254     kUInt mBj_Table_Count;
00255     kUInt mBij_Table_Count;
00256 
00257     double* mBi_Table;
00258     double* mBj_Table;
00259 
00260     double* mBdi_Table;
00261     double* mBdj_Table;
00262 
00263 
00264     double* mBij_Table;
00265     double* mBdij_Table;
00266     double* mBidj_Table;
00267 
00268     // Internal routine
00269 
00270     virtual void SetBiTable (void);
00271     virtual void SetBjTable (void);
00272     virtual void SetBijTable (void);
00273     virtual void SetBdijTable (void);
00274     virtual void SetBidjTable (void);
00275     virtual void SetOtherTable (void) {};
00276 
00277     virtual void EvaluateSurfaceExactNormal();
00278     virtual void ComputeBlendingFactor(KFbxWeightedMapping* lWeightedMapping);
00279     virtual void ComputeBlendingCV( double *pCVArray, 
00280                                     double **pCVs, 
00281                                     kUInt pVertexSize, 
00282                                     double *pBij, 
00283                                     double *pWeight /* may be set to NULL */, 
00284                                     double *pSourceBlendFactor, 
00285                                     kUInt *pSourceIndex  );
00286     virtual void AddBlendingCV( KFbxWeightedMapping* lWeightedMapping, 
00287                                 double* pSourceBlendFactor, 
00288                                 kUInt* pSourceIndex, 
00289                                 kUInt pDestinationIndex );
00290 
00291     void Correct_Cap_Normal ();
00292     void Set_Cap_Flag ();
00293 };
00294 
00296 KFBX_DLL KFBXSurfaceEvaluator* KFBXSurfaceEvaluatorCreate ();
00297 
00298 #include <fbxfilesdk_nsend.h>
00299 
00300 #endif
00301 
00302