diff --git a/KREngine/KREngine.xcodeproj/project.pbxproj b/KREngine/KREngine.xcodeproj/project.pbxproj index 6ddf2ea..ece8629 100644 --- a/KREngine/KREngine.xcodeproj/project.pbxproj +++ b/KREngine/KREngine.xcodeproj/project.pbxproj @@ -35,6 +35,8 @@ E43B0AD915DDCA0F00A5CB9F /* KRContextObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E43B0AD515DDCA0D00A5CB9F /* KRContextObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; E460292616681CFF00261BB9 /* KRTextureAnimated.h in Headers */ = {isa = PBXBuildFile; fileRef = E460292516681CFE00261BB9 /* KRTextureAnimated.h */; }; E460292816681D1000261BB9 /* KRTextureAnimated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E460292716681D1000261BB9 /* KRTextureAnimated.cpp */; }; + E460292B16682BF700261BB9 /* libfbxsdk-2013.3-static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E460292916682BD900261BB9 /* libfbxsdk-2013.3-static.a */; }; + E460292C166834AB00261BB9 /* KRTextureAnimated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E460292716681D1000261BB9 /* KRTextureAnimated.cpp */; }; E461A152152E54B500F2044A /* KRLight.h in Headers */ = {isa = PBXBuildFile; fileRef = E461A151152E54B500F2044A /* KRLight.h */; }; E461A153152E54B500F2044A /* KRLight.h in Headers */ = {isa = PBXBuildFile; fileRef = E461A151152E54B500F2044A /* KRLight.h */; settings = {ATTRIBUTES = (Public, ); }; }; E461A156152E54F800F2044A /* KRLight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461A155152E54F700F2044A /* KRLight.cpp */; }; @@ -168,7 +170,6 @@ E4D13365153767FF0070068C /* KRShaderManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E47C25A113F4F65A00FF4370 /* KRShaderManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4D133661537685A0070068C /* KRShader.h in Headers */ = {isa = PBXBuildFile; fileRef = E47C25A413F4F66F00FF4370 /* KRShader.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4D13367153768610070068C /* KRShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47C25A813F4F6DD00FF4370 /* KRShader.cpp */; settings = {ATTRIBUTES = (Public, ); }; }; - E4F711A51512BB56007EE923 /* libfbxsdk-2012.2-static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4F711A41512BB56007EE923 /* libfbxsdk-2012.2-static.a */; }; E4F975321536220900FD60B2 /* KRNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F975311536220900FD60B2 /* KRNode.h */; }; E4F975331536220900FD60B2 /* KRNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F975311536220900FD60B2 /* KRNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; E4F975361536221C00FD60B2 /* KRNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F975351536221C00FD60B2 /* KRNode.cpp */; }; @@ -241,6 +242,7 @@ E45AC0491643452000DC3C3B /* dust_particle.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = dust_particle.vsh; path = Shaders/dust_particle.vsh; sourceTree = ""; }; E460292516681CFE00261BB9 /* KRTextureAnimated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRTextureAnimated.h; path = Classes/KRTextureAnimated.h; sourceTree = ""; }; E460292716681D1000261BB9 /* KRTextureAnimated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRTextureAnimated.cpp; path = Classes/KRTextureAnimated.cpp; sourceTree = ""; }; + E460292916682BD900261BB9 /* libfbxsdk-2013.3-static.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libfbxsdk-2013.3-static.a"; path = "../../../../../../../../../Applications/Autodesk/FBX SDK/2013.3/lib/gcc4/ub/libfbxsdk-2013.3-static.a"; sourceTree = ""; }; E461A151152E54B500F2044A /* KRLight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRLight.h; path = Classes/KRLight.h; sourceTree = ""; }; E461A155152E54F700F2044A /* KRLight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = KRLight.cpp; path = Classes/KRLight.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; E461A157152E555400F2044A /* KRPointLight.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = KRPointLight.h; path = Classes/KRPointLight.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -341,7 +343,6 @@ E4CE184E15FF125700F80870 /* light_point_inside.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = light_point_inside.vsh; path = Shaders/light_point_inside.vsh; sourceTree = ""; }; E4D133B91538F7480070068C /* light_directional.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = light_directional.fsh; path = Shaders/light_directional.fsh; sourceTree = ""; }; E4D133BB1538F7560070068C /* light_directional.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; lineEnding = 0; name = light_directional.vsh; path = Shaders/light_directional.vsh; sourceTree = ""; }; - E4F711A41512BB56007EE923 /* libfbxsdk-2012.2-static.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libfbxsdk-2012.2-static.a"; path = "../../../../../../../../Applications/Autodesk/FBXSDK20122/lib/gcc4/ub/libfbxsdk-2012.2-static.a"; sourceTree = ""; }; E4F975311536220900FD60B2 /* KRNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = KRNode.h; path = Classes/KRNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; E4F975351536221C00FD60B2 /* KRNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = KRNode.cpp; path = Classes/KRNode.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; /* End PBXFileReference section */ @@ -367,9 +368,9 @@ E46DBE7F1512AF0200D59F86 /* OpenGL.framework in Frameworks */, E4BBBB9E1512A4AE00F43B5B /* AppKit.framework in Frameworks */, E4BBBB9F1512A4B100F43B5B /* Cocoa.framework in Frameworks */, - E4F711A51512BB56007EE923 /* libfbxsdk-2012.2-static.a in Frameworks */, E497B95D151BF05F00D3DC67 /* CoreServices.framework in Frameworks */, E497B95F151BF09600D3DC67 /* SystemConfiguration.framework in Frameworks */, + E460292B16682BF700261BB9 /* libfbxsdk-2013.3-static.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -684,8 +685,8 @@ E4BBBB931512A41500F43B5B /* OSX Frameworks */ = { isa = PBXGroup; children = ( + E460292916682BD900261BB9 /* libfbxsdk-2013.3-static.a */, E4CA10F71638BCBB005D9400 /* Accelerate.framework */, - E4F711A41512BB56007EE923 /* libfbxsdk-2012.2-static.a */, E497B95E151BF09600D3DC67 /* SystemConfiguration.framework */, E497B95C151BF05F00D3DC67 /* CoreServices.framework */, E46DBE7D1512AD4900D59F86 /* OpenGL.framework */, @@ -948,6 +949,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + E460292C166834AB00261BB9 /* KRTextureAnimated.cpp in Sources */, E461A17A152E5C9100F2044A /* KRMat4.cpp in Sources */, E461A175152E5C4800F2044A /* KRLight.cpp in Sources */, E4BBBBA71512A6DC00F43B5B /* KRVector3.cpp in Sources */, @@ -1052,6 +1054,10 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "KREngine/KREngine-Prefix.pch"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_APPS_DIR)/Autodesk/FBX SDK/2013.3/lib/gcc4/ub\"", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SHARED_PRECOMPS_DIR = "$(CACHE_ROOT)/SharedPrecompiledHeaders"; @@ -1071,6 +1077,10 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "KREngine/KREngine-Prefix.pch"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_APPS_DIR)/Autodesk/FBX SDK/2013.3/lib/gcc4/ub\"", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SHARED_PRECOMPS_DIR = "$(CACHE_ROOT)/SharedPrecompiledHeaders"; @@ -1105,12 +1115,14 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; - HEADER_SEARCH_PATHS = /Applications/Autodesk/FBXSDK20122/include; + HEADER_SEARCH_PATHS = ( + "\"/Applications/Autodesk/FBX SDK/2013.3/include\"", + ); INFOPLIST_FILE = "krengine_osx/krengine_osx-Info.plist"; LD_DYLIB_INSTALL_NAME = "@rpath/${EXECUTABLE_PATH}"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "\"$(SYSTEM_APPS_DIR)/Autodesk/FBXSDK20122/lib/gcc4/ub\"", + "\"$(SYSTEM_APPS_DIR)/Autodesk/FBX SDK/2013.3/lib/gcc4/ub\"", ); MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; @@ -1144,12 +1156,14 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; - HEADER_SEARCH_PATHS = /Applications/Autodesk/FBXSDK20122/include; + HEADER_SEARCH_PATHS = ( + "\"/Applications/Autodesk/FBX SDK/2013.3/include\"", + ); INFOPLIST_FILE = "krengine_osx/krengine_osx-Info.plist"; LD_DYLIB_INSTALL_NAME = "@rpath/${EXECUTABLE_PATH}"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "\"$(SYSTEM_APPS_DIR)/Autodesk/FBXSDK20122/lib/gcc4/ub\"", + "\"$(SYSTEM_APPS_DIR)/Autodesk/FBX SDK/2013.3/lib/gcc4/ub\"", ); MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/KREngine/KREngine/Classes/KRResource+fbx.cpp b/KREngine/KREngine/Classes/KRResource+fbx.cpp index 45f3af2..888d98a 100644 --- a/KREngine/KREngine/Classes/KRResource+fbx.cpp +++ b/KREngine/KREngine/Classes/KRResource+fbx.cpp @@ -40,9 +40,9 @@ void InitializeSdkObjects(KFbxSdkManager*& pSdkManager, KFbxScene*& pScene); void DestroySdkObjects(KFbxSdkManager* pSdkManager); bool LoadScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pFilename); -void LoadNode(KRNode *parent_node, std::vector &resources, KFbxGeometryConverter *pGeometryConverter, KFbxNode* pNode); +void LoadNode(KRNode *parent_node, std::vector &resources, FbxGeometryConverter *pGeometryConverter, KFbxNode* pNode); void BakeNode(KFbxNode* pNode); -KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbxGeometryConverter *pGeometryConverter, KFbxNode* pNode); +KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, FbxGeometryConverter *pGeometryConverter, KFbxNode* pNode); KRNode *LoadLight(KRNode *parent_node, std::vector &resources, KFbxNode* pNode); const float KRAKEN_FBX_ANIMATION_FRAMERATE = 30.0f; // FINDME - This should be configurable @@ -59,13 +59,13 @@ std::vector KRResource::LoadFbx(KRContext &context, const std::str KFbxSdkManager* lSdkManager = NULL; KFbxScene* pFbxScene = NULL; bool lResult; - KFbxGeometryConverter *pGeometryConverter = NULL; + FbxGeometryConverter *pGeometryConverter = NULL; // Prepare the FBX SDK. InitializeSdkObjects(lSdkManager, pFbxScene); // Initialize Geometry Converter - pGeometryConverter = new KFbxGeometryConverter(lSdkManager); + pGeometryConverter = new FbxGeometryConverter(lSdkManager); // Load the scene. lResult = LoadScene(lSdkManager, pFbxScene, path.c_str()); @@ -108,7 +108,7 @@ void InitializeSdkObjects(KFbxSdkManager*& pSdkManager, KFbxScene*& pScene) pSdkManager->SetIOSettings(ios); // Load plugins from the executable directory - KString lPath = KFbxGetApplicationDirectory(); + KString lPath = FbxGetApplicationDirectory(); #if defined(KARCH_ENV_WIN) KString lExtension = "dll"; #elif defined(KARCH_ENV_MACOSX) @@ -156,8 +156,8 @@ bool LoadScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pF printf("Call to KFbxImporter::Initialize() failed.\n"); printf("Error returned: %s\n\n", lImporter->GetLastErrorString()); - if (lImporter->GetLastErrorID() == KFbxIO::eFILE_VERSION_NOT_SUPPORTED_YET || - lImporter->GetLastErrorID() == KFbxIO::eFILE_VERSION_NOT_SUPPORTED_ANYMORE) + if (lImporter->GetLastErrorID() == FbxIOBase::eFileVersionNotSupportedYet || + lImporter->GetLastErrorID() == FbxIOBase::eFileVersionNotSupportedAnymore) { printf("FBX version number for this FBX SDK is %d.%d.%d\n", lSDKMajor, lSDKMinor, lSDKRevision); printf("FBX version number for file %s is %d.%d.%d\n\n", pFilename, lFileMajor, lFileMinor, lFileRevision); @@ -218,7 +218,7 @@ bool LoadScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pF // Import the scene. lStatus = lImporter->Import(pScene); - if(lStatus == false && lImporter->GetLastErrorID() == KFbxIO::ePASSWORD_ERROR) + if(lStatus == false && lImporter->GetLastErrorID() == FbxIOBase::ePasswordError) { printf("Please enter password: "); @@ -232,7 +232,7 @@ bool LoadScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pF lStatus = lImporter->Import(pScene); - if(lStatus == false && lImporter->GetLastErrorID() == KFbxIO::ePASSWORD_ERROR) + if(lStatus == false && lImporter->GetLastErrorID() == FbxIOBase::ePasswordError) { printf("\nPassword is wrong, import aborted.\n"); } @@ -249,7 +249,7 @@ bool LoadScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pF KFbxTakeInfo* lTakeInfo = lImporter->GetTakeInfo(i); printf(" Animation: \"%s\"\n", lTakeInfo->mName.Buffer()); -// pNode->ConvertPivotAnimationRecursive(lTakeInfo->mName.Buffer(), KFbxNode::eDESTINATION_SET, KRAKEN_FBX_ANIMATION_FRAMERATE); +// pNode->ConvertPivotAnimationRecursive(lTakeInfo->mName.Buffer(), KFbxNode::eDestinationPivot, KRAKEN_FBX_ANIMATION_FRAMERATE); pNode->ResetPivotSetAndConvertAnimation(); pNode->UpdatePropertiesFromPivotsAndLimits(); } @@ -263,8 +263,8 @@ bool LoadScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pF } void BakeNode(KFbxNode *pNode) { - pNode->SetPivotState(KFbxNode::eSOURCE_SET, KFbxNode::ePIVOT_STATE_ACTIVE); - pNode->SetPivotState(KFbxNode::eDESTINATION_SET, KFbxNode::ePIVOT_STATE_ACTIVE); + pNode->SetPivotState(KFbxNode::eSourcePivot, KFbxNode::ePivotActive); + pNode->SetPivotState(KFbxNode::eDestinationPivot, KFbxNode::ePivotActive); // Pass the current value to the source pivot. // * - Rotation offset (Roff) @@ -276,30 +276,30 @@ void BakeNode(KFbxNode *pNode) { // * - Geometric translation (Gt) // * - Geometric rotation (Gr) // * - Geometric scaling (Gs) - pNode->SetPostRotation(KFbxNode::eSOURCE_SET, pNode->PostRotation.Get()); - pNode->SetPreRotation(KFbxNode::eSOURCE_SET, pNode->PreRotation.Get()); - pNode->SetRotationOffset(KFbxNode::eSOURCE_SET, pNode->RotationOffset.Get()); - pNode->SetScalingOffset(KFbxNode::eSOURCE_SET, pNode->ScalingOffset.Get()); - pNode->SetRotationPivot(KFbxNode::eSOURCE_SET, pNode->RotationPivot.Get()); - pNode->SetScalingPivot(KFbxNode::eSOURCE_SET, pNode->ScalingPivot.Get()); - pNode->SetGeometricRotation(KFbxNode::eSOURCE_SET, pNode->GeometricRotation.Get()); - pNode->SetGeometricTranslation(KFbxNode::eSOURCE_SET, pNode->GeometricTranslation.Get()); - pNode->SetGeometricScaling(KFbxNode::eSOURCE_SET, pNode->GeometricScaling.Get()); - pNode->SetRotationOrder(KFbxNode::eSOURCE_SET, pNode->RotationOrder.Get()); + pNode->SetPostRotation(KFbxNode::eSourcePivot, pNode->PostRotation.Get()); + pNode->SetPreRotation(KFbxNode::eSourcePivot, pNode->PreRotation.Get()); + pNode->SetRotationOffset(KFbxNode::eSourcePivot, pNode->RotationOffset.Get()); + pNode->SetScalingOffset(KFbxNode::eSourcePivot, pNode->ScalingOffset.Get()); + pNode->SetRotationPivot(KFbxNode::eSourcePivot, pNode->RotationPivot.Get()); + pNode->SetScalingPivot(KFbxNode::eSourcePivot, pNode->ScalingPivot.Get()); + pNode->SetGeometricRotation(KFbxNode::eSourcePivot, pNode->GeometricRotation.Get()); + pNode->SetGeometricTranslation(KFbxNode::eSourcePivot, pNode->GeometricTranslation.Get()); + pNode->SetGeometricScaling(KFbxNode::eSourcePivot, pNode->GeometricScaling.Get()); + pNode->SetRotationOrder(KFbxNode::eSourcePivot, pNode->RotationOrder.Get()); // We want to set all these to 0 and bake them into the transforms. KFbxVector4 lZero(0, 0, 0); KFbxVector4 lOne(1.0, 1.0, 1.0); - pNode->SetPostRotation(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetPreRotation(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetRotationOffset(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetScalingOffset(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetRotationPivot(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetScalingPivot(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetGeometricRotation(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetGeometricTranslation(KFbxNode::eDESTINATION_SET, lZero); - pNode->SetGeometricScaling(KFbxNode::eDESTINATION_SET, lOne); - pNode->SetRotationOrder(KFbxNode::eDESTINATION_SET, eEULER_XYZ); + pNode->SetPostRotation(KFbxNode::eDestinationPivot, lZero); + pNode->SetPreRotation(KFbxNode::eDestinationPivot, lZero); + pNode->SetRotationOffset(KFbxNode::eDestinationPivot, lZero); + pNode->SetScalingOffset(KFbxNode::eDestinationPivot, lZero); + pNode->SetRotationPivot(KFbxNode::eDestinationPivot, lZero); + pNode->SetScalingPivot(KFbxNode::eDestinationPivot, lZero); + pNode->SetGeometricRotation(KFbxNode::eDestinationPivot, lZero); + pNode->SetGeometricTranslation(KFbxNode::eDestinationPivot, lZero); + pNode->SetGeometricScaling(KFbxNode::eDestinationPivot, lOne); + pNode->SetRotationOrder(KFbxNode::eDestinationPivot, eEULER_XYZ); // Bake child nodes for(int i = 0; i < pNode->GetChildCount(); i++) @@ -308,13 +308,13 @@ void BakeNode(KFbxNode *pNode) { } } -void LoadNode(KRNode *parent_node, std::vector &resources, KFbxGeometryConverter *pGeometryConverter, KFbxNode* pNode) { +void LoadNode(KRNode *parent_node, std::vector &resources, FbxGeometryConverter *pGeometryConverter, KFbxNode* pNode) { KFbxVector4 lTmpVector; pNode->UpdatePropertiesFromPivotsAndLimits(); // Transform = T * Roff * Rp * Rpre * R * Rpost * inverse(Rp) * Soff * Sp * S * inverse(Sp) - fbxDouble3 local_rotation = pNode->LclRotation.Get(); // pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET); - fbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET); - fbxDouble3 local_scale = pNode->LclScaling.Get(); // pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET); + fbxDouble3 local_rotation = pNode->LclRotation.Get(); // pNode->GetGeometricRotation(KFbxNode::eSourcePivot); + fbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(KFbxNode::eSourcePivot); + fbxDouble3 local_scale = pNode->LclScaling.Get(); // pNode->GetGeometricScaling(KFbxNode::eSourcePivot); // fbxDouble3 post_rotation = pNode->PostRotation.Get(); // fbxDouble3 pre_rotation = pNode->PreRotation.Get(); @@ -345,12 +345,12 @@ void LoadNode(KRNode *parent_node, std::vector &resources, KFbxGeo KRNode *new_node = NULL; - KFbxNodeAttribute::EAttributeType attribute_type = (pNode->GetNodeAttribute()->GetAttributeType()); + KFbxNodeAttribute::EType attribute_type = (pNode->GetNodeAttribute()->GetAttributeType()); switch(attribute_type) { - case KFbxNodeAttribute::eMESH: + case KFbxNodeAttribute::eMesh: new_node = LoadMesh(parent_node, resources, pGeometryConverter, pNode); break; - case KFbxNodeAttribute::eLIGHT: + case KFbxNodeAttribute::eLight: new_node = LoadLight(parent_node, resources, pNode); break; default: @@ -378,7 +378,7 @@ void LoadNode(KRNode *parent_node, std::vector &resources, KFbxGeo } } -KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbxGeometryConverter *pGeometryConverter, KFbxNode* pNode) { +KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, FbxGeometryConverter *pGeometryConverter, KFbxNode* pNode) { printf("Mesh: %s\n", pNode->GetName()); KFbxMesh* pSourceMesh = (KFbxMesh*) pNode->GetNodeAttribute(); @@ -422,9 +422,9 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbx int iNewMaterial = -1; for (int l = 0; l < elementmaterial_count; l++) { - KFbxGeometryElementMaterial* leMat = pMesh->GetElementMaterial(l); + FbxGeometryElementMaterial* leMat = pMesh->GetElementMaterial(l); if(leMat) { - if (leMat->GetReferenceMode() == KFbxGeometryElement::eINDEX || leMat->GetReferenceMode() == KFbxGeometryElement::eINDEX_TO_DIRECT) { + if (leMat->GetReferenceMode() == FbxGeometryElement::eIndex || leMat->GetReferenceMode() == FbxGeometryElement::eIndexToDirect) { int new_id = leMat->GetIndexArray().GetAt(iPolygon); if(new_id >= 0) { iNewMaterial = new_id; @@ -479,14 +479,14 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbx for(int l = 0; l < tangent_count; ++l) { KFbxVector4 new_tangent; - KFbxGeometryElementTangent* leTangent = pMesh->GetElementTangent(l); + FbxGeometryElementTangent* leTangent = pMesh->GetElementTangent(l); - if(leTangent->GetMappingMode() == KFbxGeometryElement::eBY_POLYGON_VERTEX) { + if(leTangent->GetMappingMode() == FbxGeometryElement::eByPolygonVertex) { switch (leTangent->GetReferenceMode()) { - case KFbxGeometryElement::eDIRECT: + case FbxGeometryElement::eDirect: new_tangent = leTangent->GetDirectArray().GetAt(lControlPointIndex); break; - case KFbxGeometryElement::eINDEX_TO_DIRECT: + case FbxGeometryElement::eIndexToDirect: { int id = leTangent->GetIndexArray().GetAt(lControlPointIndex); new_tangent = leTangent->GetDirectArray().GetAt(id); @@ -524,14 +524,14 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbx // ----====---- Output Material File ----====---- KRMaterial *new_material = new KRMaterial(parent_node->getContext(), pMaterial->GetName()); - KFbxPropertyDouble3 lKFbxDouble3; - KFbxPropertyDouble1 lKFbxDouble1; + FbxPropertyT lKFbxDouble3; + FbxPropertyT lKFbxDouble1; if (pMaterial->GetClassId().Is(KFbxSurfacePhong::ClassId)) { // We found a Phong material. // Ambient Color - lKFbxDouble3 =((KFbxSurfacePhong *) pMaterial)->Ambient; + lKFbxDouble3 =((FbxSurfacePhong *) pMaterial)->Ambient; new_material->setAmbient(KRVector3(lKFbxDouble3.Get()[0], lKFbxDouble3.Get()[1], lKFbxDouble3.Get()[2])); // Diffuse Color @@ -601,19 +601,19 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbx if(texture_count > 1) { printf("Error! Multiple diffuse textures not supported.\n"); } else if(texture_count == 1) { - KFbxTexture* pTexture = KFbxCast (pProperty.GetSrcObject(KFbxTexture::ClassId,0)); + KFbxTexture* pTexture = FbxCast (pProperty.GetSrcObject(KFbxTexture::ClassId,0)); assert(!pTexture->GetSwapUV()); assert(pTexture->GetCroppingTop() == 0); assert(pTexture->GetCroppingLeft() == 0); assert(pTexture->GetCroppingRight() == 0); assert(pTexture->GetCroppingBottom() == 0); - assert(pTexture->GetWrapModeU() == KFbxTexture::eREPEAT); - assert(pTexture->GetWrapModeV() == KFbxTexture::eREPEAT); + assert(pTexture->GetWrapModeU() == KFbxTexture::eRepeat); + assert(pTexture->GetWrapModeV() == KFbxTexture::eRepeat); assert(pTexture->GetRotationU() == 0.0f); assert(pTexture->GetRotationV() == 0.0f); assert(pTexture->GetRotationW() == 0.0f); - KFbxFileTexture *pFileTexture = KFbxCast(pTexture); + KFbxFileTexture *pFileTexture = FbxCast(pTexture); if(pFileTexture) { new_material->setDiffuseMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV())); } @@ -629,8 +629,8 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbx if(texture_count > 1) { printf("Error! Multiple specular textures not supported.\n"); } else if(texture_count == 1) { - KFbxTexture* pTexture = KFbxCast (pProperty.GetSrcObject(KFbxTexture::ClassId,0)); - KFbxFileTexture *pFileTexture = KFbxCast(pTexture); + KFbxTexture* pTexture = FbxCast (pProperty.GetSrcObject(KFbxTexture::ClassId,0)); + KFbxFileTexture *pFileTexture = FbxCast(pTexture); if(pFileTexture) { new_material->setSpecularMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV())); } @@ -646,8 +646,8 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbx if(texture_count > 1) { printf("Error! Multiple normal map textures not supported.\n"); } else if(texture_count == 1) { - KFbxTexture* pTexture = KFbxCast (pProperty.GetSrcObject(KFbxTexture::ClassId,0)); - KFbxFileTexture *pFileTexture = KFbxCast(pTexture); + KFbxTexture* pTexture = FbxCast (pProperty.GetSrcObject(KFbxTexture::ClassId,0)); + KFbxFileTexture *pFileTexture = FbxCast(pTexture); if(pFileTexture) { new_material->setNormalMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV())); } @@ -683,7 +683,7 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector &resources, KFbx std::string light_map = pNode->GetName(); light_map.append("_lightmap"); - KRInstance *new_instance = new KRInstance(parent_node->getScene(), pNode->GetName(), pNode->GetName(), light_map, 0.0f, true); + KRInstance *new_instance = new KRInstance(parent_node->getScene(), pNode->GetName(), pNode->GetName(), light_map, 0.0f, true, false); return new_instance; } else { return NULL; @@ -695,15 +695,15 @@ KRNode *LoadLight(KRNode *parent_node, std::vector &resources, KFb const GLfloat PI = 3.14159265; const GLfloat d2r = PI * 2 / 360; - KFbxLight* pLight = (KFbxLight*) pNode->GetNodeAttribute(); + FbxLight* pLight = (FbxLight*) pNode->GetNodeAttribute(); const char *szName = pNode->GetName(); - fbxDouble3 light_color = pLight->Color.Get(); - fbxDouble1 light_intensity = pLight->Intensity.Get(); - fbxDouble1 light_hotspot = pLight->HotSpot.Get(); // light inner cone angle (in degrees). Also know as the HotSpot - fbxDouble1 light_coneangle = pLight->ConeAngle.Get(); // light outer cone angle (in degrees). Also known as the Falloff + FbxDouble3 light_color = pLight->Color.Get(); + FbxDouble light_intensity = pLight->Intensity.Get(); + FbxDouble light_hotspot = pLight->InnerAngle.Get(); // light inner cone angle (in degrees). Also know as the HotSpot + FbxDouble light_coneangle = pLight->OuterAngle.Get(); // light outer cone angle (in degrees). Also known as the Falloff KFbxLight::EDecayType light_decaytype = pLight->DecayType.Get(); // decay type - fbxDouble1 light_decaystart = pLight->DecayStart.Get(); // decay start distance + FbxDouble light_decaystart = pLight->DecayStart.Get(); // decay start distance // KFbxLight::eNONE - does not attenuate with distance @@ -714,20 +714,20 @@ KRNode *LoadLight(KRNode *parent_node, std::vector &resources, KFb KRLight *new_light = NULL; switch(pLight->LightType.Get()) { - case KFbxLight::ePOINT: + case KFbxLight::ePoint: { KRPointLight *l = new KRPointLight(parent_node->getScene(), szName); new_light = l; } break; - case KFbxLight::eDIRECTIONAL: + case KFbxLight::eDirectional: { KRDirectionalLight *l = new KRDirectionalLight(parent_node->getScene(), szName); new_light = l; } break; - case KFbxLight::eSPOT: + case KFbxLight::eSpot: { KRSpotLight *l = new KRSpotLight(parent_node->getScene(), szName); l->setInnerAngle(light_hotspot * d2r); @@ -735,7 +735,7 @@ KRNode *LoadLight(KRNode *parent_node, std::vector &resources, KFb new_light = l; } break; - case KFbxLight::eAREA: + case KFbxLight::eArea: // Not supported yet break; }