Exemplo n.º 1
0
int main(int argc, const char* argv[], char* envp[])
{
#ifdef WIN32
	_environ = envp;
#else //LINUX
	environ = envp;
#endif //WIN32 and LINUX
	if (argc != 3)
	{
		std::cout << "Expecting two arguments:" << std::endl;
		std::cout << "FCExport.exe <input_filename> <output_filename>" <<std::endl;
		exit(-1);
	}

	fstring inputFilename = TO_FSTRING(argv[1]);
	fstring outputFilename = TO_FSTRING(argv[2]);

	// Create an empty COLLADA document and import the given file.
	FCollada::Initialize();
	FCDocument* document = FCollada::NewTopDocument();
	FUErrorSimpleHandler errorHandler;
	FCollada::LoadDocumentFromFile(document, inputFilename.c_str());
	if (errorHandler.IsSuccessful())
	{
		// Write out the COLLADA document.
		std::cout << "Exporting: ";
		FCollada::SaveDocument(document, outputFilename.c_str());
		if (errorHandler.IsSuccessful())
		{
			std::cout << "Done." << std::endl;
		}
		else
		{
			std::cout << errorHandler.GetErrorString();
			std::cout << std::endl << std::endl;
		}
	}
	else
	{
		std::cout << errorHandler.GetErrorString();
		std::cout << std::endl << std::endl;
	}

	SAFE_DELETE(document);
	FCollada::Release();
	return 0;
}
Exemplo n.º 2
0
	// Write out the document.
	FCollada::SaveDocument(doc, FC("TestOut.dae"));

	// Check the dae id that were automatically generated: they should be unique
	FailIf(sceneNode1->GetDaeId() == sceneNode2->GetDaeId());
	FailIf(sceneNode1->GetDaeId() == sceneNode3->GetDaeId());
	FailIf(sceneNode2->GetDaeId() == sceneNode3->GetDaeId());
	sceneNode1Id = sceneNode1->GetDaeId();
	sceneNode2Id = sceneNode2->GetDaeId();
	sceneNode3Id = sceneNode3->GetDaeId();
	SAFE_RELEASE(doc);

TESTSUITE_TEST(1, Reimport)
	// Import back this document
	FUErrorSimpleHandler errorHandler;
	FCDocument* idoc = FCollada::NewTopDocument();
	PassIf(FCollada::LoadDocumentFromFile(idoc, FC("TestOut.dae")));
	PassIf(idoc != NULL);
	
#ifdef _WIN32
	OutputDebugStringA(errorHandler.GetErrorString());
#endif
	PassIf(errorHandler.IsSuccessful());

	// Verify that all the data we pushed is still available
	// Note that visual scenes may be added by other tests: such as for joints.
	FCDVisualSceneNodeLibrary* vsl = idoc->GetVisualSceneLibrary();
	PassIf(vsl->GetEntityCount() >= 3);

	// Verify that the visual scene ids are unique.
Exemplo n.º 3
0
#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<FCDocument> 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());
Exemplo n.º 4
0
int main(int argc, const char* argv[], char* envp[])
{
#ifdef WIN32
	_environ = envp;
#else //LINUX
	environ = envp;
#endif //WIN32 and LINUX
	if (argc != 3)
	{
		std::cout << "Expecting two arguments:" << std::endl;
		std::cout << "FCProcessImages.exe <input_filename> <output_filename>" <<std::endl;
		exit(-1);
	}

	fstring inputFilename = TO_FSTRING(argv[1]);
	fstring outputFilename = TO_FSTRING(argv[2]);

	// Create an empty COLLADA document and import the given file.
	FCollada::Initialize();
	FUErrorSimpleHandler errorHandler;
	FCDocument* document = FCollada::NewTopDocument();
	FCollada::LoadDocumentFromFile(document, inputFilename.c_str());
	std::cout << argv[1] << std::endl;
	if (errorHandler.IsSuccessful())
	{
		std::cout << "Import: Done." << std::endl;

		// Initialize DevIL.
		ilInit();
		iluInit();

		// Process the image library
		ProcessImageLibrary(document->GetImageLibrary());

		// Shutdown DevIL
		ilShutDown();

		// It is common practice for tools to add a new contributor to identify that they were run
		// on a COLLADA document.
		FCDAssetContributor* contributor = document->GetAsset()->AddContributor();
		const char* userName = getenv("USER");
		if (userName == NULL) userName = getenv("USERNAME");
		if (userName != NULL) contributor->SetAuthor(TO_FSTRING(userName));
		contributor->SetSourceData(inputFilename);
		char authoringTool[1024];
		snprintf(authoringTool, 1024, "FCProcessImages sample for FCollada v%d.%02d", FCOLLADA_VERSION >> 16, FCOLLADA_VERSION & 0xFFFF);
		authoringTool[1023] = 0;
		contributor->SetAuthoringTool(TO_FSTRING((const char*)authoringTool));

		// Write out the processed COLLADA document.
		FCollada::SaveDocument(document, outputFilename.c_str());
		if (errorHandler.IsSuccessful())
		{
			std::cout << "Export: Done." << std::endl;
		}
		else
		{
			std::cout << errorHandler.GetErrorString();
			std::cout << std::endl << std::endl;
		}
	}