Ver código fonte

Pulled from next.

Kieran Cunney 13 anos atrás
pai
commit
3bb17110f1

+ 7 - 4
gameplay-encoder/gameplay-encoder.vcxproj

@@ -146,21 +146,24 @@
       </PrecompiledHeader>
       </PrecompiledHeader>
       <WarningLevel>Level4</WarningLevel>
       <WarningLevel>Level4</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;NO_BOOST;NO_ZAE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../external-deps/freetype2/include;../external-deps/collada-dom/include;../external-deps/collada-dom/include/1.4;../external-deps/libpng/include;../external-deps/zlib/include</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;NO_BOOST;USE_FBX;NO_ZAE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>../external-deps/freetype2/include;../external-deps/collada-dom/include;../external-deps/collada-dom/include/1.4;../external-deps/libpng/include;../external-deps/zlib/include;C:\Program Files\Autodesk\FBX\FbxSdk\2012.2\include</AdditionalIncludeDirectories>
       <DisableLanguageExtensions>
       <DisableLanguageExtensions>
       </DisableLanguageExtensions>
       </DisableLanguageExtensions>
+      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Console</SubSystem>
       <SubSystem>Console</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalLibraryDirectories>../external-deps/freetype2/lib/win32;../external-deps/collada-dom/lib/win32;../external-deps/libpng/lib/win32;../external-deps/zlib/lib/win32</AdditionalLibraryDirectories>
-      <AdditionalDependencies>freetype245.lib;libcollada14dom22-d.lib;libpng14.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../external-deps/freetype2/lib/win32;../external-deps/collada-dom/lib/win32;../external-deps/libpng/lib/win32;../external-deps/zlib/lib/win32;C:\Program Files\Autodesk\FBX\FbxSdk\2012.2\lib\vs2010\x86</AdditionalLibraryDirectories>
+      <AdditionalDependencies>freetype245.lib;libcollada14dom22-d.lib;libpng14.lib;zlib.lib;fbxsdk-2012.2-mdd.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>
       <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>
+      <AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
     </Link>
     </Link>
     <PostBuildEvent>
     <PostBuildEvent>
       <Command>copy /Y "$(ProjectDir)..\external-deps\collada-dom\lib\win32\*.dll" "$(TargetDir)"
       <Command>copy /Y "$(ProjectDir)..\external-deps\collada-dom\lib\win32\*.dll" "$(TargetDir)"
 copy /Y "$(ProjectDir)..\external-deps\zlib\lib\win32\*.dll" "$(TargetDir)"
 copy /Y "$(ProjectDir)..\external-deps\zlib\lib\win32\*.dll" "$(TargetDir)"
+copy /Y "C:\Program Files\Autodesk\FBX\FbxSdk\2012.2\lib\vs2010\x86\fbxsdk-2012.2d.dll" "$(TargetDir)"
 </Command>
 </Command>
     </PostBuildEvent>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>

+ 1 - 2
gameplay-encoder/gameplay-encoder.vcxproj.user

@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <LocalDebuggerCommandArguments>
-    </LocalDebuggerCommandArguments>
+    <LocalDebuggerCommandArguments>-groupAnimations HIKCharacterNode_boy_Reference movements "../gameplay-samples/sample03-character/res/scene.fbx"</LocalDebuggerCommandArguments>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
     <LocalDebuggerEnvironment>PATH=%PATH%;../external-deps/zlib/lib/win32;../external-deps/libpng/lib/win32</LocalDebuggerEnvironment>
     <LocalDebuggerEnvironment>PATH=%PATH%;../external-deps/zlib/lib/win32;../external-deps/libpng/lib/win32</LocalDebuggerEnvironment>
   </PropertyGroup>
   </PropertyGroup>

+ 59 - 15
gameplay-encoder/src/FBXSceneEncoder.cpp

@@ -248,7 +248,7 @@ void FBXSceneEncoder::loadScene(KFbxScene* fbxScene)
 
 
     // Find the ambient light of the scene
     // Find the ambient light of the scene
     KFbxColor ambientColor = fbxScene->GetGlobalSettings().GetAmbientColor();
     KFbxColor ambientColor = fbxScene->GetGlobalSettings().GetAmbientColor();
-    scene->setAmbientColor((float)ambientColor.mRed, (float)ambientColor.mGreen, (float)ambientColor.mBlue);
+	scene->setAmbientColor((float)ambientColor.mRed, (float)ambientColor.mGreen, (float)ambientColor.mBlue);
 
 
 	// Assign the first camera node (if there is one) in the scene as the active camera
 	// Assign the first camera node (if there is one) in the scene as the active camera
 	// This ensures that if there's a camera in the scene that it is assigned as the 
 	// This ensures that if there's a camera in the scene that it is assigned as the 
@@ -651,20 +651,64 @@ void FBXSceneEncoder::loadLight(KFbxNode* fbxNode, Node* node)
     
     
     switch (fbxLight->LightType.Get())
     switch (fbxLight->LightType.Get())
     {
     {
-    case KFbxLight::ePOINT:
-        light->setPointLight();
-        // TODO: range
-        break;
-    case KFbxLight::eDIRECTIONAL:
-        light->setDirectionalLight();
-        break;
-    case KFbxLight::eSPOT:
-        light->setSpotLight();
-        // TODO: range and angles
-        break;
-    default:
-        warning("Unknown light type in node.");
-        return;
+	case KFbxLight::ePOINT:
+	{
+		KFbxLight::EDecayType decayType = fbxLight->DecayType.Get();
+		switch (decayType)
+		{
+		case KFbxLight::eNONE:
+			// No decay.
+			light->setAmbientLight();
+			break;
+		case KFbxLight::eLINEAR:
+			light->setPointLight();
+			light->setLinearAttenuation((float)fbxLight->DecayStart.Get());
+			break;
+		case KFbxLight::eQUADRATIC:
+			light->setPointLight();
+			light->setQuadraticAttenuation((float)fbxLight->DecayStart.Get());
+			break;
+		case KFbxLight::eCUBIC:
+		default:
+			// Not supported..
+			break;
+		}
+		break;
+	}
+	case KFbxLight::eDIRECTIONAL:
+	{
+		light->setDirectionalLight();
+		break;
+	}
+	case KFbxLight::eSPOT:
+	{
+		light->setSpotLight();
+        
+		KFbxLight::EDecayType decayType = fbxLight->DecayType.Get();
+		switch (decayType)
+		{
+		case KFbxLight::eNONE:
+			// No decay.
+			break;
+		case KFbxLight::eLINEAR:
+			light->setLinearAttenuation((float)fbxLight->DecayStart.Get());
+			break;
+		case KFbxLight::eQUADRATIC:
+			light->setQuadraticAttenuation((float)fbxLight->DecayStart.Get());
+			break;
+		case KFbxLight::eCUBIC:
+			// Not supported..
+			break;
+		}
+
+		light->setFalloffAngle(MATH_DEG_TO_RAD((float)fbxLight->ConeAngle.Get()) * 2.0f); // fall off angle
+		break;
+	}
+	default:
+	{
+		warning("Unknown light type in node.");
+		return;
+	}
     }
     }
 
 
     _gamePlayFile.addLight(light);
     _gamePlayFile.addLight(light);