Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTest.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTest.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTest.cpp (revision 24259) @@ -1,113 +1,113 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" - -#ifdef WIN32 -#include -#else -#include -#endif // WIN32 - -fstring logFilename = FC("FColladaTestLog.txt"); -bool isVerbose = true; - -void ShowHelp() -{ - fprintf(stderr, "Unknown command line argument(s). \n"); - fprintf(stderr, "Usage: FColladaTest.exe [-v ] []\n"); - fprintf(stderr, " -v : Set the verbosity level.\n"); - fprintf(stderr, " Level 0 keeps only the error messages.\n"); - fprintf(stderr, " Level 1 keeps all the messages. \n"); - fprintf(stderr, " : Set the filename of the output log file.\n"); - fflush(stderr); - exit(-1); -} - -void ProcessCommandLine(int argc, char* argv[]) -{ - // Remove the first argument: the current application name... - --argc; ++argv; - while (argc > 0) - { - if (argv[0][0] == '-' || argv[0][0] == '/') - { - ++(argv[0]); - if (strcmp(argv[0], "-v") && argc >= 2) - { - isVerbose = FUStringConversion::ToBoolean(argv[1]); - argc -= 2; argv += 2; - } - else - { - // unknown flag - ShowHelp(); break; - } - } - else if (argc == 1) - { - logFilename = TO_FSTRING((const char*) *(argv++)); - --argc; - } - else - { - ShowHelp(); break; - } - } -} - -int main(int argc, char* argv[]) -{ - ProcessCommandLine(argc, argv); - FCollada::Initialize(); //Needed for Mac/Linux when FCollada is statically linked. - // In debug mode, output memory leak information and do periodic memory checks -#ifdef PLUG_CRT - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_128_DF); -#endif - - FUTestBed testBed(logFilename.c_str(), isVerbose); - -#ifndef _DEBUG - try { -#endif - // Set the current folder to the folder with the samples DAE files - _chdir("Samples"); - - // FMath tests - RUN_TESTSUITE(FCTestAll) - -#ifndef _DEBUG - } - catch (const char* sz) { testBed.GetLogFile().WriteLine(sz); } -#ifdef UNICODE - catch (const fchar* sz) { testBed.GetLogFile().WriteLine(sz); } -#endif - catch (...) { testBed.GetLogFile().WriteLine("Exception caught!"); } -#endif - - return 0; -} - -TESTSUITE_START(FCTestAll) - -TESTSUITE_TEST(0, FColladaAll) - // FCollada internal tests. - FCollada::RunTests(testBed); - - // FCDocument test - RUN_TESTSUITE(FCDParameter); - RUN_TESTSUITE(FColladaArchiving); - RUN_TESTSUITE(FCDAnimation); - RUN_TESTSUITE(FCDGeometryPolygonsTools); - RUN_TESTSUITE(FCDExportReimport); - RUN_TESTSUITE(FCTestXRef); - RUN_TESTSUITE(FCTAssetManagement); - RUN_TESTSUITE(FCDControllers); - RUN_TESTSUITE(FCDSceneNode); - -TESTSUITE_END +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" + +#ifdef WIN32 +#include +#else +#include +#endif // WIN32 + +fstring logFilename = FC("FColladaTestLog.txt"); +bool isVerbose = true; + +void ShowHelp() +{ + fprintf(stderr, "Unknown command line argument(s). \n"); + fprintf(stderr, "Usage: FColladaTest.exe [-v ] []\n"); + fprintf(stderr, " -v : Set the verbosity level.\n"); + fprintf(stderr, " Level 0 keeps only the error messages.\n"); + fprintf(stderr, " Level 1 keeps all the messages. \n"); + fprintf(stderr, " : Set the filename of the output log file.\n"); + fflush(stderr); + exit(-1); +} + +void ProcessCommandLine(int argc, char* argv[]) +{ + // Remove the first argument: the current application name... + --argc; ++argv; + while (argc > 0) + { + if (argv[0][0] == '-' || argv[0][0] == '/') + { + ++(argv[0]); + if (strcmp(argv[0], "-v") && argc >= 2) + { + isVerbose = FUStringConversion::ToBoolean(argv[1]); + argc -= 2; argv += 2; + } + else + { + // unknown flag + ShowHelp(); break; + } + } + else if (argc == 1) + { + logFilename = TO_FSTRING((const char*) *(argv++)); + --argc; + } + else + { + ShowHelp(); break; + } + } +} + +int main(int argc, char* argv[]) +{ + ProcessCommandLine(argc, argv); + FCollada::Initialize(); //Needed for Mac/Linux when FCollada is statically linked. + // In debug mode, output memory leak information and do periodic memory checks +#ifdef PLUG_CRT + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_128_DF); +#endif + + FUTestBed testBed(logFilename.c_str(), isVerbose); + +#ifndef _DEBUG + try { +#endif + // Set the current folder to the folder with the samples DAE files + _chdir("Samples"); + + // FMath tests + RUN_TESTSUITE(FCTestAll) + +#ifndef _DEBUG + } + catch (const char* sz) { testBed.GetLogFile().WriteLine(sz); } +#ifdef UNICODE + catch (const fchar* sz) { testBed.GetLogFile().WriteLine(sz); } +#endif + catch (...) { testBed.GetLogFile().WriteLine("Exception caught!"); } +#endif + + return 0; +} + +TESTSUITE_START(FCTestAll) + +TESTSUITE_TEST(0, FColladaAll) + // FCollada internal tests. + FCollada::RunTests(testBed); + + // FCDocument test + RUN_TESTSUITE(FCDParameter); + RUN_TESTSUITE(FColladaArchiving); + RUN_TESTSUITE(FCDAnimation); + RUN_TESTSUITE(FCDGeometryPolygonsTools); + RUN_TESTSUITE(FCDExportReimport); + RUN_TESTSUITE(FCTestXRef); + RUN_TESTSUITE(FCTAssetManagement); + RUN_TESTSUITE(FCDControllers); + RUN_TESTSUITE(FCDSceneNode); + +TESTSUITE_END Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTest.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestAnimation.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestAnimation.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestAnimation.cpp (revision 24259) @@ -1,110 +1,110 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" -#include "FCDocument/FCDocument.h" -#include "FCDocument/FCDAnimation.h" -#include "FCDocument/FCDAnimationChannel.h" -#include "FCDocument/FCDAnimationCurve.h" -#include "FCDocument/FCDAnimationCurveTools.h" -#include "FCDocument/FCDAnimationMultiCurve.h" -#include "FCDocument/FCDAnimationKey.h" -#include "FCDocument/FCDLibrary.h" -#include "FCDocument/FCDSceneNode.h" -#include "FCDocument/FCDSceneNodeTools.h" - -TESTSUITE_START(FCDAnimation) - -TESTSUITE_TEST(0, Sampling) - FUErrorSimpleHandler errorHandler; - - // Test import of the Eagle sample - // Retrieves the "Bone09" joint and does the import sampling to verify its correctness. - FUObjectRef document = FCollada::NewTopDocument(); - PassIf(FCollada::LoadDocumentFromFile(document, FC("Eagle.DAE"))); - PassIf(errorHandler.IsSuccessful()); - PassIf(document->GetCameraLibrary()->GetEntityCount() == 1); - FCDSceneNode* node = document->FindSceneNode("Bone09"); - FailIf(node == NULL); - - FCDSceneNodeTools::GenerateSampledAnimation(node); - const FloatList& keys = FCDSceneNodeTools::GetSampledAnimationKeys(); - const FMMatrix44List& values = FCDSceneNodeTools::GetSampledAnimationMatrices(); - FailIf(keys.size() > 30); - PassIf(keys.size() == values.size()); - FCDSceneNodeTools::ClearSampledAnimation(); - -TESTSUITE_TEST(1, CurveMerging) - // Test the merge of single curves into multiple curves. - FUObjectRef document = FCollada::NewTopDocument(); - FCDAnimation* animation = document->GetAnimationLibrary()->AddEntity(); - FCDAnimationChannel* channel = animation->AddChannel(); - - // Create a first curve. - static const size_t curve1KeyCount = 3; - static const float curve1Keys[curve1KeyCount] = { 0.0f, 2.0f, 3.0f }; - static const float curve1Values[curve1KeyCount] = { 0.0f, -2.0f, 0.0f }; - static const FMVector2 curve1Intan[curve1KeyCount] = { FMVector2(-0.3f, 0.0f), FMVector2(1.2f, 1.0f), FMVector2(2.8f, -1.0f) }; - static const FMVector2 curve1Outtan[curve1KeyCount] = { FMVector2(0.5f, -4.0f), FMVector2(2.5f, 3.0f), FMVector2(3.0f, 0.0f) }; - FCDAnimationCurve* c1 = channel->AddCurve(); - for (size_t i = 0; i < curve1KeyCount; ++i) - { - FCDAnimationKeyBezier* k = (FCDAnimationKeyBezier*) c1->AddKey(FUDaeInterpolation::BEZIER); - k->input = curve1Keys[i]; k->output = curve1Values[i]; - k->inTangent = curve1Intan[i]; k->outTangent = curve1Outtan[i]; - } - - // Create a second curve. - static const size_t curve2KeyCount = 3; - static const float curve2Keys[curve2KeyCount] = { 0.0f, 1.0f, 3.0f }; - static const float curve2Values[curve2KeyCount] = { -10.0f, -12.0f, -10.0f }; - static const FMVector2 curve2Intan[curve2KeyCount] = { FMVector2(0.0f, 0.0f), FMVector2(0.8f, -2.0f), FMVector2(2.7f, -2.0f) }; - static const FMVector2 curve2Outtan[curve2KeyCount] = { FMVector2(0.2f, 0.0f), FMVector2(1.8f, -1.0f), FMVector2(3.5f, 2.0f) }; - FCDAnimationCurve* c2 = channel->AddCurve(); - for (size_t i = 0; i < curve2KeyCount; ++i) - { - FCDAnimationKeyBezier* k = (FCDAnimationKeyBezier*) c2->AddKey(FUDaeInterpolation::BEZIER); - k->input = curve2Keys[i]; k->output = curve2Values[i]; - k->inTangent = curve2Intan[i]; k->outTangent = curve2Outtan[i]; - } - - // Merge the curves - FCDAnimationCurveList curves; - curves.push_back(c1); - curves.push_back(c2); - FloatList defaultValues(2, 0.0f); - FCDAnimationMultiCurve* multiCurve = FCDAnimationCurveTools::MergeCurves(curves, defaultValues); - FailIf(multiCurve == NULL); - - // Verify the created multi-curve - static const size_t multiCurveKeyCount = 4; - static const float multiCurveKeys[multiCurveKeyCount] = { 0.0f, 1.0f, 2.0f, 3.0f }; - static const float multiCurveValues[2][multiCurveKeyCount] = { { 0.0f, -1.25025f, -2.0f, 0.0f }, { -10.0f, -12.0f, -4.14197f, -10.0f } }; - static const FMVector2 multiCurveIntans[2][multiCurveKeyCount] = { { FMVector2(-0.3f, 0.0f), FMVector2(0.6666f, -1.5860f), FMVector2(1.6f, -0.5f), FMVector2(2.8f, -1.0f) }, { FMVector2(0.0f, 0.0f), FMVector2(0.8f, -2.0f), FMVector2(1.6666f, -4.92637f), FMVector2(2.85f, -6.0f) } }; - static const FMVector2 multiCurveOuttans[2][multiCurveKeyCount] = { { FMVector2(0.25f, -2.0f), FMVector2(1.3333f, -0.91447f), FMVector2(2.5f, 3.0f), FMVector2(3.0f, 0.0f) }, { FMVector2(0.2f, 0.0f), FMVector2(1.4f, -6.5f), FMVector2(2.3333f, -3.35757f), FMVector2(3.5f, 2.0f) } }; - PassIf(multiCurve->GetDimension() == 2); - PassIf(multiCurve->GetKeyCount() == multiCurveKeyCount); - for (size_t i = 0; i < multiCurveKeyCount; ++i) - { - FCDAnimationMKeyBezier* bk = (FCDAnimationMKeyBezier*) multiCurve->GetKey(i); - PassIf(IsEquivalent(bk->input, multiCurveKeys[i])); - PassIf(bk->interpolation == FUDaeInterpolation::BEZIER); - PassIf(bk->GetDimension() == 2); - for (size_t d = 0; d < 2; ++d) - { - PassIf(IsEquivalent(bk->output[d], multiCurveValues[d][i])); - PassIf(IsEquivalent(bk->inTangent[d], multiCurveIntans[d][i])); - PassIf(IsEquivalent(bk->outTangent[d], multiCurveOuttans[d][i])); - } - } - - SAFE_RELEASE(c1); - SAFE_RELEASE(c2); - SAFE_RELEASE(multiCurve); - -TESTSUITE_END +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" +#include "FCDocument/FCDocument.h" +#include "FCDocument/FCDAnimation.h" +#include "FCDocument/FCDAnimationChannel.h" +#include "FCDocument/FCDAnimationCurve.h" +#include "FCDocument/FCDAnimationCurveTools.h" +#include "FCDocument/FCDAnimationMultiCurve.h" +#include "FCDocument/FCDAnimationKey.h" +#include "FCDocument/FCDLibrary.h" +#include "FCDocument/FCDSceneNode.h" +#include "FCDocument/FCDSceneNodeTools.h" + +TESTSUITE_START(FCDAnimation) + +TESTSUITE_TEST(0, Sampling) + FUErrorSimpleHandler errorHandler; + + // Test import of the Eagle sample + // Retrieves the "Bone09" joint and does the import sampling to verify its correctness. + FUObjectRef document = FCollada::NewTopDocument(); + PassIf(FCollada::LoadDocumentFromFile(document, FC("Eagle.DAE"))); + PassIf(errorHandler.IsSuccessful()); + PassIf(document->GetCameraLibrary()->GetEntityCount() == 1); + FCDSceneNode* node = document->FindSceneNode("Bone09"); + FailIf(node == NULL); + + FCDSceneNodeTools::GenerateSampledAnimation(node); + const FloatList& keys = FCDSceneNodeTools::GetSampledAnimationKeys(); + const FMMatrix44List& values = FCDSceneNodeTools::GetSampledAnimationMatrices(); + FailIf(keys.size() > 30); + PassIf(keys.size() == values.size()); + FCDSceneNodeTools::ClearSampledAnimation(); + +TESTSUITE_TEST(1, CurveMerging) + // Test the merge of single curves into multiple curves. + FUObjectRef document = FCollada::NewTopDocument(); + FCDAnimation* animation = document->GetAnimationLibrary()->AddEntity(); + FCDAnimationChannel* channel = animation->AddChannel(); + + // Create a first curve. + static const size_t curve1KeyCount = 3; + static const float curve1Keys[curve1KeyCount] = { 0.0f, 2.0f, 3.0f }; + static const float curve1Values[curve1KeyCount] = { 0.0f, -2.0f, 0.0f }; + static const FMVector2 curve1Intan[curve1KeyCount] = { FMVector2(-0.3f, 0.0f), FMVector2(1.2f, 1.0f), FMVector2(2.8f, -1.0f) }; + static const FMVector2 curve1Outtan[curve1KeyCount] = { FMVector2(0.5f, -4.0f), FMVector2(2.5f, 3.0f), FMVector2(3.0f, 0.0f) }; + FCDAnimationCurve* c1 = channel->AddCurve(); + for (size_t i = 0; i < curve1KeyCount; ++i) + { + FCDAnimationKeyBezier* k = (FCDAnimationKeyBezier*) c1->AddKey(FUDaeInterpolation::BEZIER); + k->input = curve1Keys[i]; k->output = curve1Values[i]; + k->inTangent = curve1Intan[i]; k->outTangent = curve1Outtan[i]; + } + + // Create a second curve. + static const size_t curve2KeyCount = 3; + static const float curve2Keys[curve2KeyCount] = { 0.0f, 1.0f, 3.0f }; + static const float curve2Values[curve2KeyCount] = { -10.0f, -12.0f, -10.0f }; + static const FMVector2 curve2Intan[curve2KeyCount] = { FMVector2(0.0f, 0.0f), FMVector2(0.8f, -2.0f), FMVector2(2.7f, -2.0f) }; + static const FMVector2 curve2Outtan[curve2KeyCount] = { FMVector2(0.2f, 0.0f), FMVector2(1.8f, -1.0f), FMVector2(3.5f, 2.0f) }; + FCDAnimationCurve* c2 = channel->AddCurve(); + for (size_t i = 0; i < curve2KeyCount; ++i) + { + FCDAnimationKeyBezier* k = (FCDAnimationKeyBezier*) c2->AddKey(FUDaeInterpolation::BEZIER); + k->input = curve2Keys[i]; k->output = curve2Values[i]; + k->inTangent = curve2Intan[i]; k->outTangent = curve2Outtan[i]; + } + + // Merge the curves + FCDAnimationCurveList curves; + curves.push_back(c1); + curves.push_back(c2); + FloatList defaultValues(2, 0.0f); + FCDAnimationMultiCurve* multiCurve = FCDAnimationCurveTools::MergeCurves(curves, defaultValues); + FailIf(multiCurve == NULL); + + // Verify the created multi-curve + static const size_t multiCurveKeyCount = 4; + static const float multiCurveKeys[multiCurveKeyCount] = { 0.0f, 1.0f, 2.0f, 3.0f }; + static const float multiCurveValues[2][multiCurveKeyCount] = { { 0.0f, -1.25025f, -2.0f, 0.0f }, { -10.0f, -12.0f, -4.14197f, -10.0f } }; + static const FMVector2 multiCurveIntans[2][multiCurveKeyCount] = { { FMVector2(-0.3f, 0.0f), FMVector2(0.6666f, -1.5860f), FMVector2(1.6f, -0.5f), FMVector2(2.8f, -1.0f) }, { FMVector2(0.0f, 0.0f), FMVector2(0.8f, -2.0f), FMVector2(1.6666f, -4.92637f), FMVector2(2.85f, -6.0f) } }; + static const FMVector2 multiCurveOuttans[2][multiCurveKeyCount] = { { FMVector2(0.25f, -2.0f), FMVector2(1.3333f, -0.91447f), FMVector2(2.5f, 3.0f), FMVector2(3.0f, 0.0f) }, { FMVector2(0.2f, 0.0f), FMVector2(1.4f, -6.5f), FMVector2(2.3333f, -3.35757f), FMVector2(3.5f, 2.0f) } }; + PassIf(multiCurve->GetDimension() == 2); + PassIf(multiCurve->GetKeyCount() == multiCurveKeyCount); + for (size_t i = 0; i < multiCurveKeyCount; ++i) + { + FCDAnimationMKeyBezier* bk = (FCDAnimationMKeyBezier*) multiCurve->GetKey(i); + PassIf(IsEquivalent(bk->input, multiCurveKeys[i])); + PassIf(bk->interpolation == FUDaeInterpolation::BEZIER); + PassIf(bk->GetDimension() == 2); + for (size_t d = 0; d < 2; ++d) + { + PassIf(IsEquivalent(bk->output[d], multiCurveValues[d][i])); + PassIf(IsEquivalent(bk->inTangent[d], multiCurveIntans[d][i])); + PassIf(IsEquivalent(bk->outTangent[d], multiCurveOuttans[d][i])); + } + } + + SAFE_RELEASE(c1); + SAFE_RELEASE(c2); + SAFE_RELEASE(multiCurve); + +TESTSUITE_END Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestAnimation.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestArchiving.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestArchiving.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestArchiving.cpp (revision 24259) @@ -1,53 +1,53 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" -#include "FCDocument/FCDocument.h" -#include "FCDocument/FCDLibrary.h" -#include "FCDocument/FCDLight.h" -#include "FUtils/FUFile.h" - -TESTSUITE_START(FColladaArchiving) - -TESTSUITE_TEST(0, FileArchiving) - FUErrorSimpleHandler errorHandler; - - // Create a simple document with a sole light inside that we can use to verify I/O. - FUObjectRef document = FCollada::NewTopDocument(); - FCDLight* light = document->GetLightLibrary()->AddEntity(); - light->SetLightType(FCDLight::POINT); - light->SetName(FC("ATestLight")); - light->SetIntensity(0.4f); - - // Save and load this document. - FCollada::SaveDocument(document, FC("./TestOut.dae")); - FUObjectRef document2 = FCollada::NewTopDocument(); - PassIf(FCollada::LoadDocumentFromFile(document2, FC("./TestOut.dae"))); - PassIf(errorHandler.IsSuccessful()); - PassIf(document2->GetLightLibrary()->GetEntityCount() == 1); - FCDLight* light2 = document2->GetLightLibrary()->GetEntity(0); - PassIf(IsEquivalent(light2->GetName(), light->GetName())); - PassIf(light2->GetLightType() == light->GetLightType()); - PassIf(IsEquivalent(light->GetIntensity(), light->GetIntensity())); - - // Read in this document using a FUFile and manually load it in FCollada. - FUFile file1(FC("./TestOut.dae"), FUFile::READ); - size_t dataLength = file1.GetLength(); - uint8* buffer = new uint8[dataLength]; - PassIf(file1.Read(buffer, dataLength)); - file1.Close(); - FUObjectRef document3 = FCollada::NewTopDocument(); - FCollada::LoadDocumentFromMemory(FC("./TestOut.dae"), document3, buffer, dataLength); - PassIf(errorHandler.IsSuccessful()); - PassIf(document3->GetLightLibrary()->GetEntityCount() == 1); - FCDLight* light3 = document3->GetLightLibrary()->GetEntity(0); - PassIf(IsEquivalent(light3->GetName(), light->GetName())); - PassIf(light3->GetLightType() == light->GetLightType()); - PassIf(IsEquivalent(light->GetIntensity(), light->GetIntensity())); - -TESTSUITE_END +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" +#include "FCDocument/FCDocument.h" +#include "FCDocument/FCDLibrary.h" +#include "FCDocument/FCDLight.h" +#include "FUtils/FUFile.h" + +TESTSUITE_START(FColladaArchiving) + +TESTSUITE_TEST(0, FileArchiving) + FUErrorSimpleHandler errorHandler; + + // Create a simple document with a sole light inside that we can use to verify I/O. + FUObjectRef document = FCollada::NewTopDocument(); + FCDLight* light = document->GetLightLibrary()->AddEntity(); + light->SetLightType(FCDLight::POINT); + light->SetName(FC("ATestLight")); + light->SetIntensity(0.4f); + + // Save and load this document. + FCollada::SaveDocument(document, FC("./TestOut.dae")); + FUObjectRef document2 = FCollada::NewTopDocument(); + PassIf(FCollada::LoadDocumentFromFile(document2, FC("./TestOut.dae"))); + PassIf(errorHandler.IsSuccessful()); + PassIf(document2->GetLightLibrary()->GetEntityCount() == 1); + FCDLight* light2 = document2->GetLightLibrary()->GetEntity(0); + PassIf(IsEquivalent(light2->GetName(), light->GetName())); + PassIf(light2->GetLightType() == light->GetLightType()); + PassIf(IsEquivalent(light->GetIntensity(), light->GetIntensity())); + + // Read in this document using a FUFile and manually load it in FCollada. + FUFile file1(FC("./TestOut.dae"), FUFile::READ); + size_t dataLength = file1.GetLength(); + uint8* buffer = new uint8[dataLength]; + PassIf(file1.Read(buffer, dataLength)); + file1.Close(); + FUObjectRef document3 = FCollada::NewTopDocument(); + FCollada::LoadDocumentFromMemory(FC("./TestOut.dae"), document3, buffer, dataLength); + PassIf(errorHandler.IsSuccessful()); + PassIf(document3->GetLightLibrary()->GetEntityCount() == 1); + FCDLight* light3 = document3->GetLightLibrary()->GetEntity(0); + PassIf(IsEquivalent(light3->GetName(), light->GetName())); + PassIf(light3->GetLightType() == light->GetLightType()); + PassIf(IsEquivalent(light->GetIntensity(), light->GetIntensity())); + +TESTSUITE_END Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestArchiving.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestController.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestController.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestController.cpp (revision 24259) @@ -1,207 +1,207 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" -#include "FCDocument/FCDocument.h" -#include "FCDocument/FCDSceneNode.h" -#include "FCDocument/FCDSkinController.h" -#include "FCDocument/FCDController.h" -#include "FCDocument/FCDLibrary.h" - -TESTSUITE_START(FCDControllers) - -TESTSUITE_TEST(0, ReduceInfluences) - - // None of the previous tests should be leaving dangling documents. - PassIf(FCollada::GetTopDocumentCount() == 0); - - // Create the COLLADA skin controller. - FUObjectRef document = FCollada::NewTopDocument(); - FCDController* testController = document->GetControllerLibrary()->AddEntity(); - FCDSkinController* skinController = testController->CreateSkinController(); - - // Add some named joints, so we don't need the FCDSceneNode objects. - skinController->AddJoint("Test1"); - skinController->AddJoint("Test2"); - skinController->AddJoint("Test3"); - skinController->AddJoint("Test4"); - skinController->AddJoint("Test5"); - - // Create one vertex with a bunch of influences. - skinController->SetInfluenceCount(1); - FCDSkinControllerVertex* vertex = skinController->GetVertexInfluence(0); - vertex->AddPair(0, 0.20f); - vertex->AddPair(1, 0.40f); - vertex->AddPair(4, 0.10f); - vertex->AddPair(2, 0.12f); - vertex->AddPair(3, 0.18f); - PassIf(vertex->GetPairCount() == 5); - - // A first influence reduction: reduce to 4. - skinController->ReduceInfluences(4); - PassIf(vertex->GetPairCount() == 4); - - // This ensures all the joints checked below are unique. - // simple enough sum test: joint 4 should have been dropped. - uint32 sum = 0; - for (size_t i = 0; i < 4; ++i) sum += vertex->GetPair(i)->jointIndex; - PassIf(sum == 6); - for (size_t i = 0; i < 4; ++i) - { - switch (vertex->GetPair(i)->jointIndex) - { - case 0: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.22222f)); break; - case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.44444f)); break; - case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.13333f)); break; - case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.20000f)); break; - default: FUFail(""); - } - } - - // A second influence reduction: reduce anything below 0.21f. - skinController->ReduceInfluences(4, 0.21f); - PassIf(vertex->GetPairCount() == 2); - sum = 0; - for (size_t i = 0; i < 2; ++i) sum += vertex->GetPair(i)->jointIndex; - PassIf(sum == 1); - for (size_t i = 0; i < 2; ++i) - { - switch (vertex->GetPair(i)->jointIndex) - { - case 0: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 1.0f / 3.0f)); break; - case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 2.0f / 3.0f)); break; - default: FUFail(""); - } - } - - // A third influence reduction: reduce to the most important joint. - skinController->ReduceInfluences(1); - PassIf(vertex->GetPairCount() == 1); - PassIf(vertex->GetPair(0)->jointIndex == 1); - PassIf(IsEquivalent(vertex->GetPair(0)->weight, 1.0f)); - -TESTSUITE_TEST(1, ReduceInfluences_LargestLast) - - // Create the COLLADA skin controller. - FUObjectRef document = FCollada::NewTopDocument(); - FCDController* testController = document->GetControllerLibrary()->AddEntity(); - FCDSkinController* skinController = testController->CreateSkinController(); - - // Add some named joints, so we don't need the FCDSceneNode objects. - skinController->AddJoint("Test1"); - skinController->AddJoint("Test2"); - skinController->AddJoint("Test3"); - skinController->AddJoint("Test4"); - skinController->AddJoint("Test5"); - - // Create one vertex with a bunch of influences. - skinController->SetInfluenceCount(1); - FCDSkinControllerVertex* vertex = skinController->GetVertexInfluence(0); - vertex->AddPair(0, 0.10f); - vertex->AddPair(1, 0.18f); - vertex->AddPair(4, 0.12f); - vertex->AddPair(2, 0.20f); - vertex->AddPair(3, 0.40f); - PassIf(vertex->GetPairCount() == 5); - - // A first influence reduction: reduce to 4. - skinController->ReduceInfluences(4); - PassIf(vertex->GetPairCount() == 4); - - // This ensures all the joints checked below are unique. - // simple enough sum test: joint 0 should have been dropped. - uint32 sum = 0; - for (size_t i = 0; i < 4; ++i) sum += vertex->GetPair(i)->jointIndex; - PassIf(sum == 10); - for (size_t i = 0; i < 4; ++i) - { - switch (vertex->GetPair(i)->jointIndex) - { - case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.22222f)); break; - case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.44444f)); break; - case 4: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.13333f)); break; - case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.20000f)); break; - default: FUFail(""); - } - } - - // A second influence reduction: reduce anything below 0.21f. - skinController->ReduceInfluences(4, 0.21f); - PassIf(vertex->GetPairCount() == 2); - sum = 0; - for (size_t i = 0; i < 2; ++i) sum += vertex->GetPair(i)->jointIndex; - PassIf(sum == 5); - for (size_t i = 0; i < 2; ++i) - { - switch (vertex->GetPair(i)->jointIndex) - { - case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 1.0f / 3.0f)); break; - case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 2.0f / 3.0f)); break; - default: FUFail(""); - } - } - - // A third influence reduction: reduce to the most important joint. - skinController->ReduceInfluences(1); - PassIf(vertex->GetPairCount() == 1); - PassIf(vertex->GetPair(0)->jointIndex == 3); - PassIf(IsEquivalent(vertex->GetPair(0)->weight, 1.0f)); - -TESTSUITE_TEST(2, ReduceInfluence_Bulvan) - - // http://www.feelingsoftware.com/component/option,com_smf/Itemid,86/topic,407.0 - // - // Pair1 - jointIndex = 0 weight = 0.1f - // Pair2 - jointIndex = 1 weight = 0.1f - // Pair3 - jointIndex = 2 weight = 0.3f - // Pair4 - jointIndex = 3 weight = 0.3f - // Pair5 - jointIndex = 4 weight = 0.2f - - // Create the COLLADA skin controller. - FUObjectRef document = FCollada::NewTopDocument(); - FCDController* testController = document->GetControllerLibrary()->AddEntity(); - FCDSkinController* skinController = testController->CreateSkinController(); - - // Add some named joints, so we don't need the FCDSceneNode objects. - skinController->AddJoint("Test1"); - skinController->AddJoint("Test2"); - skinController->AddJoint("Test3"); - skinController->AddJoint("Test4"); - skinController->AddJoint("Test5"); - - // Create one vertex with a bunch of influences. - skinController->SetInfluenceCount(1); - FCDSkinControllerVertex* vertex = skinController->GetVertexInfluence(0); - vertex->AddPair(0, 0.1f); - vertex->AddPair(1, 0.1f); - vertex->AddPair(2, 0.3f); - vertex->AddPair(3, 0.3f); - vertex->AddPair(4, 0.2f); - PassIf(vertex->GetPairCount() == 5); - - // One influence reduction: reduce to 4. - skinController->ReduceInfluences(4); - PassIf(vertex->GetPairCount() == 4); - - uint32 sum = 0; - for (size_t i = 0; i < 4; ++i) sum += vertex->GetPair(i)->jointIndex; - PassIf(sum == 10 || sum == 9); // either 0 or 1 is dropped. - for (size_t i = 0; i < 4; ++i) - { - switch (vertex->GetPair(i)->jointIndex) - { - case 0: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.11111f)); break; - case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.11111f)); break; - case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.33333f)); break; - case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.33333f)); break; - case 4: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.22222f)); break; - default: FUFail(""); - } - } - -TESTSUITE_END +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" +#include "FCDocument/FCDocument.h" +#include "FCDocument/FCDSceneNode.h" +#include "FCDocument/FCDSkinController.h" +#include "FCDocument/FCDController.h" +#include "FCDocument/FCDLibrary.h" + +TESTSUITE_START(FCDControllers) + +TESTSUITE_TEST(0, ReduceInfluences) + + // None of the previous tests should be leaving dangling documents. + PassIf(FCollada::GetTopDocumentCount() == 0); + + // Create the COLLADA skin controller. + FUObjectRef document = FCollada::NewTopDocument(); + FCDController* testController = document->GetControllerLibrary()->AddEntity(); + FCDSkinController* skinController = testController->CreateSkinController(); + + // Add some named joints, so we don't need the FCDSceneNode objects. + skinController->AddJoint("Test1"); + skinController->AddJoint("Test2"); + skinController->AddJoint("Test3"); + skinController->AddJoint("Test4"); + skinController->AddJoint("Test5"); + + // Create one vertex with a bunch of influences. + skinController->SetInfluenceCount(1); + FCDSkinControllerVertex* vertex = skinController->GetVertexInfluence(0); + vertex->AddPair(0, 0.20f); + vertex->AddPair(1, 0.40f); + vertex->AddPair(4, 0.10f); + vertex->AddPair(2, 0.12f); + vertex->AddPair(3, 0.18f); + PassIf(vertex->GetPairCount() == 5); + + // A first influence reduction: reduce to 4. + skinController->ReduceInfluences(4); + PassIf(vertex->GetPairCount() == 4); + + // This ensures all the joints checked below are unique. + // simple enough sum test: joint 4 should have been dropped. + uint32 sum = 0; + for (size_t i = 0; i < 4; ++i) sum += vertex->GetPair(i)->jointIndex; + PassIf(sum == 6); + for (size_t i = 0; i < 4; ++i) + { + switch (vertex->GetPair(i)->jointIndex) + { + case 0: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.22222f)); break; + case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.44444f)); break; + case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.13333f)); break; + case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.20000f)); break; + default: FUFail(""); + } + } + + // A second influence reduction: reduce anything below 0.21f. + skinController->ReduceInfluences(4, 0.21f); + PassIf(vertex->GetPairCount() == 2); + sum = 0; + for (size_t i = 0; i < 2; ++i) sum += vertex->GetPair(i)->jointIndex; + PassIf(sum == 1); + for (size_t i = 0; i < 2; ++i) + { + switch (vertex->GetPair(i)->jointIndex) + { + case 0: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 1.0f / 3.0f)); break; + case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 2.0f / 3.0f)); break; + default: FUFail(""); + } + } + + // A third influence reduction: reduce to the most important joint. + skinController->ReduceInfluences(1); + PassIf(vertex->GetPairCount() == 1); + PassIf(vertex->GetPair(0)->jointIndex == 1); + PassIf(IsEquivalent(vertex->GetPair(0)->weight, 1.0f)); + +TESTSUITE_TEST(1, ReduceInfluences_LargestLast) + + // Create the COLLADA skin controller. + FUObjectRef document = FCollada::NewTopDocument(); + FCDController* testController = document->GetControllerLibrary()->AddEntity(); + FCDSkinController* skinController = testController->CreateSkinController(); + + // Add some named joints, so we don't need the FCDSceneNode objects. + skinController->AddJoint("Test1"); + skinController->AddJoint("Test2"); + skinController->AddJoint("Test3"); + skinController->AddJoint("Test4"); + skinController->AddJoint("Test5"); + + // Create one vertex with a bunch of influences. + skinController->SetInfluenceCount(1); + FCDSkinControllerVertex* vertex = skinController->GetVertexInfluence(0); + vertex->AddPair(0, 0.10f); + vertex->AddPair(1, 0.18f); + vertex->AddPair(4, 0.12f); + vertex->AddPair(2, 0.20f); + vertex->AddPair(3, 0.40f); + PassIf(vertex->GetPairCount() == 5); + + // A first influence reduction: reduce to 4. + skinController->ReduceInfluences(4); + PassIf(vertex->GetPairCount() == 4); + + // This ensures all the joints checked below are unique. + // simple enough sum test: joint 0 should have been dropped. + uint32 sum = 0; + for (size_t i = 0; i < 4; ++i) sum += vertex->GetPair(i)->jointIndex; + PassIf(sum == 10); + for (size_t i = 0; i < 4; ++i) + { + switch (vertex->GetPair(i)->jointIndex) + { + case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.22222f)); break; + case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.44444f)); break; + case 4: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.13333f)); break; + case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.20000f)); break; + default: FUFail(""); + } + } + + // A second influence reduction: reduce anything below 0.21f. + skinController->ReduceInfluences(4, 0.21f); + PassIf(vertex->GetPairCount() == 2); + sum = 0; + for (size_t i = 0; i < 2; ++i) sum += vertex->GetPair(i)->jointIndex; + PassIf(sum == 5); + for (size_t i = 0; i < 2; ++i) + { + switch (vertex->GetPair(i)->jointIndex) + { + case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 1.0f / 3.0f)); break; + case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 2.0f / 3.0f)); break; + default: FUFail(""); + } + } + + // A third influence reduction: reduce to the most important joint. + skinController->ReduceInfluences(1); + PassIf(vertex->GetPairCount() == 1); + PassIf(vertex->GetPair(0)->jointIndex == 3); + PassIf(IsEquivalent(vertex->GetPair(0)->weight, 1.0f)); + +TESTSUITE_TEST(2, ReduceInfluence_Bulvan) + + // http://www.feelingsoftware.com/component/option,com_smf/Itemid,86/topic,407.0 + // + // Pair1 - jointIndex = 0 weight = 0.1f + // Pair2 - jointIndex = 1 weight = 0.1f + // Pair3 - jointIndex = 2 weight = 0.3f + // Pair4 - jointIndex = 3 weight = 0.3f + // Pair5 - jointIndex = 4 weight = 0.2f + + // Create the COLLADA skin controller. + FUObjectRef document = FCollada::NewTopDocument(); + FCDController* testController = document->GetControllerLibrary()->AddEntity(); + FCDSkinController* skinController = testController->CreateSkinController(); + + // Add some named joints, so we don't need the FCDSceneNode objects. + skinController->AddJoint("Test1"); + skinController->AddJoint("Test2"); + skinController->AddJoint("Test3"); + skinController->AddJoint("Test4"); + skinController->AddJoint("Test5"); + + // Create one vertex with a bunch of influences. + skinController->SetInfluenceCount(1); + FCDSkinControllerVertex* vertex = skinController->GetVertexInfluence(0); + vertex->AddPair(0, 0.1f); + vertex->AddPair(1, 0.1f); + vertex->AddPair(2, 0.3f); + vertex->AddPair(3, 0.3f); + vertex->AddPair(4, 0.2f); + PassIf(vertex->GetPairCount() == 5); + + // One influence reduction: reduce to 4. + skinController->ReduceInfluences(4); + PassIf(vertex->GetPairCount() == 4); + + uint32 sum = 0; + for (size_t i = 0; i < 4; ++i) sum += vertex->GetPair(i)->jointIndex; + PassIf(sum == 10 || sum == 9); // either 0 or 1 is dropped. + for (size_t i = 0; i < 4; ++i) + { + switch (vertex->GetPair(i)->jointIndex) + { + case 0: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.11111f)); break; + case 1: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.11111f)); break; + case 2: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.33333f)); break; + case 3: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.33333f)); break; + case 4: PassIf(IsEquivalent(vertex->GetPair(i)->weight, 0.22222f)); break; + default: FUFail(""); + } + } + +TESTSUITE_END Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestController.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp (revision 24259) @@ -1,102 +1,102 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" -#include "FCDocument/FCDocument.h" -#include "FCDocument/FCDLibrary.h" -#include "FCDocument/FCDGeometry.h" -#include "FCDocument/FCDGeometryMesh.h" -#include "FCDocument/FCDGeometryPolygons.h" -#include "FCDocument/FCDGeometryPolygonsInput.h" -#include "FCDocument/FCDGeometryPolygonsTools.h" - -TESTSUITE_START(FCDGeometryPolygonsTools) - -TESTSUITE_TEST(0, FitIndexBuffers) - FUErrorSimpleHandler errorHandler; - - // Import of the Eagle sample and retrieve its mesh. - FUObjectRef document = FCollada::NewTopDocument(); - PassIf(FCollada::LoadDocumentFromFile(document, FC("Eagle.DAE"))); - PassIf(errorHandler.IsSuccessful()); - FailIf(document->GetGeometryLibrary()->GetEntityCount() == 0); - FCDGeometry* geometry = document->GetGeometryLibrary()->GetEntity(0); - FailIf(geometry == NULL || !geometry->IsMesh()); - FCDGeometryMesh* mesh = geometry->GetMesh(); - FailIf(mesh == NULL); - PassIf(mesh->GetPolygonsCount() == 1); - size_t originalInputCount = mesh->GetPolygons(0)->GetInputCount(); - PassIf(originalInputCount > 0); - FCDGeometryPolygonsTools::FitIndexBuffers(mesh, 90); - - // Verify the output. - PassIf(mesh->GetPolygonsCount() == 3); - size_t expectedCounts[3] = { 90, 90, 72 }; - for (size_t i = 0; i < 3; ++i) - { - FCDGeometryPolygons* p = mesh->GetPolygons(i); - PassIf(p->GetFaceVertexCount() == expectedCounts[i]); - size_t inputCount = p->GetInputCount(); - PassIf(originalInputCount == inputCount); // Make sure no inputs were lost. - for (size_t k = 0; k < inputCount; ++k) - { - FCDGeometryPolygonsInput* input = p->GetInput(k); - PassIf(input->GetIndexCount() == expectedCounts[i]); - } - } - -TESTSUITE_TEST(1, GenerateUniqueIndices) - FUErrorSimpleHandler errorHandler; - - // Import of the Eagle sample and retrieve its mesh. - FUObjectRef document = FCollada::NewTopDocument(); - PassIf(FCollada::LoadDocumentFromFile(document, FC("Eagle.DAE"))); - PassIf(errorHandler.IsSuccessful()); - - FailIf(document->GetGeometryLibrary()->GetEntityCount() == 0); - FCDGeometry* geometry = document->GetGeometryLibrary()->GetEntity(0); - FailIf(geometry == NULL || !geometry->IsMesh()); - - FCDGeometryMesh* mesh = geometry->GetMesh(); - FailIf(mesh == NULL); - PassIf(mesh->GetPolygonsCount() == 1); - - FCDGeometryPolygons* polygons = mesh->GetPolygons(0); - FailIf(polygons == NULL); - - PassIf(polygons->GetInputCount() == 2); - uint32* vertexList = polygons->GetInput(0)->GetIndices(); - uint32* normalList = polygons->GetInput(1)->GetIndices(); - size_t vertexIndexCount = polygons->GetInput(0)->GetIndexCount(); - size_t normalIndexCount = polygons->GetInput(1)->GetIndexCount(); - FailIf(vertexIndexCount != normalIndexCount); - - // pass if there's at least one different index - bool found = false; - for (size_t i = 0; i < normalIndexCount; i++) - { - if (vertexList[i] != normalList[i]) - { - found = true; - break; - } - } - PassIf(found); - - FCDGeometryIndexTranslationMap translationMap; - FCDGeometryPolygonsTools::GenerateUniqueIndices(mesh, NULL, &translationMap); - - PassIf(polygons->GetInputCount() == 2); - uint32* newVertexList = polygons->GetInput(0)->GetIndices(); - uint32* newNormalList = polygons->GetInput(1)->GetIndices(); - size_t newVertexIndexCount = polygons->GetInput(0)->GetIndexCount(); - size_t newNormalIndexCount = polygons->GetInput(1)->GetIndexCount(); - PassIf(newVertexIndexCount == newNormalIndexCount); - PassIf(newVertexList == newNormalList); - -TESTSUITE_END +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" +#include "FCDocument/FCDocument.h" +#include "FCDocument/FCDLibrary.h" +#include "FCDocument/FCDGeometry.h" +#include "FCDocument/FCDGeometryMesh.h" +#include "FCDocument/FCDGeometryPolygons.h" +#include "FCDocument/FCDGeometryPolygonsInput.h" +#include "FCDocument/FCDGeometryPolygonsTools.h" + +TESTSUITE_START(FCDGeometryPolygonsTools) + +TESTSUITE_TEST(0, FitIndexBuffers) + FUErrorSimpleHandler errorHandler; + + // Import of the Eagle sample and retrieve its mesh. + FUObjectRef document = FCollada::NewTopDocument(); + PassIf(FCollada::LoadDocumentFromFile(document, FC("Eagle.DAE"))); + PassIf(errorHandler.IsSuccessful()); + FailIf(document->GetGeometryLibrary()->GetEntityCount() == 0); + FCDGeometry* geometry = document->GetGeometryLibrary()->GetEntity(0); + FailIf(geometry == NULL || !geometry->IsMesh()); + FCDGeometryMesh* mesh = geometry->GetMesh(); + FailIf(mesh == NULL); + PassIf(mesh->GetPolygonsCount() == 1); + size_t originalInputCount = mesh->GetPolygons(0)->GetInputCount(); + PassIf(originalInputCount > 0); + FCDGeometryPolygonsTools::FitIndexBuffers(mesh, 90); + + // Verify the output. + PassIf(mesh->GetPolygonsCount() == 3); + size_t expectedCounts[3] = { 90, 90, 72 }; + for (size_t i = 0; i < 3; ++i) + { + FCDGeometryPolygons* p = mesh->GetPolygons(i); + PassIf(p->GetFaceVertexCount() == expectedCounts[i]); + size_t inputCount = p->GetInputCount(); + PassIf(originalInputCount == inputCount); // Make sure no inputs were lost. + for (size_t k = 0; k < inputCount; ++k) + { + FCDGeometryPolygonsInput* input = p->GetInput(k); + PassIf(input->GetIndexCount() == expectedCounts[i]); + } + } + +TESTSUITE_TEST(1, GenerateUniqueIndices) + FUErrorSimpleHandler errorHandler; + + // Import of the Eagle sample and retrieve its mesh. + FUObjectRef document = FCollada::NewTopDocument(); + PassIf(FCollada::LoadDocumentFromFile(document, FC("Eagle.DAE"))); + PassIf(errorHandler.IsSuccessful()); + + FailIf(document->GetGeometryLibrary()->GetEntityCount() == 0); + FCDGeometry* geometry = document->GetGeometryLibrary()->GetEntity(0); + FailIf(geometry == NULL || !geometry->IsMesh()); + + FCDGeometryMesh* mesh = geometry->GetMesh(); + FailIf(mesh == NULL); + PassIf(mesh->GetPolygonsCount() == 1); + + FCDGeometryPolygons* polygons = mesh->GetPolygons(0); + FailIf(polygons == NULL); + + PassIf(polygons->GetInputCount() == 2); + uint32* vertexList = polygons->GetInput(0)->GetIndices(); + uint32* normalList = polygons->GetInput(1)->GetIndices(); + size_t vertexIndexCount = polygons->GetInput(0)->GetIndexCount(); + size_t normalIndexCount = polygons->GetInput(1)->GetIndexCount(); + FailIf(vertexIndexCount != normalIndexCount); + + // pass if there's at least one different index + bool found = false; + for (size_t i = 0; i < normalIndexCount; i++) + { + if (vertexList[i] != normalList[i]) + { + found = true; + break; + } + } + PassIf(found); + + FCDGeometryIndexTranslationMap translationMap; + FCDGeometryPolygonsTools::GenerateUniqueIndices(mesh, NULL, &translationMap); + + PassIf(polygons->GetInputCount() == 2); + uint32* newVertexList = polygons->GetInput(0)->GetIndices(); + uint32* newNormalList = polygons->GetInput(1)->GetIndices(); + size_t newVertexIndexCount = polygons->GetInput(0)->GetIndexCount(); + size_t newNormalIndexCount = polygons->GetInput(1)->GetIndexCount(); + PassIf(newVertexIndexCount == newNormalIndexCount); + PassIf(newVertexList == newNormalList); + +TESTSUITE_END Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestParameters.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestParameters.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestParameters.cpp (revision 24259) @@ -1,204 +1,204 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" -#include "FUtils/FUParameter.h" -#include "FCDocument/FCDocument.h" -#include "FCDocument/FCDAnimated.h" -#include "FCDocument/FCDAnimation.h" -#include "FCDocument/FCDAnimationChannel.h" -#include "FCDocument/FCDAnimationCurve.h" -#include "FCDocument/FCDEntity.h" -#include "FCDocument/FCDLibrary.h" -#include "FCDocument/FCDParameterAnimatable.h" - -class FCTestOutsideParameter : public FCDObject -{ -public: - DeclareParameter(float, FUParameterQualifiers::SIMPLE, test1, FC("A large parameter name!")); - DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::VECTOR, test2, FC("An animatable parameter")); - DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::COLOR, test3, FC("A complex animatable parameter")); - DeclareParameterPtr(FCDObject, test4, FC("A simple object pointer")); - DeclareParameterRef(FCDObject, test5, FC("An object reference!")); - DeclareParameterList(Float, test6, FC("A float list parameter.")); - DeclareParameterTrackList(FCDObject, test7, FC("An object tracker list.")); - DeclareParameterContainer(FCDObject, test8, FC("An object container.")); - DeclareParameterListAnimatable(FMVector3, FUParameterQualifiers::COLOR, test9, FC("An animatable color list.")); - - FCTestOutsideParameter(FCDocument* document) - : FCDObject(document) - , InitializeParameter(test1, 0.0f) - , InitializeParameterAnimatableNoArg(test2) - , InitializeParameterAnimatable(test3, FMVector3::XAxis) - , InitializeParameter(test4, NULL) - , InitializeParameterNoArg(test5) - , InitializeParameterNoArg(test6) - , InitializeParameterNoArg(test7) - , InitializeParameterNoArg(test8) - , InitializeParameterAnimatableNoArg(test9) - {} - - virtual ~FCTestOutsideParameter() {} -}; - -ImplementParameterObject(FCTestOutsideParameter, FCDObject, test4, new FCDObject(parent->GetDocument())); -ImplementParameterObject(FCTestOutsideParameter, FCDObject, test5, new FCDObject(parent->GetDocument())); -ImplementParameterObject(FCTestOutsideParameter, FCDObject, test7, new FCDObject(parent->GetDocument())); -ImplementParameterObject(FCTestOutsideParameter, FCDObject, test8, new FCDObject(parent->GetDocument())); - -TESTSUITE_START(FCDParameter) - -TESTSUITE_TEST(0, Simple) - FUObjectRef document = FCollada::NewTopDocument(); - FUObjectRef entity = new FCDEntity(document); - entity->SetNote(FC("Noting down.")); - PassIf(IsEquivalent(entity->GetNote(), FC("Noting down."))); - -TESTSUITE_TEST(1, Functionality) - FUObjectRef document = FCollada::NewTopDocument(); - FUObjectRef parameter = new FCTestOutsideParameter(document); - - // Simple float parameter - PassIf(parameter->test1 == 0.0f); - parameter->test1 = 2.1f; - PassIf(parameter->test1 == 2.1f); - - // Animatable 3D vector parameter. - parameter->test2 = FMVector3::One; - PassIf(parameter->test2 == FMVector3::One); - PassIf(parameter->test2 - FMVector3::One == FMVector3::Zero); - PassIf(parameter->test2.GetAnimated() != NULL); - PassIf(parameter->test2.GetAnimated()->GetValueCount() == 3); - - // Object parameters - parameter->test4 = parameter->test5; - PassIf(parameter->test4 == parameter->test5); - parameter->test5 = NULL; - PassIf(parameter->test5 == NULL); - parameter->test4 = new FCDObject(document); - PassIf(parameter->test4 != NULL); - PassIf(parameter->test4->GetTrackerCount() == 1); - parameter->test5 = parameter->test4; - PassIf(parameter->test5 != NULL); - PassIf(parameter->test5->GetTrackerCount() == 1); - parameter->test5 = NULL; - PassIf(parameter->test4 == NULL); - - // Primitive list parameter - size_t count = parameter->test6.size(); - PassIf(count == 0 && parameter->test6.empty()); - parameter->test6.push_back(0.52f); - PassIf(parameter->test6.size() == 1); - parameter->test6.clear(); - PassIf(parameter->test6.size() == 0); - parameter->test6.push_back(0.45f); - PassIf(parameter->test6.size() == 1); - parameter->test6.erase(0, 1); - PassIf(parameter->test6.size() == 0); - - // Tracked object list parameter - FUTrackedPtr testObject = new FCDObject(document); - count = parameter->test7.size(); - PassIf(count == 0 && parameter->test7.empty()); - parameter->test7.push_back(testObject); - PassIf(parameter->test7.size() == 1); - parameter->test7.clear(); - PassIf(testObject != NULL); - PassIf(parameter->test7.size() == 0); - parameter->test7.push_back(testObject); - PassIf(parameter->test7.size() == 1); - parameter->test7.erase(0, 1); - PassIf(parameter->test7.size() == 0); - testObject->Release(); - PassIf(testObject == NULL); - - // Object container parameter - testObject = new FCDObject(document); - count = parameter->test8.size(); - PassIf(count == 0 && parameter->test8.empty()); - parameter->test8.push_back(testObject); - PassIf(parameter->test8.size() == 1); - parameter->test8.clear(); - PassIf(testObject == NULL); // this is a container, so testObject should have been released! - PassIf(parameter->test8.size() == 0); - parameter->test8.push_back(new FCDObject(document)); - PassIf(parameter->test8.size() == 1); - parameter->test8.erase(0, 1); - PassIf(parameter->test8.size() == 0); - -TESTSUITE_TEST(2, AnimatedListParameter) - FUObjectRef document = FCollada::NewTopDocument(); - FUObjectRef parameter = new FCTestOutsideParameter(document); - FCDAnimation* animation = document->GetAnimationLibrary()->AddEntity(); - FCDAnimationChannel* channel = animation->AddChannel(); - - // Animated list parameter. - // Simple operations -#define TESTP parameter->test9 - PassIf(TESTP.size() == 0); - TESTP.push_back(FMVector3::XAxis); - TESTP.push_back(FMVector3::YAxis); - TESTP.push_back(FMVector3::ZAxis); - PassIf(TESTP.size() == 3); - FailIf(TESTP.IsAnimated()); - FailIf(TESTP.IsAnimated(0)); - PassIf(TESTP.GetAnimatedValues().empty()); - PassIf(TESTP.GetAnimated(2) != NULL); - FailIf(TESTP.GetAnimatedValues().empty()); - FailIf(TESTP.IsAnimated(2)); - TESTP.push_front(FMVector3::XAxis); - TESTP.push_front(FMVector3::YAxis); - TESTP.push_front(FMVector3::ZAxis); - PassIf(TESTP.GetAnimated(2) != NULL); - PassIf(TESTP.at(1) == FMVector3::YAxis); - PassIf(TESTP.at(4) == FMVector3::YAxis); - PassIf(!TESTP.IsAnimated(5)); - PassIf(!TESTP.IsAnimated(4)); - PassIf(TESTP.GetAnimated(2)->GetArrayElement() == 2); - - // List insertion tests. - TESTP.GetAnimated(2)->AddCurve(0, channel->AddCurve()); - PassIf(TESTP.IsAnimated()); - PassIf(TESTP.IsAnimated(2)); - PassIf(!TESTP.IsAnimated(1)); - PassIf(!TESTP.IsAnimated(3)); - TESTP.insert(2, FMVector3::XAxis); // should move the curve up to index 3! - PassIf(TESTP.IsAnimated(3)); - PassIf(!TESTP.IsAnimated(2)); - PassIf(!TESTP.IsAnimated(4)); - PassIf(TESTP.GetAnimated(3)->GetArrayElement() == 3); - TESTP.insert(5, FMVector3::YAxis); // no movement of the curve. - PassIf(TESTP.IsAnimated(3)); - PassIf(!TESTP.IsAnimated(2)); - PassIf(!TESTP.IsAnimated(4)); - PassIf(TESTP.GetAnimated(4)->GetArrayElement() == 4); - - // List removal tests. - TESTP.erase(0); // should move the curve back to index 2. - PassIf(TESTP.IsAnimated(2)); - PassIf(!TESTP.IsAnimated(1)); - PassIf(!TESTP.IsAnimated(3)); - PassIf(TESTP.GetAnimated(2)->GetArrayElement() == 2); - TESTP.erase(0, 4); // nothing should be animated anymore. - FailIf(TESTP.IsAnimated()); - - // List resizing tests. - TESTP.clear(); - FailIf(TESTP.IsAnimated()); - TESTP.resize(4); - FailIf(TESTP.IsAnimated()); - TESTP.GetAnimated(1)->AddCurve(0, channel->AddCurve()); - PassIf(TESTP.IsAnimated()); - PassIf(TESTP.IsAnimated(1)); - TESTP.resize(6); - PassIf(TESTP.IsAnimated()); - PassIf(TESTP.IsAnimated(1)); - TESTP.resize(1); - FailIf(TESTP.IsAnimated()); - -TESTSUITE_END +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" +#include "FUtils/FUParameter.h" +#include "FCDocument/FCDocument.h" +#include "FCDocument/FCDAnimated.h" +#include "FCDocument/FCDAnimation.h" +#include "FCDocument/FCDAnimationChannel.h" +#include "FCDocument/FCDAnimationCurve.h" +#include "FCDocument/FCDEntity.h" +#include "FCDocument/FCDLibrary.h" +#include "FCDocument/FCDParameterAnimatable.h" + +class FCTestOutsideParameter : public FCDObject +{ +public: + DeclareParameter(float, FUParameterQualifiers::SIMPLE, test1, FC("A large parameter name!")); + DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::VECTOR, test2, FC("An animatable parameter")); + DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::COLOR, test3, FC("A complex animatable parameter")); + DeclareParameterPtr(FCDObject, test4, FC("A simple object pointer")); + DeclareParameterRef(FCDObject, test5, FC("An object reference!")); + DeclareParameterList(Float, test6, FC("A float list parameter.")); + DeclareParameterTrackList(FCDObject, test7, FC("An object tracker list.")); + DeclareParameterContainer(FCDObject, test8, FC("An object container.")); + DeclareParameterListAnimatable(FMVector3, FUParameterQualifiers::COLOR, test9, FC("An animatable color list.")); + + FCTestOutsideParameter(FCDocument* document) + : FCDObject(document) + , InitializeParameter(test1, 0.0f) + , InitializeParameterAnimatableNoArg(test2) + , InitializeParameterAnimatable(test3, FMVector3::XAxis) + , InitializeParameter(test4, NULL) + , InitializeParameterNoArg(test5) + , InitializeParameterNoArg(test6) + , InitializeParameterNoArg(test7) + , InitializeParameterNoArg(test8) + , InitializeParameterAnimatableNoArg(test9) + {} + + virtual ~FCTestOutsideParameter() {} +}; + +ImplementParameterObject(FCTestOutsideParameter, FCDObject, test4, new FCDObject(parent->GetDocument())); +ImplementParameterObject(FCTestOutsideParameter, FCDObject, test5, new FCDObject(parent->GetDocument())); +ImplementParameterObject(FCTestOutsideParameter, FCDObject, test7, new FCDObject(parent->GetDocument())); +ImplementParameterObject(FCTestOutsideParameter, FCDObject, test8, new FCDObject(parent->GetDocument())); + +TESTSUITE_START(FCDParameter) + +TESTSUITE_TEST(0, Simple) + FUObjectRef document = FCollada::NewTopDocument(); + FUObjectRef entity = new FCDEntity(document); + entity->SetNote(FC("Noting down.")); + PassIf(IsEquivalent(entity->GetNote(), FC("Noting down."))); + +TESTSUITE_TEST(1, Functionality) + FUObjectRef document = FCollada::NewTopDocument(); + FUObjectRef parameter = new FCTestOutsideParameter(document); + + // Simple float parameter + PassIf(parameter->test1 == 0.0f); + parameter->test1 = 2.1f; + PassIf(parameter->test1 == 2.1f); + + // Animatable 3D vector parameter. + parameter->test2 = FMVector3::One; + PassIf(parameter->test2 == FMVector3::One); + PassIf(parameter->test2 - FMVector3::One == FMVector3::Zero); + PassIf(parameter->test2.GetAnimated() != NULL); + PassIf(parameter->test2.GetAnimated()->GetValueCount() == 3); + + // Object parameters + parameter->test4 = parameter->test5; + PassIf(parameter->test4 == parameter->test5); + parameter->test5 = NULL; + PassIf(parameter->test5 == NULL); + parameter->test4 = new FCDObject(document); + PassIf(parameter->test4 != NULL); + PassIf(parameter->test4->GetTrackerCount() == 1); + parameter->test5 = parameter->test4; + PassIf(parameter->test5 != NULL); + PassIf(parameter->test5->GetTrackerCount() == 1); + parameter->test5 = NULL; + PassIf(parameter->test4 == NULL); + + // Primitive list parameter + size_t count = parameter->test6.size(); + PassIf(count == 0 && parameter->test6.empty()); + parameter->test6.push_back(0.52f); + PassIf(parameter->test6.size() == 1); + parameter->test6.clear(); + PassIf(parameter->test6.size() == 0); + parameter->test6.push_back(0.45f); + PassIf(parameter->test6.size() == 1); + parameter->test6.erase(0, 1); + PassIf(parameter->test6.size() == 0); + + // Tracked object list parameter + FUTrackedPtr testObject = new FCDObject(document); + count = parameter->test7.size(); + PassIf(count == 0 && parameter->test7.empty()); + parameter->test7.push_back(testObject); + PassIf(parameter->test7.size() == 1); + parameter->test7.clear(); + PassIf(testObject != NULL); + PassIf(parameter->test7.size() == 0); + parameter->test7.push_back(testObject); + PassIf(parameter->test7.size() == 1); + parameter->test7.erase(0, 1); + PassIf(parameter->test7.size() == 0); + testObject->Release(); + PassIf(testObject == NULL); + + // Object container parameter + testObject = new FCDObject(document); + count = parameter->test8.size(); + PassIf(count == 0 && parameter->test8.empty()); + parameter->test8.push_back(testObject); + PassIf(parameter->test8.size() == 1); + parameter->test8.clear(); + PassIf(testObject == NULL); // this is a container, so testObject should have been released! + PassIf(parameter->test8.size() == 0); + parameter->test8.push_back(new FCDObject(document)); + PassIf(parameter->test8.size() == 1); + parameter->test8.erase(0, 1); + PassIf(parameter->test8.size() == 0); + +TESTSUITE_TEST(2, AnimatedListParameter) + FUObjectRef document = FCollada::NewTopDocument(); + FUObjectRef parameter = new FCTestOutsideParameter(document); + FCDAnimation* animation = document->GetAnimationLibrary()->AddEntity(); + FCDAnimationChannel* channel = animation->AddChannel(); + + // Animated list parameter. + // Simple operations +#define TESTP parameter->test9 + PassIf(TESTP.size() == 0); + TESTP.push_back(FMVector3::XAxis); + TESTP.push_back(FMVector3::YAxis); + TESTP.push_back(FMVector3::ZAxis); + PassIf(TESTP.size() == 3); + FailIf(TESTP.IsAnimated()); + FailIf(TESTP.IsAnimated(0)); + PassIf(TESTP.GetAnimatedValues().empty()); + PassIf(TESTP.GetAnimated(2) != NULL); + FailIf(TESTP.GetAnimatedValues().empty()); + FailIf(TESTP.IsAnimated(2)); + TESTP.push_front(FMVector3::XAxis); + TESTP.push_front(FMVector3::YAxis); + TESTP.push_front(FMVector3::ZAxis); + PassIf(TESTP.GetAnimated(2) != NULL); + PassIf(TESTP.at(1) == FMVector3::YAxis); + PassIf(TESTP.at(4) == FMVector3::YAxis); + PassIf(!TESTP.IsAnimated(5)); + PassIf(!TESTP.IsAnimated(4)); + PassIf(TESTP.GetAnimated(2)->GetArrayElement() == 2); + + // List insertion tests. + TESTP.GetAnimated(2)->AddCurve(0, channel->AddCurve()); + PassIf(TESTP.IsAnimated()); + PassIf(TESTP.IsAnimated(2)); + PassIf(!TESTP.IsAnimated(1)); + PassIf(!TESTP.IsAnimated(3)); + TESTP.insert(2, FMVector3::XAxis); // should move the curve up to index 3! + PassIf(TESTP.IsAnimated(3)); + PassIf(!TESTP.IsAnimated(2)); + PassIf(!TESTP.IsAnimated(4)); + PassIf(TESTP.GetAnimated(3)->GetArrayElement() == 3); + TESTP.insert(5, FMVector3::YAxis); // no movement of the curve. + PassIf(TESTP.IsAnimated(3)); + PassIf(!TESTP.IsAnimated(2)); + PassIf(!TESTP.IsAnimated(4)); + PassIf(TESTP.GetAnimated(4)->GetArrayElement() == 4); + + // List removal tests. + TESTP.erase(0); // should move the curve back to index 2. + PassIf(TESTP.IsAnimated(2)); + PassIf(!TESTP.IsAnimated(1)); + PassIf(!TESTP.IsAnimated(3)); + PassIf(TESTP.GetAnimated(2)->GetArrayElement() == 2); + TESTP.erase(0, 4); // nothing should be animated anymore. + FailIf(TESTP.IsAnimated()); + + // List resizing tests. + TESTP.clear(); + FailIf(TESTP.IsAnimated()); + TESTP.resize(4); + FailIf(TESTP.IsAnimated()); + TESTP.GetAnimated(1)->AddCurve(0, channel->AddCurve()); + PassIf(TESTP.IsAnimated()); + PassIf(TESTP.IsAnimated(1)); + TESTP.resize(6); + PassIf(TESTP.IsAnimated()); + PassIf(TESTP.IsAnimated(1)); + TESTP.resize(1); + FailIf(TESTP.IsAnimated()); + +TESTSUITE_END Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestParameters.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestSceneGraph.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestSceneGraph.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestSceneGraph.cpp (revision 24259) @@ -1,80 +1,80 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" -#include "FCDocument/FCDocument.h" -#include "FCDocument/FCDSceneNode.h" -#include "FCDocument/FCDSceneNodeIterator.h" - -TESTSUITE_START(FCDSceneNode) - -TESTSUITE_TEST(0, Iterator) - - // None of the previous tests should be leaving dangling documents. - PassIf(FCollada::GetTopDocumentCount() == 0); - - FUObjectRef doc = FCollada::NewTopDocument(); - FCDSceneNode* top = doc->AddVisualScene(); - FCDSceneNode* second = top->AddChildNode(); - FCDSceneNode* third = doc->AddVisualScene(); - second->AddInstance(third); - - // Check the standard iterator, in breadth-first mode - FCDSceneNodeIterator it1(top, FCDSceneNodeIterator::BREADTH_FIRST); - PassIf(!it1.IsDone()); - PassIf((*it1) == top); - ++it1; - PassIf(!it1.IsDone()); - PassIf((*it1) == second); - ++it1; - PassIf(!it1.IsDone()); - PassIf(it1.GetNode() == third); - ++it1; - PassIf(it1.IsDone()); - - // Check the const iterator, in breadth-first mode - FCDSceneNodeConstIterator it2(top, FCDSceneNodeConstIterator::BREADTH_FIRST); - PassIf(!it2.IsDone()); - PassIf((*it2) == top); - ++it2; - PassIf(!it2.IsDone()); - PassIf((*it2) == second); - ++it2; - PassIf(!it2.IsDone()); - PassIf(it2.GetNode() == third); - ++it2; - PassIf(it2.IsDone()); - - // Check the standard iterator, in depth-first mode - FCDSceneNodeIterator it3(top, FCDSceneNodeIterator::DEPTH_FIRST_POSTORDER); - PassIf(!it3.IsDone()); - PassIf((*it3) == third); - ++it3; - PassIf(!it3.IsDone()); - PassIf((*it3) == second); - ++it3; - PassIf(!it3.IsDone()); - PassIf(it3.GetNode() == top); - ++it3; - PassIf(it3.IsDone()); - - // Check the const iterator, in depth-first mode - FCDSceneNodeConstIterator it4(top, FCDSceneNodeConstIterator::DEPTH_FIRST_POSTORDER); - PassIf(!it4.IsDone()); - PassIf((*it4) == third); - ++it4; - PassIf(!it4.IsDone()); - PassIf((*it4) == second); - ++it4; - PassIf(!it4.IsDone()); - PassIf(it4.GetNode() == top); - ++it4; - PassIf(it4.IsDone()); - -TESTSUITE_END - +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" +#include "FCDocument/FCDocument.h" +#include "FCDocument/FCDSceneNode.h" +#include "FCDocument/FCDSceneNodeIterator.h" + +TESTSUITE_START(FCDSceneNode) + +TESTSUITE_TEST(0, Iterator) + + // None of the previous tests should be leaving dangling documents. + PassIf(FCollada::GetTopDocumentCount() == 0); + + FUObjectRef doc = FCollada::NewTopDocument(); + FCDSceneNode* top = doc->AddVisualScene(); + FCDSceneNode* second = top->AddChildNode(); + FCDSceneNode* third = doc->AddVisualScene(); + second->AddInstance(third); + + // Check the standard iterator, in breadth-first mode + FCDSceneNodeIterator it1(top, FCDSceneNodeIterator::BREADTH_FIRST); + PassIf(!it1.IsDone()); + PassIf((*it1) == top); + ++it1; + PassIf(!it1.IsDone()); + PassIf((*it1) == second); + ++it1; + PassIf(!it1.IsDone()); + PassIf(it1.GetNode() == third); + ++it1; + PassIf(it1.IsDone()); + + // Check the const iterator, in breadth-first mode + FCDSceneNodeConstIterator it2(top, FCDSceneNodeConstIterator::BREADTH_FIRST); + PassIf(!it2.IsDone()); + PassIf((*it2) == top); + ++it2; + PassIf(!it2.IsDone()); + PassIf((*it2) == second); + ++it2; + PassIf(!it2.IsDone()); + PassIf(it2.GetNode() == third); + ++it2; + PassIf(it2.IsDone()); + + // Check the standard iterator, in depth-first mode + FCDSceneNodeIterator it3(top, FCDSceneNodeIterator::DEPTH_FIRST_POSTORDER); + PassIf(!it3.IsDone()); + PassIf((*it3) == third); + ++it3; + PassIf(!it3.IsDone()); + PassIf((*it3) == second); + ++it3; + PassIf(!it3.IsDone()); + PassIf(it3.GetNode() == top); + ++it3; + PassIf(it3.IsDone()); + + // Check the const iterator, in depth-first mode + FCDSceneNodeConstIterator it4(top, FCDSceneNodeConstIterator::DEPTH_FIRST_POSTORDER); + PassIf(!it4.IsDone()); + PassIf((*it4) == third); + ++it4; + PassIf(!it4.IsDone()); + PassIf((*it4) == second); + ++it4; + PassIf(!it4.IsDone()); + PassIf(it4.GetNode() == top); + ++it4; + PassIf(it4.IsDone()); + +TESTSUITE_END + Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FCTestSceneGraph.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FColladaTest.vcproj =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FColladaTest.vcproj (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FColladaTest.vcproj (revision 24259) @@ -1,814 +1,814 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/FColladaTest.vcproj ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/Sconscript =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/Sconscript (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/Sconscript (revision 24259) @@ -1,35 +1,35 @@ -#Sconscript for FColladaTest executable for Linux -sconscriptRelativePath = "../../.." -execfile(sconscriptRelativePath + "/../../SconsCommon.py") - -#Create the Environment which creates the compile and linker command lines. -env = Environment() - -#Add the compiler and linker flags and include search path -env.Append(CPPPATH = [sconscriptRelativePath, sconscriptRelativePath + "/..", sconscriptRelativePath + "/../LibXML/include/"]) - -#Add the macros defined for all the builds -env.Append(CPPDEFINES = ['LINUX', '_DEBUG']) -env.Append(CCFLAGS = ['-O0', '-g', '-W', '-Wall']) - -#Unicode is pre-requisite to building the test for FCollada. -env.Append(CPPDEFINES = ['UNICODE']) - -#Make a list of the library to link with first and where to find it. -libs = ['FColladaSUD', 'dl'] - -#List the source file to compile into the executable. -list = [] -FileListAppend(list, sconscriptRelativePath, "FCTestExportImport", "cpp") -FileListAppend(list, sconscriptRelativePath, "FCTestXRef", "cpp") -FileListAppend(list, sconscriptRelativePath, "FCTestAssetManagement", "cpp") -FileListAppend(list, sconscriptRelativePath, "", "cpp") - -path = [sconscriptRelativePath + "/../Output"] - -#Finally, create the executable. -FColladaTest = env.Program('FColladaTest', list, LIBS=libs, LIBPATH=path) - -#Specifying the name and directory of output executable -env.InstallAs(sconscriptRelativePath, FColladaTest) - +#Sconscript for FColladaTest executable for Linux +sconscriptRelativePath = "../../.." +execfile(sconscriptRelativePath + "/../../SconsCommon.py") + +#Create the Environment which creates the compile and linker command lines. +env = Environment() + +#Add the compiler and linker flags and include search path +env.Append(CPPPATH = [sconscriptRelativePath, sconscriptRelativePath + "/..", sconscriptRelativePath + "/../LibXML/include/"]) + +#Add the macros defined for all the builds +env.Append(CPPDEFINES = ['LINUX', '_DEBUG']) +env.Append(CCFLAGS = ['-O0', '-g', '-W', '-Wall']) + +#Unicode is pre-requisite to building the test for FCollada. +env.Append(CPPDEFINES = ['UNICODE']) + +#Make a list of the library to link with first and where to find it. +libs = ['FColladaSUD', 'dl'] + +#List the source file to compile into the executable. +list = [] +FileListAppend(list, sconscriptRelativePath, "FCTestExportImport", "cpp") +FileListAppend(list, sconscriptRelativePath, "FCTestXRef", "cpp") +FileListAppend(list, sconscriptRelativePath, "FCTestAssetManagement", "cpp") +FileListAppend(list, sconscriptRelativePath, "", "cpp") + +path = [sconscriptRelativePath + "/../Output"] + +#Finally, create the executable. +FColladaTest = env.Program('FColladaTest', list, LIBS=libs, LIBPATH=path) + +#Specifying the name and directory of output executable +env.InstallAs(sconscriptRelativePath, FColladaTest) + Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/Sconscript ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.cpp =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.cpp (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.cpp (revision 24259) @@ -1,10 +1,10 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#include "StdAfx.h" - +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#include "StdAfx.h" + Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.h =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.h (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.h (revision 24259) @@ -1,17 +1,17 @@ -/* - Copyright (C) 2005-2007 Feeling Software Inc. - Portions of the code are: - Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef _STDAFX_H_ -#define _STDAFX_H_ - -// FCollada -#include "FCollada.h" -#include "FUtils/FUAssert.h" -#include "FUtils/FUTestBed.h" - -#endif // _STDAFX_H_ +/* + Copyright (C) 2005-2007 Feeling Software Inc. + Portions of the code are: + Copyright (C) 2005-2007 Sony Computer Entertainment America + + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef _STDAFX_H_ +#define _STDAFX_H_ + +// FCollada +#include "FCollada.h" +#include "FUtils/FUAssert.h" +#include "FUtils/FUTestBed.h" + +#endif // _STDAFX_H_ Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest/StdAfx.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest =================================================================== --- ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest (revision 24258) +++ ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest (revision 24259) Property changes on: ps/trunk/libraries/source/fcollada/src/FCollada/FColladaTest ___________________________________________________________________ Added: svn:global-ignores ## -0,0 +1 ## +Output