Browse Source

Fixed gameplay-encoder to support FBX SDK 2013.1 and 2013.2.
Updated the pre-compiled gameplay-encoder.
Updated the encoder readme. (wininet.lib not required anymore)

Darryl Gough 13 years ago
parent
commit
ef3b5ba77f
2 changed files with 23 additions and 23 deletions
  1. 6 6
      gameplay-encoder/README.md
  2. 17 17
      gameplay-encoder/src/FBXSceneEncoder.cpp

+ 6 - 6
gameplay-encoder/README.md

@@ -31,11 +31,11 @@ XCode project "gameplay-encoder.xcodeproj" on MacOSX.
 - Edit the project properties of "gameplay-encoder" for Debug
 - Edit the project properties of "gameplay-encoder" for Debug
 - Add Preprocessor Definition "USE_FBX" (C++/Preprocessor)
 - Add Preprocessor Definition "USE_FBX" (C++/Preprocessor)
 - Add the FBX SDK include directory to Additional Include Directories (C++/General)
 - Add the FBX SDK include directory to Additional Include Directories (C++/General)
-  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.1/include
+  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.2/include
 - Add the FBX lib directory to the Additional Library Directories (Linker/General)
 - Add the FBX lib directory to the Additional Library Directories (Linker/General)
-  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.1/lib/vs2010/x86
-- Add "fbxsdk-2013.1-mdd.lib"(Release) and "wininet.lib" to the Additional Dependencies (Linker/Input)
-  * Example: fbxsdk-2013.1-mdd.lib;wininet.lib
+  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.2/lib/vs2010/x86
+- Add "fbxsdk-2013.2-mdd.lib"(Release) to the Additional Dependencies (Linker/Input)
+  * Example: fbxsdk-2013.2-mdd.lib
 - Build gameplay-encoder
 - Build gameplay-encoder
 
 
 ### Building with FBX Support on Mac OS X using XCode 4.3.2+
 ### Building with FBX Support on Mac OS X using XCode 4.3.2+
@@ -43,9 +43,9 @@ XCode project "gameplay-encoder.xcodeproj" on MacOSX.
 - Edit the project properties of target "gameplay-encoder".
 - Edit the project properties of target "gameplay-encoder".
 - Add Preprocessor Macro "USE_FBX" to both Debug/Release sections. (Build Settings)
 - Add Preprocessor Macro "USE_FBX" to both Debug/Release sections. (Build Settings)
 - Add the FBX include directory to Header Search Paths: (Build Settings)
 - Add the FBX include directory to Header Search Paths: (Build Settings)
-  * Example: /Applications/Autodesk/FBXSDK20131/include
+  * Example: /Applications/Autodesk/FBXSDK20132/include
 - Add the FBX library and dependency Library/Frameworks: (Build Phases -> Link Binary with Libraries)
 - Add the FBX library and dependency Library/Frameworks: (Build Phases -> Link Binary with Libraries)
-  * Example: /Applications/Autodesk/FBXSDK20131/lib/gcc4/ub/libfbxsdk-2013.1-static.a  (Add Other)
+  * Example: /Applications/Autodesk/FBXSDK20132/lib/gcc4/ub/libfbxsdk-2013.2-static.a  (Add Other)
   * Example: libiconv.dylib, Cocoa.framework, SystemConfiguration.framework
   * Example: libiconv.dylib, Cocoa.framework, SystemConfiguration.framework
 - Build gameplay-encoder
 - Build gameplay-encoder
 
 

+ 17 - 17
gameplay-encoder/src/FBXSceneEncoder.cpp

@@ -165,6 +165,14 @@ bool isGroupAnimationPossible(FbxScene* fbxScene);
 bool isGroupAnimationPossible(FbxNode* fbxNode);
 bool isGroupAnimationPossible(FbxNode* fbxNode);
 bool isGroupAnimationPossible(FbxMesh* fbxMesh);
 bool isGroupAnimationPossible(FbxMesh* fbxMesh);
 
 
+FbxAnimCurve* getCurve(FbxPropertyT<FbxDouble3>& prop, FbxAnimLayer* animLayer, const char* pChannel)
+{
+#if FBXSDK_VERSION_MAJOR == 2013 && FBXSDK_VERSION_MINOR == 1
+    return prop.GetCurve<FbxAnimCurve>(animLayer, pChannel);
+#else
+    return prop.GetCurve(animLayer, pChannel);
+#endif
+}
 
 
 ////////////////////////////////////
 ////////////////////////////////////
 // Member Functions
 // Member Functions
@@ -311,55 +319,55 @@ void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fb
     float startTime = FLT_MAX, stopTime = -1.0f, frameRate = -FLT_MAX;
     float startTime = FLT_MAX, stopTime = -1.0f, frameRate = -FLT_MAX;
     bool tx = false, ty = false, tz = false, rx = false, ry = false, rz = false, sx = false, sy = false, sz = false;
     bool tx = false, ty = false, tz = false, rx = false, ry = false, rz = false, sx = false, sy = false, sz = false;
     FbxAnimCurve* animCurve = NULL;
     FbxAnimCurve* animCurve = NULL;
-    animCurve = fbxNode->LclTranslation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_X);
+    animCurve = getCurve(fbxNode->LclTranslation, animLayer, FBXSDK_CURVENODE_COMPONENT_X);
     if (animCurve)
     if (animCurve)
     {
     {
         tx = true;
         tx = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclTranslation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
+    animCurve = getCurve(fbxNode->LclTranslation, animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
     if (animCurve)
     if (animCurve)
     {
     {
         ty = true;
         ty = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclTranslation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
+    animCurve = getCurve(fbxNode->LclTranslation, animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
     if (animCurve)
     if (animCurve)
     {
     {
         tz = true;
         tz = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclRotation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_X);
+    animCurve = getCurve(fbxNode->LclRotation, animLayer, FBXSDK_CURVENODE_COMPONENT_X);
     if (animCurve)
     if (animCurve)
     {
     {
         rx = true;
         rx = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclRotation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
+    animCurve = getCurve(fbxNode->LclRotation, animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
     if (animCurve)
     if (animCurve)
     {
     {
         ry = true;
         ry = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclRotation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
+    animCurve = getCurve(fbxNode->LclRotation, animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
     if (animCurve)
     if (animCurve)
     {
     {
         rz = true;
         rz = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclScaling.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_X);
+    animCurve = getCurve(fbxNode->LclScaling, animLayer, FBXSDK_CURVENODE_COMPONENT_X);
     if (animCurve)
     if (animCurve)
     {
     {
         sx = true;
         sx = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclScaling.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
+    animCurve = getCurve(fbxNode->LclScaling, animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
     if (animCurve)
     if (animCurve)
     {
     {
         sy = true;
         sy = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
     }
-    animCurve = fbxNode->LclScaling.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
+    animCurve = getCurve(fbxNode->LclScaling, animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
     if (animCurve)
     if (animCurve)
     {
     {
         sz = true;
         sz = true;
@@ -583,14 +591,6 @@ void FBXSceneEncoder::transformNode(FbxNode* fbxNode, Node* node)
 
 
     float m[16];
     float m[16];
     copyMatrix(matrix, m);
     copyMatrix(matrix, m);
-    int i = 0;
-    for (int row = 0; row < 4; ++row)
-    {
-        for (int col = 0; col < 4; ++col)
-        {
-            m[i++] = (float)matrix.Get(row, col);
-        }
-    }
     node->setTransformMatrix(m);
     node->setTransformMatrix(m);
 }
 }