moved files around
This commit is contained in:
24
Extras/FCollada/FColladaTest/FCTest.cpp
Normal file
24
Extras/FCollada/FColladaTest/FCTest.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2005-2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include <direct.h>
|
||||
|
||||
int _tmain(int UNUSED(argc), TCHAR* UNUSED(argv)[])
|
||||
{
|
||||
// Set the current folder to the folder with the samples DAE files
|
||||
chdir("Samples\\");
|
||||
|
||||
// First, declare all the test functions.
|
||||
#define FCTEST(test_fn) extern void test_fn()
|
||||
#include "FCTestList.h"
|
||||
#undef FCTEST
|
||||
|
||||
// Second, call them one at a time.
|
||||
#define FCTEST(test_fn) test_fn()
|
||||
#include "FCTestList.h"
|
||||
#undef FCTEST
|
||||
}
|
||||
20
Extras/FCollada/FColladaTest/FCTest.h
Normal file
20
Extras/FCollada/FColladaTest/FCTest.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (C) 2005-2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#ifndef _FC_TEST_H_
|
||||
#define _FC_TEST_H_
|
||||
|
||||
inline void PassIf(bool condition)
|
||||
{
|
||||
if (!condition)
|
||||
{
|
||||
FUFail(exit(-1));
|
||||
}
|
||||
}
|
||||
inline void FailIf(bool condition) { return PassIf(!condition); }
|
||||
inline void CheckStatus(const FUStatus& s) { PassIf(s.IsSuccessful()); }
|
||||
|
||||
#endif // _FC_TEST_H_
|
||||
23
Extras/FCollada/FColladaTest/FCTestAnimation.cpp
Normal file
23
Extras/FCollada/FColladaTest/FCTestAnimation.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2005-2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDocument.h"
|
||||
#include "FCDocument/FCDSceneNode.h"
|
||||
|
||||
// Test import of the Eagle sample, retrieves the "Bone09" joint and does the import sampling to verify its correctness.
|
||||
void TestImportSampling()
|
||||
{
|
||||
FCDocument document;
|
||||
CheckStatus(document.LoadFromFile(FC("Eagle.DAE")));
|
||||
FCDSceneNode* node = document.FindSceneNode("Bone09");
|
||||
FailIf(node == NULL);
|
||||
|
||||
FloatList keys; FMMatrix44List values;
|
||||
node->GenerateSampledMatrixAnimation(keys, values);
|
||||
FailIf(keys.size() > 30);
|
||||
PassIf(keys.size() == values.size());
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDAnimated.h"
|
||||
#include "FCDocument/FCDAnimation.h"
|
||||
#include "FCDocument/FCDAnimationChannel.h"
|
||||
#include "FCDocument/FCDAnimationCurve.h"
|
||||
#include "FCDocument/FCDLight.h"
|
||||
#include "FCTestExportImport.h"
|
||||
|
||||
static string animId1 = "GrossAnimation";
|
||||
static string animId2 = "GrossAnimation";
|
||||
static string animatedLightId;
|
||||
static const fstring animSubTreeNote = FS("TestingSTNote");
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
void FillAnimationLibrary(FCDAnimationLibrary* library)
|
||||
{
|
||||
// Create two more tree within the animation library
|
||||
FailIf(library == NULL);
|
||||
size_t startAnimCount = library->GetEntityCount();
|
||||
FCDAnimation* animTree1 = library->AddEntity();
|
||||
FCDAnimation* animTree2 = library->AddEntity();
|
||||
PassIf(library->GetEntityCount() == startAnimCount + 2);
|
||||
|
||||
// Retrieve the ids of the created entities.
|
||||
animTree2->SetDaeId(animId2);
|
||||
animTree1->SetDaeId(animId1);
|
||||
FailIf(animId1.empty());
|
||||
FailIf(animId2.empty());
|
||||
FailIf(animId1 == animId2);
|
||||
|
||||
// Add to the first animation tree some sub-trees.
|
||||
FCDAnimation* animSubTree1 = animTree1->AddChild();
|
||||
FCDAnimation* animSubTree2 = animTree1->AddChild();
|
||||
animSubTree1->SetNote(animSubTreeNote);
|
||||
animSubTree2->SetNote(animSubTreeNote);
|
||||
FailIf(animTree1->GetChildCount() != 2);
|
||||
|
||||
// Animate some selected parameters
|
||||
FillAnimationLight(library->GetDocument(), animSubTree2);
|
||||
}
|
||||
|
||||
void CheckAnimationLibrary(FCDAnimationLibrary* library)
|
||||
{
|
||||
FailIf(library == NULL);
|
||||
|
||||
// Retrieve the animation trees using the saved ids.
|
||||
FCDAnimation* animTree1 = library->FindDaeId(animId1);
|
||||
FCDAnimation* animTree2 = library->FindDaeId(animId2);
|
||||
FailIf(animTree1 == NULL);
|
||||
FailIf(animTree2 == NULL);
|
||||
|
||||
// Verify that the first animation tree has the correct sub-trees.
|
||||
// Retrieve the animation sub-tree which contains our channels.
|
||||
FCDAnimation* ourChannels = NULL;
|
||||
FailIf(animTree1->GetChildCount() != 2);
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
FCDAnimation* subTree = animTree1->GetChild(i);
|
||||
FailIf(subTree == NULL);
|
||||
PassIf(subTree->GetNote() == animSubTreeNote);
|
||||
if (subTree->GetChannelCount() > 0)
|
||||
{
|
||||
PassIf(ourChannels == NULL);
|
||||
ourChannels = subTree;
|
||||
}
|
||||
}
|
||||
|
||||
PassIf(ourChannels != NULL);
|
||||
CheckAnimationLight(library->GetDocument(), ourChannels);
|
||||
}
|
||||
|
||||
void FillAnimationLight(FCDocument* document, FCDAnimation* animationTree)
|
||||
{
|
||||
// Retrieve a light entity and add an animation to its color
|
||||
FCDLightLibrary* lightLibrary = document->GetLightLibrary();
|
||||
PassIf(lightLibrary != NULL);
|
||||
PassIf(lightLibrary->GetEntityCount() > 0);
|
||||
FCDLight* light1 = lightLibrary->GetEntity(0);
|
||||
animatedLightId = light1->GetDaeId();
|
||||
|
||||
// Create the animated object for the color
|
||||
PassIf(document->FindAnimatedValue(&light1->GetColor().x) == NULL);
|
||||
FCDAnimatedColor* animated = FCDAnimatedColor::Create(document, &light1->GetColor());
|
||||
FailIf(animated == NULL);
|
||||
|
||||
// Create a channel for the animation curves
|
||||
FCDAnimationChannel* channel = animationTree->AddChannel();
|
||||
FailIf(channel == NULL);
|
||||
|
||||
FCDAnimationCurve* curve = channel->AddCurve();
|
||||
animated->SetCurve(0, curve);
|
||||
}
|
||||
|
||||
void CheckAnimationLight(FCDocument* document, FCDAnimation* UNUSED(animationTree))
|
||||
{
|
||||
// Retrieve the light whose color is animated.
|
||||
FCDLightLibrary* lightLibrary = document->GetLightLibrary();
|
||||
PassIf(lightLibrary != NULL);
|
||||
PassIf(lightLibrary->GetEntityCount() > 0);
|
||||
FCDLight* light1 = lightLibrary->FindDaeId(animatedLightId);
|
||||
PassIf(light1 != NULL);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDCamera.h"
|
||||
#include "FCTestExportImport.h"
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
void FillCameraLibrary(FCDCameraLibrary* library)
|
||||
{
|
||||
// Export a perspective camera.
|
||||
FCDCamera* persp = library->AddEntity();
|
||||
PassIf(library->GetEntityCount() == 1);
|
||||
PassIf(library->GetEntity(0) == persp);
|
||||
PassIf(persp->GetType() == FCDEntity::CAMERA);
|
||||
persp->SetPerspective();
|
||||
PassIf(persp->IsPerspective());
|
||||
FailIf(persp->IsOrthographic());
|
||||
|
||||
persp->SetAspectRatio(1.5f);
|
||||
persp->SetFarZ(128.0f);
|
||||
persp->SetNearZ(0.5f);
|
||||
persp->SetNote(FC("Testing Camera support."));
|
||||
persp->SetVerticalAperture(6.0f);
|
||||
persp->SetHorizontalAperture(9.0f);
|
||||
persp->SetFovX(1.5f);
|
||||
PassIf(!persp->HasVerticalFov());
|
||||
|
||||
// Export an orthographic camera.
|
||||
FCDCamera* ortho = library->AddEntity();
|
||||
PassIf(library->GetEntityCount() == 2);
|
||||
ortho->SetOrthographic();
|
||||
ortho->SetMagY(1.5f);
|
||||
ortho->SetAspectRatio(0.3f);
|
||||
ortho->SetNearZ(0.01f);
|
||||
ortho->SetFarZ(41.2f);
|
||||
FailIf(ortho->IsPerspective());
|
||||
PassIf(ortho->IsOrthographic());
|
||||
}
|
||||
|
||||
void CheckCameraLibrary(FCDCameraLibrary* library)
|
||||
{
|
||||
PassIf(library->GetEntityCount() == 2);
|
||||
|
||||
// Find the perspective and the orthographic camera.
|
||||
FCDCamera* persp = NULL,* ortho = NULL;
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
FCDCamera* camera = library->GetEntity(i);
|
||||
PassIf(camera->GetType() == FCDEntity::CAMERA);
|
||||
if (camera->IsPerspective()) { FailIf(persp != NULL); persp = camera; }
|
||||
else if (camera->IsOrthographic()) { FailIf(ortho != NULL); ortho = camera; }
|
||||
else FailIf(true);
|
||||
}
|
||||
PassIf(persp != NULL && ortho != NULL);
|
||||
FailIf(persp->IsOrthographic());
|
||||
FailIf(ortho->IsPerspective());
|
||||
|
||||
// Verify the perspective camera parameters
|
||||
PassIf(IsEquivalent(persp->GetAspectRatio(), 1.5f));
|
||||
PassIf(IsEquivalent(persp->GetFarZ(), 128.0f));
|
||||
PassIf(IsEquivalent(persp->GetNearZ(), 0.5f));
|
||||
PassIf(persp->GetNote() == FC("Testing Camera support."));
|
||||
PassIf(IsEquivalent(persp->GetVerticalAperture(), 6.0f));
|
||||
PassIf(IsEquivalent(persp->GetHorizontalAperture(), 9.0f));
|
||||
PassIf(IsEquivalent(persp->GetFovX(), 1.5f));
|
||||
PassIf(!persp->HasVerticalFov());
|
||||
|
||||
// Verify the orthographic camera parameters
|
||||
PassIf(IsEquivalent(ortho->GetAspectRatio(), 0.3f));
|
||||
PassIf(IsEquivalent(ortho->GetFarZ(), 41.2f));
|
||||
PassIf(IsEquivalent(ortho->GetNearZ(), 0.01f));
|
||||
PassIf(IsEquivalent(ortho->GetMagY(), 1.5f));
|
||||
PassIf(ortho->HasVerticalMag());
|
||||
FailIf(ortho->HasHorizontalMag());
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDExtra.h"
|
||||
#include "FCTestExportImport.h"
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
void FillExtraTree(FCDExtra* extra)
|
||||
{
|
||||
FailIf(extra == NULL);
|
||||
|
||||
// Add a test technique.
|
||||
PassIf(extra->GetTechniqueCount() == 0);
|
||||
FCDETechnique* technique1 = extra->AddTechnique("FCTEI_TestProfile");
|
||||
FCDETechnique* technique2 = extra->AddTechnique("FCTEI_TestProfile");
|
||||
FailIf(technique1 == NULL);
|
||||
FailIf(technique2 == NULL);
|
||||
PassIf(technique1 == technique2);
|
||||
PassIf(extra->GetTechniqueCount() == 1);
|
||||
|
||||
// Add a parent parameter to the technique and two subsequent parameters with the same name.
|
||||
FCDENode* parameterTree = technique1->AddChildNode();
|
||||
parameterTree->SetName("MainParameterTree");
|
||||
FCDENode* firstParameter = parameterTree->AddChildNode();
|
||||
firstParameter->SetName("SomeParameter");
|
||||
firstParameter->SetContent(FS("Test_SomeParameter"));
|
||||
firstParameter->AddAttribute("Guts", 0);
|
||||
FCDENode* secondParameter = parameterTree->AddChildNode();
|
||||
secondParameter->SetName("SomeParameter");
|
||||
secondParameter->AddAttribute("Guts", 3);
|
||||
secondParameter->SetContent(FS("Test_ThatParameter!"));
|
||||
PassIf(parameterTree->GetChildNodeCount() == 2);
|
||||
|
||||
// Add some attributes to the parameter tree
|
||||
parameterTree->AddAttribute("Vicious", FC("Squirrel"));
|
||||
parameterTree->AddAttribute("Gross", 1002);
|
||||
}
|
||||
|
||||
void CheckExtraTree(FCDExtra* extra)
|
||||
{
|
||||
FailIf(extra == NULL);
|
||||
|
||||
// Find and verify the one technique
|
||||
FailIf(extra->GetTechniqueCount() != 1);
|
||||
FCDETechnique* technique = extra->GetTechnique(0);
|
||||
FailIf(technique == NULL);
|
||||
PassIf(IsEquivalent(technique->GetProfile(), "FCTEI_TestProfile"));
|
||||
PassIf(extra->FindTechnique("FCTEI_TestProfile") == technique);
|
||||
|
||||
// Find and verify the base parameter tree node
|
||||
FailIf(technique->GetChildNodeCount() != 1);
|
||||
FCDENode* baseNode = technique->GetChildNode(0);
|
||||
PassIf(baseNode != NULL);
|
||||
PassIf(extra->FindRootNode("MainParameterTree") == baseNode);
|
||||
|
||||
// Verify the base node attributes
|
||||
PassIf(baseNode->GetAttributeCount() == 2);
|
||||
FCDEAttribute* a1 = baseNode->FindAttribute("Vicious");
|
||||
FCDEAttribute* a2 = baseNode->FindAttribute("Gross");
|
||||
FailIf(a1 == NULL);
|
||||
FailIf(a2 == NULL);
|
||||
FailIf(a1 == a2);
|
||||
PassIf(IsEquivalent(a1->value, FC("Squirrel")));
|
||||
PassIf(IsEquivalent(FUStringConversion::ToUInt32(a2->value), 1002));
|
||||
|
||||
// Identify the base node leaves
|
||||
PassIf(baseNode->GetChildNodeCount() == 2);
|
||||
FCDENode* leaf0 = NULL,* leaf3 = NULL;
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
FCDENode* leaf = baseNode->GetChildNode(i);
|
||||
PassIf(IsEquivalent(leaf->GetName(), "SomeParameter"));
|
||||
FCDEAttribute* guts = leaf->FindAttribute("Guts");
|
||||
FailIf(guts == NULL || guts->value.empty());
|
||||
uint32 gutsIndex = FUStringConversion::ToUInt32(guts->value);
|
||||
if (gutsIndex == 0) { FailIf(leaf0 != NULL); leaf0 = leaf; }
|
||||
else if (gutsIndex == 3) { FailIf(leaf3 != NULL); leaf3 = leaf; }
|
||||
else FailIf(true);
|
||||
}
|
||||
FailIf(leaf0 == NULL || leaf3 == NULL);
|
||||
|
||||
// Verify the base node leaves
|
||||
PassIf(leaf0->GetChildNodeCount() == 0);
|
||||
PassIf(leaf3->GetChildNodeCount() == 0);
|
||||
PassIf(leaf0->GetAttributeCount() == 1);
|
||||
PassIf(leaf3->GetAttributeCount() == 1);
|
||||
PassIf(IsEquivalent(leaf0->GetContent(), FC("Test_SomeParameter")));
|
||||
PassIf(IsEquivalent(leaf3->GetContent(), FS("Test_ThatParameter!")));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDController.h"
|
||||
#include "FCDocument/FCDGeometry.h"
|
||||
#include "FCDocument/FCDGeometryMesh.h"
|
||||
#include "FCDocument/FCDGeometryPolygons.h"
|
||||
#include "FCDocument/FCDGeometrySource.h"
|
||||
#include "FCDocument/FCDGeometrySpline.h"
|
||||
#include "FCDocument/FCDMorphController.h"
|
||||
#include "FCDocument/FCDSceneNode.h"
|
||||
#include "FCDocument/FCDSkinController.h"
|
||||
#include "FCTestExportImport.h"
|
||||
|
||||
static const float positionData[12] = { 0.0f, 0.0f, 3.0f, 5.0f, 0.0f, -2.0f, -3.0f, 4.0f, -2.0f, -3.0f, -4.0f, -2.0f };
|
||||
static const float colorData[12] = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f };
|
||||
static const float dummyData[10] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f };
|
||||
static const uint32 positionIndices[12] = { 0, 1, 2, 0, 2, 3, 0, 3, 1, 3, 2, 1 };
|
||||
static const uint32 colorIndices[12] = { 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2 };
|
||||
|
||||
static const float sampleBindPose1[16] = { 1.0f, 0.4f, 0.4f, 0.0f, 7.77f, 0.0f, 0.3f, 2.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
static const float sampleBindPose2[16] = { 0.3f, 0.0f, -0.3f, -21.0f, 0.96f, 0.0f, 2.0f, 2.5f, 0.0f, -5.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
static string splineId, meshId, jointId1, jointId2;
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
void FillGeometryLibrary(FCDGeometryLibrary* library)
|
||||
{
|
||||
FCDGeometry* geometry = library->AddEntity();
|
||||
PassIf(geometry->GetType() == FCDEntity::GEOMETRY);
|
||||
FailIf(geometry->IsMesh());
|
||||
FailIf(geometry->IsSpline());
|
||||
meshId = geometry->GetDaeId();
|
||||
FailIf(meshId.empty());
|
||||
|
||||
// Creates a mesh to export
|
||||
FCDGeometryMesh* mesh = geometry->CreateMesh();
|
||||
FailIf(geometry->IsSpline());
|
||||
PassIf(geometry->IsMesh());
|
||||
PassIf(geometry->GetMesh() == mesh);
|
||||
PassIf(geometry->GetSpline() == NULL);
|
||||
FillGeometryMesh(mesh);
|
||||
|
||||
// Create a spline to export
|
||||
geometry = library->AddEntity();
|
||||
geometry->CreateMesh();
|
||||
FCDGeometrySpline* spline = geometry->CreateSpline();
|
||||
PassIf(geometry->IsSpline());
|
||||
FailIf(geometry->IsMesh());
|
||||
PassIf(geometry->GetMesh() == NULL);
|
||||
PassIf(geometry->GetSpline() == spline);
|
||||
FillGeometrySpline(spline);
|
||||
splineId = geometry->GetDaeId();
|
||||
FailIf(splineId.empty());
|
||||
}
|
||||
|
||||
void FillGeometryMesh(FCDGeometryMesh* mesh)
|
||||
{
|
||||
FCDGeometrySource* posSource = mesh->AddVertexSource();
|
||||
FailIf(posSource == NULL);
|
||||
posSource->SetName(FC("TestPositionSource"));
|
||||
posSource->SetSourceType(FUDaeGeometryInput::POSITION);
|
||||
posSource->SetSourceData(FloatList(positionData, 12), 3);
|
||||
|
||||
FCDGeometrySource* colorSource = mesh->AddSource();
|
||||
FailIf(colorSource == NULL);
|
||||
colorSource->SetName(FC("TestColorSource"));
|
||||
colorSource->SetSourceType(FUDaeGeometryInput::COLOR);
|
||||
colorSource->SetSourceData(FloatList(colorData, 12), 4);
|
||||
|
||||
FCDGeometrySource* dummySource = mesh->AddSource();
|
||||
FailIf(dummySource == NULL);
|
||||
dummySource->SetName(FC("TestDummySource"));
|
||||
dummySource->SetSourceType(FUDaeGeometryInput::EXTRA);
|
||||
dummySource->SetSourceData(FloatList(dummyData, 10), 3);
|
||||
|
||||
FCDGeometryPolygons* polys1 = mesh->AddPolygons();
|
||||
FailIf(polys1 == NULL || polys1->GetInputCount() != 1);
|
||||
FCDGeometryPolygons* polys2 = mesh->AddPolygons();
|
||||
FailIf(polys2 == NULL || polys2->GetInputCount() != 1);
|
||||
FCDGeometryPolygonsInput* pInput1 = polys1->AddInput(colorSource, 1);
|
||||
PassIf(polys1->GetInputCount() == 2);
|
||||
PassIf(pInput1 != NULL && pInput1->source == colorSource && pInput1->idx == 1);
|
||||
FCDGeometryPolygonsInput* pInput2 = polys2->AddInput(colorSource, 1);
|
||||
PassIf(polys2->GetInputCount() == 2);
|
||||
PassIf(pInput2 != NULL && pInput2->source == colorSource && pInput2->idx == 1);
|
||||
FCDGeometryPolygonsInput* pInput3 = polys1->AddInput(dummySource, 2);
|
||||
PassIf(pInput3 != NULL && pInput3->source == dummySource && pInput3->idx == 2);
|
||||
|
||||
// Fill in some indices in order to form a tetrahedron
|
||||
polys1->AddFace(3); polys1->AddFace(3); polys1->AddFace(3); polys1->AddFace(3);
|
||||
UInt32List* posIndices = polys1->FindIndices(posSource);
|
||||
UInt32List* colIndices = polys1->FindIndices(colorSource);
|
||||
FailIf(posIndices == NULL || posIndices->size() != 12);
|
||||
FailIf(colIndices == NULL || colIndices == posIndices || colIndices->size() != 12);
|
||||
*posIndices = UInt32List(positionIndices, 12);
|
||||
*colIndices = UInt32List(colorIndices, 12);
|
||||
}
|
||||
|
||||
void FillGeometrySpline(FCDGeometrySpline* spline)
|
||||
{
|
||||
FCDCVs cvs;
|
||||
cvs.push_back(FMVector3(1.0f, 2.0f, 4.0f));
|
||||
cvs.push_back(FMVector3::XAxis);
|
||||
spline->SetCVs(cvs);
|
||||
PassIf(spline->GetCVCount() == 2);
|
||||
|
||||
FCDKnots knots;
|
||||
knots.push_back(1.4);
|
||||
knots.push_back(7.4);
|
||||
spline->SetKnots(knots);
|
||||
PassIf(spline->GetKnotCount() == 2);
|
||||
}
|
||||
|
||||
void CheckGeometryLibrary(FCDGeometryLibrary* library)
|
||||
{
|
||||
PassIf(library->GetEntityCount() == 2);
|
||||
|
||||
// Find the one mesh and the one spline geometries.
|
||||
FCDGeometryMesh* mesh = NULL; FCDGeometrySpline* spline = NULL;
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
FCDGeometry* g = library->GetEntity(i);
|
||||
if (g->IsMesh()) mesh = g->GetMesh();
|
||||
else if (g->IsSpline()) spline = g->GetSpline();
|
||||
else FailIf(true);
|
||||
}
|
||||
FailIf(mesh == NULL || spline == NULL);
|
||||
|
||||
CheckGeometryMesh(mesh);
|
||||
CheckGeometrySpline(spline);
|
||||
}
|
||||
|
||||
void CheckGeometryMesh(FCDGeometryMesh* mesh)
|
||||
{
|
||||
// Verify the mesh and its sources
|
||||
PassIf(mesh->GetSourceCount() == 3);
|
||||
FCDGeometrySource* posSource = NULL,* colorSource = NULL,* dummySource = NULL;
|
||||
for (size_t i = 0; i < 3; ++i)
|
||||
{
|
||||
FCDGeometrySource* source = mesh->GetSource(i);
|
||||
FailIf(source == NULL);
|
||||
switch (source->GetSourceType())
|
||||
{
|
||||
case FUDaeGeometryInput::POSITION: posSource = source; PassIf(source->GetName() == FC("TestPositionSource")); break;
|
||||
case FUDaeGeometryInput::COLOR: colorSource = source; PassIf(source->GetName() == FC("TestColorSource")); break;
|
||||
case FUDaeGeometryInput::EXTRA: dummySource = source; PassIf(source->GetName() == FC("TestDummySource")); break;
|
||||
default: FailIf(true); break;
|
||||
}
|
||||
}
|
||||
FailIf(posSource == NULL || colorSource == NULL || dummySource == NULL);
|
||||
PassIf(IsEquivalent(posSource->GetSourceData(), positionData, 12));
|
||||
PassIf(posSource->GetSourceStride() == 3);
|
||||
PassIf(IsEquivalent(colorSource->GetSourceData(), colorData, 12));
|
||||
PassIf(colorSource->GetSourceStride() == 4);
|
||||
PassIf(IsEquivalent(dummySource->GetSourceData(), dummyData, 10));
|
||||
PassIf(dummySource->GetSourceStride() == 3);
|
||||
|
||||
// Find the non-empty polygon set and verify that one of the polygon set is, in fact, empty.
|
||||
FCDGeometryPolygons* polys1 = NULL,* polysEmpty = NULL;
|
||||
for (size_t i = 0; i < mesh->GetPolygonsCount(); ++i)
|
||||
{
|
||||
FCDGeometryPolygons* p = mesh->GetPolygons(i);
|
||||
if (p->GetFaceCount() == 0) { PassIf(polysEmpty == NULL); polysEmpty = p; }
|
||||
else { PassIf(polys1 == NULL); polys1 = p; }
|
||||
}
|
||||
PassIf(polys1 != NULL && polysEmpty != NULL);
|
||||
|
||||
// Check that we have the wanted tetrahedron in the non-empty polygon set.
|
||||
PassIf(polys1->GetFaceCount() == 4);
|
||||
PassIf(polys1->GetHoleCount() == 0);
|
||||
PassIf(polys1->GetFaceVertexCount(0) == 3 && polys1->GetFaceVertexCount(1) == 3 && polys1->GetFaceVertexCount(2) == 3 && polys1->GetFaceVertexCount(3) == 3);
|
||||
UInt32List* posIndices = polys1->FindIndices(posSource);
|
||||
UInt32List* colIndices = polys1->FindIndices(colorSource);
|
||||
FailIf(posIndices == NULL || posIndices->size() != 12);
|
||||
FailIf(colIndices == NULL || colIndices == posIndices || colIndices->size() != 12);
|
||||
PassIf(IsEquivalent(*posIndices, positionIndices, 12));
|
||||
PassIf(IsEquivalent(*colIndices, colorIndices, 12));
|
||||
}
|
||||
|
||||
void CheckGeometrySpline(FCDGeometrySpline* spline)
|
||||
{
|
||||
// Verify the spline and its data
|
||||
FailIf(spline->GetCVCount() != 2);
|
||||
FailIf(spline->GetKnotCount() != 2);
|
||||
PassIf(IsEquivalent(*spline->GetCV(0), FMVector3(1.0f, 2.0f, 4.0f)));
|
||||
PassIf(IsEquivalent(*spline->GetCV(1), FMVector3::XAxis));
|
||||
PassIf(IsEquivalent(spline->GetKnot(0), 1.4));
|
||||
PassIf(IsEquivalent(spline->GetKnot(1), 7.4));
|
||||
}
|
||||
|
||||
void FillControllerLibrary(FCDControllerLibrary* library)
|
||||
{
|
||||
FailIf(library == NULL);
|
||||
|
||||
// Create a morph controller on the previously created spline.
|
||||
FCDController* morpher = library->AddEntity();
|
||||
FillControllerMorph(morpher->CreateMorphController());
|
||||
|
||||
// Create a skin controller on the previously created mesh.
|
||||
FCDController* skin = library->AddEntity();
|
||||
skin->SetNote(FS("A nicey skinny controller. "));
|
||||
FillControllerSkin(skin->CreateSkinController());
|
||||
}
|
||||
|
||||
void FillControllerMorph(FCDMorphController* controller)
|
||||
{
|
||||
FailIf(controller == NULL);
|
||||
controller->SetMethod(FUDaeMorphMethod::RELATIVE);
|
||||
|
||||
// Retrieve the base spline entity that will be morphed
|
||||
// (and for this test only: it'll be the morph targets)
|
||||
// Also retrieve the mesh, for similarity checks.
|
||||
FCDGeometry* spline = controller->GetDocument()->FindGeometry(splineId);
|
||||
FailIf(spline == NULL);
|
||||
FCDGeometry* mesh = controller->GetDocument()->FindGeometry(meshId);
|
||||
FailIf(mesh == NULL);
|
||||
FailIf(controller->IsSimilar(mesh));
|
||||
FailIf(controller->IsSimilar(spline));
|
||||
|
||||
controller->SetBaseTarget(spline);
|
||||
PassIf(controller->IsSimilar(spline));
|
||||
FailIf(controller->IsSimilar(mesh));
|
||||
|
||||
controller->AddTarget(spline, 0.3f);
|
||||
controller->AddTarget(spline, 0.6f);
|
||||
PassIf(controller->GetTargetCount() == 2);
|
||||
}
|
||||
|
||||
void FillControllerSkin(FCDSkinController* controller)
|
||||
{
|
||||
FailIf(controller == NULL);
|
||||
|
||||
// Create two joints.
|
||||
FCDSceneNode* visualScene = controller->GetDocument()->GetVisualSceneLibrary()->AddEntity();
|
||||
PassIf(visualScene != NULL);
|
||||
FCDSceneNode* joint1 = visualScene->AddChildNode();
|
||||
PassIf(joint1 != NULL);
|
||||
FCDSceneNode* joint2 = joint1->AddChildNode();
|
||||
PassIf(joint2 != NULL);
|
||||
jointId1 = joint1->GetDaeId();
|
||||
jointId2 = joint2->GetDaeId();
|
||||
FailIf(jointId1.empty() || jointId2.empty());
|
||||
controller->AddJoint(joint1, FMMatrix44::Identity);
|
||||
controller->AddJoint(joint2, FMMatrix44(sampleBindPose1));
|
||||
controller->SetBindShapeTransform(FMMatrix44(sampleBindPose2));
|
||||
PassIf(controller->GetJointCount() == 2);
|
||||
|
||||
// Retrieve and assign the base target
|
||||
FCDGeometry* geometricTarget = controller->GetDocument()->FindGeometry(meshId);
|
||||
controller->SetTarget(geometricTarget);
|
||||
|
||||
// Set some influences
|
||||
PassIf(controller->GetVertexInfluenceCount() == 4);
|
||||
FCDJointWeightPairList* influence = controller->GetInfluences(0);
|
||||
FailIf(influence == NULL);
|
||||
influence->push_back(FCDJointWeightPair(0, 0.5f));
|
||||
influence->push_back(FCDJointWeightPair(1, 0.5f));
|
||||
|
||||
influence = controller->GetInfluences(3);
|
||||
FailIf(influence == NULL);
|
||||
influence->push_back(FCDJointWeightPair(1, 1.0f));
|
||||
|
||||
influence = controller->GetInfluences(2);
|
||||
FailIf(influence == NULL);
|
||||
influence->push_back(FCDJointWeightPair(0, 0.1f));
|
||||
}
|
||||
|
||||
void CheckControllerLibrary(FCDControllerLibrary* library)
|
||||
{
|
||||
FailIf(library == NULL);
|
||||
|
||||
FCDController* morpher = NULL,* skin = NULL;
|
||||
for (size_t i = 0; i < library->GetEntityCount(); ++i)
|
||||
{
|
||||
FCDController* c = library->GetEntity(i);
|
||||
if (c->HasMorphController()) { PassIf(morpher == NULL); morpher = c; }
|
||||
else if (c->HasSkinController()) { PassIf(skin == NULL); skin = c; }
|
||||
else FailIf(true);
|
||||
}
|
||||
PassIf(morpher != NULL && skin != NULL);
|
||||
|
||||
// Check the morpher
|
||||
FailIf(morpher->HasSkinController());
|
||||
PassIf(morpher->GetMorphController() != NULL);
|
||||
CheckControllerMorph(morpher->GetMorphController());
|
||||
|
||||
// Check the skin
|
||||
PassIf(skin->GetSkinController() != NULL);
|
||||
FailIf(skin->HasMorphController());
|
||||
PassIf(skin->GetNote() == FC("A nicey skinny controller. "));
|
||||
CheckControllerSkin(skin->GetSkinController());
|
||||
}
|
||||
|
||||
void CheckControllerMorph(FCDMorphController* controller)
|
||||
{
|
||||
FailIf(controller == NULL);
|
||||
PassIf(controller->GetMethod() == FUDaeMorphMethod::RELATIVE);
|
||||
|
||||
// Check that there are two targets, that the weights are correct, as well as the ids.
|
||||
PassIf(controller->GetTargetCount() == 2);
|
||||
PassIf(controller->GetBaseTarget() != NULL);
|
||||
PassIf(controller->GetBaseTarget()->GetDaeId() == splineId);
|
||||
|
||||
FCDMorphTarget* target1 = controller->GetTarget(0);
|
||||
FailIf(target1 == NULL);
|
||||
FCDMorphTarget* target2 = controller->GetTarget(1);
|
||||
FailIf(target2 == NULL);
|
||||
PassIf(target1->GetGeometry() == controller->GetBaseTarget());
|
||||
PassIf(target2->GetGeometry() == controller->GetBaseTarget());
|
||||
PassIf(IsEquivalent(target1->GetWeight(), 0.6f) || IsEquivalent(target1->GetWeight(), 0.3f));
|
||||
PassIf(IsEquivalent(target2->GetWeight(), 0.6f) || IsEquivalent(target2->GetWeight(), 0.3f));
|
||||
FailIf(IsEquivalent(target1->GetWeight(), target2->GetWeight()));
|
||||
}
|
||||
|
||||
void CheckControllerSkin(FCDSkinController* controller)
|
||||
{
|
||||
FailIf(controller == NULL);
|
||||
|
||||
// Check the base target's identity
|
||||
FailIf(controller->GetTarget() == NULL);
|
||||
PassIf(controller->GetTarget()->GetType() == FCDEntity::GEOMETRY);
|
||||
PassIf(controller->GetTarget()->GetDaeId() == meshId);
|
||||
|
||||
// Retrieve the two joints and verify their ids/bind-pose.
|
||||
PassIf(controller->GetJointCount() == 2);
|
||||
FCDJointMatrixPair* joint1 = NULL,* joint2 = NULL;
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
FCDJointMatrixPair* p = controller->GetJoint(i);
|
||||
FailIf(p->joint == NULL);
|
||||
if (p->joint->GetDaeId() == jointId1) { FailIf(joint1 != NULL); joint1 = p; }
|
||||
else if (p->joint->GetDaeId() == jointId2) { FailIf(joint2 != NULL); joint2 = p; }
|
||||
else FailIf(true);
|
||||
}
|
||||
FailIf(joint1 == NULL || joint2 == NULL);
|
||||
PassIf(IsEquivalent(joint1->invertedBindPose, FMMatrix44::Identity));
|
||||
PassIf(IsEquivalent(joint2->invertedBindPose, FMMatrix44(sampleBindPose1).Inverted()));
|
||||
|
||||
// Verify the influences
|
||||
PassIf(controller->GetVertexInfluenceCount() == 4);
|
||||
FCDJointWeightPairList* influence = controller->GetInfluences(0);
|
||||
FailIf(influence == NULL);
|
||||
PassIf(influence->size() == 2);
|
||||
PassIf(IsEquivalent(influence->at(0).jointIndex, 0));
|
||||
PassIf(IsEquivalent(influence->at(0).weight, 0.5f));
|
||||
PassIf(IsEquivalent(influence->at(1).jointIndex, 1));
|
||||
PassIf(IsEquivalent(influence->at(1).weight, 0.5f));
|
||||
|
||||
influence = controller->GetInfluences(1);
|
||||
FailIf(influence == NULL);
|
||||
PassIf(influence->empty());
|
||||
|
||||
influence = controller->GetInfluences(2);
|
||||
FailIf(influence == NULL);
|
||||
PassIf(influence->size() == 1);
|
||||
PassIf(IsEquivalent(influence->at(0).jointIndex, 0));
|
||||
PassIf(IsEquivalent(influence->at(0).weight, 1.0f)); // the weight should have been normalized.
|
||||
|
||||
influence = controller->GetInfluences(3);
|
||||
FailIf(influence == NULL);
|
||||
PassIf(influence->size() == 1);
|
||||
PassIf(IsEquivalent(influence->at(0).jointIndex, 1));
|
||||
PassIf(IsEquivalent(influence->at(0).weight, 1.0f));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDLight.h"
|
||||
#include "FCTestExportImport.h"
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
void FillLightLibrary(FCDLightLibrary* library)
|
||||
{
|
||||
// Create four lights of different types.
|
||||
FCDLight* pointLight = library->AddEntity();
|
||||
pointLight->SetLightType(FCDLight::POINT);
|
||||
FCDLight* spotLight = library->AddEntity();
|
||||
spotLight->SetLightType(FCDLight::SPOT);
|
||||
FCDLight* directionalLight = library->AddEntity();
|
||||
directionalLight->SetLightType(FCDLight::DIRECTIONAL);
|
||||
FCDLight* ambientLight = library->AddEntity();
|
||||
ambientLight->SetLightType(FCDLight::AMBIENT);
|
||||
|
||||
// Set the base colors
|
||||
pointLight->SetColor(FMVector3(0.5f, 0.2f, 0.7f));
|
||||
spotLight->SetColor(FMVector3(0.25f, 0.25f, 0.75f));
|
||||
directionalLight->SetColor(FMVector3(0.1f, 0.0f, -1.0f));
|
||||
ambientLight->SetColor(FMVector3(5.0f, 0.0f, 0.4f));
|
||||
|
||||
// Set some intensity
|
||||
pointLight->SetIntensity(2.5f);
|
||||
spotLight->SetIntensity(1.5f);
|
||||
directionalLight->SetIntensity(0.5f);
|
||||
ambientLight->SetIntensity(-2.5f);
|
||||
|
||||
// Test the extra tree:
|
||||
FillExtraTree(ambientLight->GetExtra());
|
||||
}
|
||||
|
||||
void CheckLightLibrary(FCDLightLibrary* library)
|
||||
{
|
||||
// Verify that the library contains four lights and one of each type.
|
||||
FCDLight* pointLight = NULL,* spotLight = NULL,* directionalLight = NULL,* ambientLight = NULL;
|
||||
for (size_t i = 0; i < library->GetEntityCount(); ++i)
|
||||
{
|
||||
FCDLight* light = library->GetEntity(i);
|
||||
switch (light->GetLightType())
|
||||
{
|
||||
case FCDLight::AMBIENT: FailIf(ambientLight != NULL); ambientLight = light; break;
|
||||
case FCDLight::DIRECTIONAL: FailIf(directionalLight != NULL); directionalLight = light; break;
|
||||
case FCDLight::POINT: FailIf(pointLight != NULL); pointLight = light; break;
|
||||
case FCDLight::SPOT: FailIf(spotLight != NULL); spotLight = light; break;
|
||||
default: FailIf(true); break;
|
||||
}
|
||||
}
|
||||
PassIf(ambientLight != NULL && spotLight != NULL && directionalLight != NULL && pointLight != NULL);
|
||||
|
||||
// Verify the base colors
|
||||
PassIf(IsEquivalent(pointLight->GetColor(), FMVector3(0.5f, 0.2f, 0.7f)));
|
||||
PassIf(IsEquivalent(spotLight->GetColor(), FMVector3(0.25f, 0.25f, 0.75f)));
|
||||
PassIf(IsEquivalent(directionalLight->GetColor(), FMVector3(0.1f, 0.0f, -1.0f)));
|
||||
PassIf(IsEquivalent(ambientLight->GetColor(), FMVector3(5.0f, 0.0f, 0.4f)));
|
||||
|
||||
// Verify the intensities
|
||||
PassIf(IsEquivalent(pointLight->GetIntensity(), 2.5f));
|
||||
PassIf(IsEquivalent(spotLight->GetIntensity(), 1.5f));
|
||||
PassIf(IsEquivalent(directionalLight->GetIntensity(), 0.5f));
|
||||
PassIf(IsEquivalent(ambientLight->GetIntensity(), -2.5f));
|
||||
|
||||
// Test the extra tree
|
||||
CheckExtraTree(ambientLight->GetExtra());
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDEffect.h"
|
||||
#include "FCDocument/FCDEffectStandard.h"
|
||||
#include "FCDocument/FCDEffectProfileFX.h"
|
||||
#include "FCDocument/FCDImage.h"
|
||||
#include "FCDocument/FCDMaterial.h"
|
||||
#include "FCDocument/FCDMaterialLibrary.h"
|
||||
#include "FCDocument/FCDTexture.h"
|
||||
#include "FCTestExportImport.h"
|
||||
|
||||
static const float sampleMatrix[16] = { 0.5f, 0.1f, 0.7f, 2.0f, 1.11f, 0.5e-2f, 111.0f, 0.5f, 0.0f, 0.0f, 0.557f, -10.02f, 0.001f, 12.0f, 1.02e-3f };
|
||||
static string wantedImageId = "test_image";
|
||||
static string wantedImage2Id = "test_image";
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
void FillMaterialLibrary(FCDMaterialLibrary* library)
|
||||
{
|
||||
// Create an empty material
|
||||
FCDMaterial* material = library->AddMaterial();
|
||||
material->SetNote(FS("EmptyMaterial244"));
|
||||
|
||||
// Create an effect and attach it to a new material
|
||||
FCDEffect* effect = library->AddEffect();
|
||||
material = library->AddMaterial();
|
||||
material->SetEffect(effect);
|
||||
effect->SetNote(FS("EmptyEffect.. for now!"));
|
||||
|
||||
FillEffectStandard((FCDEffectStandard*) effect->AddProfile(FUDaeProfileType::COMMON));
|
||||
FillEffectFX((FCDEffectProfileFX*) effect->AddProfile(FUDaeProfileType::CG));
|
||||
}
|
||||
|
||||
void FillEffectStandard(FCDEffectStandard* profile)
|
||||
{
|
||||
FailIf(profile == NULL);
|
||||
profile->SetLightingType(FCDEffectStandard::PHONG);
|
||||
profile->SetDiffuseColor(FMVector3(1.0f, 0.0f, -2.0f));
|
||||
profile->SetSpecularColor(FMVector3(0.0f, 1.0f, 0.4f));
|
||||
profile->SetShininess(40.0f);
|
||||
|
||||
// Retrieve two images created earlier
|
||||
FCDImage* image1 = profile->GetDocument()->FindImage(wantedImageId);
|
||||
FCDImage* image2 = profile->GetDocument()->FindImage(wantedImage2Id);
|
||||
PassIf("Dependency: FillImageLibrary!" && image1 != NULL && image2 != NULL);
|
||||
|
||||
// The first bump texture should have placement parameters.
|
||||
FCDTexture* texture1 = profile->AddTexture(FUDaeTextureChannel::BUMP);
|
||||
texture1->SetImage(image2);
|
||||
texture1->SetWrapU(true);
|
||||
texture1->SetWrapV(true);
|
||||
texture1->SetRepeatU(2.0f);
|
||||
texture1->SetRepeatV(2.0f);
|
||||
texture1->SetTranslateFrameU(5.0f);
|
||||
texture1->SetTranslateFrameV(-0.4f);
|
||||
|
||||
// The second bump texture should have an image and projection parameters.
|
||||
FCDTexture* texture2 = profile->AddTexture(FUDaeTextureChannel::BUMP);
|
||||
texture2->SetImage(image1);
|
||||
texture2->SetProjectionMatrix(FMMatrix44(sampleMatrix));
|
||||
|
||||
// The third texture is a filter texture and will remain empty.
|
||||
UNUSED(FCDTexture* texture3 = )profile->AddTexture(FUDaeTextureChannel::FILTER);
|
||||
}
|
||||
|
||||
void FillEffectFX(FCDEffectProfileFX* profile)
|
||||
{
|
||||
FailIf(profile == NULL);
|
||||
profile->AddTechnique();
|
||||
profile->AddCode();
|
||||
}
|
||||
|
||||
void CheckMaterialLibrary(FCDMaterialLibrary* library)
|
||||
{
|
||||
// There should be two materials within the material library: one is empty, the other is not.
|
||||
PassIf(library->GetMaterialCount() == 2);
|
||||
PassIf(library->GetEffectCount() == 1);
|
||||
|
||||
FCDMaterial* emptyMaterial = NULL,* material = NULL;
|
||||
for (size_t i = 0; i < library->GetMaterialCount(); ++i)
|
||||
{
|
||||
FCDMaterial* m = library->GetMaterial(i);
|
||||
if (m->GetEffect() == NULL) { PassIf(emptyMaterial == NULL); emptyMaterial = m; }
|
||||
else { PassIf(material == NULL); material = m; }
|
||||
}
|
||||
PassIf(emptyMaterial != NULL && material != NULL);
|
||||
|
||||
// Verify the empty material. It should only have a note.
|
||||
PassIf(emptyMaterial->GetNote() == FC("EmptyMaterial244"));
|
||||
|
||||
// Verify the other material and its effect.
|
||||
FCDEffect* effect = material->GetEffect();
|
||||
PassIf(library->GetEffect(0) == effect);
|
||||
PassIf(effect->GetNote() == FC("EmptyEffect.. for now!"));
|
||||
PassIf(effect->GetProfileCount() == 2);
|
||||
|
||||
CheckEffectStandard((FCDEffectStandard*) effect->FindProfile(FUDaeProfileType::COMMON));
|
||||
CheckEffectFX((FCDEffectProfileFX*) effect->FindProfile(FUDaeProfileType::CG));
|
||||
}
|
||||
|
||||
void CheckEffectStandard(FCDEffectStandard* profile)
|
||||
{
|
||||
FailIf(profile == NULL);
|
||||
PassIf(profile->GetLightingType() == FCDEffectStandard::PHONG);
|
||||
PassIf(IsEquivalent(profile->GetDiffuseColor(), FMVector3(1.0f, 0.0f, -2.0f)));
|
||||
PassIf(IsEquivalent(profile->GetSpecularColor(), FMVector3(0.0f, 1.0f, 0.4f)));
|
||||
PassIf(IsEquivalent(profile->GetShininess(), 40.0f));
|
||||
|
||||
// There should be two textures in the bump channel.
|
||||
PassIf(profile->GetTextureCount(FUDaeTextureChannel::BUMP) == 2);
|
||||
FCDTexture* texture1 = NULL,* texture2 = NULL;
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
FCDTexture* texture = profile->GetTexture(FUDaeTextureChannel::BUMP, i);
|
||||
FailIf(texture == NULL);
|
||||
if (texture->HasPlacement2D()) { FailIf(texture1 != NULL); texture1 = texture; }
|
||||
else if (texture->HasProjection3D()) { FailIf(texture2 != NULL); texture2 = texture; }
|
||||
else FailIf(true);
|
||||
}
|
||||
PassIf(texture1 != NULL && texture2 != NULL);
|
||||
|
||||
// Verify the texture images
|
||||
FCDImage* image1 = profile->GetDocument()->FindImage(wantedImageId);
|
||||
FCDImage* image2 = profile->GetDocument()->FindImage(wantedImage2Id);
|
||||
PassIf("Dependency: CheckImageLibrary" && image1 != NULL && image2 != NULL);
|
||||
PassIf(texture1->GetImage() == image2);
|
||||
PassIf(texture2->GetImage() == image1);
|
||||
|
||||
// Verify the placement parameters
|
||||
PassIf(IsEquivalent(texture1->GetWrapU(), 1.0f));
|
||||
PassIf(IsEquivalent(texture1->GetWrapV(), 1.0f));
|
||||
PassIf(IsEquivalent(texture1->GetRepeatU(), 2.0f));
|
||||
PassIf(IsEquivalent(texture1->GetRepeatV(), 2.0f));
|
||||
PassIf(IsEquivalent(texture1->GetTranslateFrameU(), 5.0f));
|
||||
PassIf(IsEquivalent(texture1->GetTranslateFrameV(), -0.4f));
|
||||
|
||||
// There should be an empty texture in the filter channel
|
||||
PassIf(profile->GetTextureCount(FUDaeTextureChannel::FILTER) == 1);
|
||||
FCDTexture* texture3 = profile->GetTexture(FUDaeTextureChannel::FILTER, 0);
|
||||
FailIf(texture3 == NULL || texture3->GetImage() != NULL);
|
||||
}
|
||||
|
||||
void CheckEffectFX(FCDEffectProfileFX* profile)
|
||||
{
|
||||
FailIf(profile == NULL);
|
||||
PassIf(profile->GetTechniqueCount() == 1);
|
||||
PassIf(profile->GetCodeCount() == 1);
|
||||
}
|
||||
|
||||
void FillImageLibrary(FCDImageLibrary* library)
|
||||
{
|
||||
FailIf(library == NULL || library->GetEntityCount() > 0);
|
||||
FCDImage* image1 = library->AddEntity();
|
||||
FCDImage* image2 = library->AddEntity();
|
||||
FCDImage* image3 = library->AddEntity();
|
||||
|
||||
image1->SetDaeId(wantedImageId);
|
||||
image1->SetFilename(FS("Texture1.jpg"));
|
||||
image2->SetDaeId(wantedImage2Id);
|
||||
image2->SetFilename(FC("Texture3D.jpg"));
|
||||
image2->SetWidth(256);
|
||||
image2->SetHeight(135);
|
||||
image3->SetWidth(33);
|
||||
image3->SetDepth(521);
|
||||
|
||||
FailIf(image1->GetDaeId() == image2->GetDaeId());
|
||||
}
|
||||
|
||||
void CheckImageLibrary(FCDImageLibrary* library)
|
||||
{
|
||||
FailIf(library == NULL || library->GetEntityCount() != 3);
|
||||
|
||||
// Retrieve the three images, verify that they match the id/filenames that we created.
|
||||
FCDImage* image1 = NULL,* image2 = NULL,* image3 = NULL;
|
||||
for (size_t i = 0; i < 3; ++i)
|
||||
{
|
||||
FCDImage* image = library->GetEntity(i);
|
||||
if (IsEquivalent(image->GetDaeId(), wantedImageId)) { FailIf(image1 != NULL); image1 = image; }
|
||||
else if (IsEquivalent(image->GetDaeId(), wantedImage2Id)) { FailIf(image2 != NULL); image2 = image; }
|
||||
else { FailIf(image3 != NULL); image3 = image; }
|
||||
}
|
||||
PassIf(image1 != NULL && image2 != NULL && image3 != NULL);
|
||||
|
||||
// Verify the depth/width/height.
|
||||
PassIf(image1->GetWidth() == 0 && image1->GetHeight() == 0 && image1->GetDepth() == 0);
|
||||
PassIf(image2->GetWidth() == 256 && image2->GetHeight() == 135 && image2->GetDepth() == 0);
|
||||
PassIf(image3->GetWidth() == 33 && image3->GetHeight() == 0 && image3->GetDepth() == 521);
|
||||
|
||||
// Verify the filenames. They should be absolute filenames now, so look for the wanted substrings.
|
||||
PassIf(strstr(TO_STRING(image1->GetFilename()).c_str(), "Texture1.jpg") != NULL);
|
||||
PassIf(strstr(TO_STRING(image2->GetFilename()).c_str(), "Texture3D.jpg") != NULL);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDSceneNode.h"
|
||||
#include "FCDocument/FCDTransform.h"
|
||||
#include "FCTestExportImport.h"
|
||||
|
||||
static const float sampleMatrix[16] = { 0.0f, 2.0f, 0.4f, 2.0f, 7.0f, 0.2f, 991.0f, 2.5f, 11.0f, 25.0f, 1.55f, 0.02f, 0.001f, 12.0f, 1.02e-3f };
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
void FillVisualScene(FCDSceneNode* scene)
|
||||
{
|
||||
FCDSceneNode* child = scene->AddChildNode();
|
||||
FCDTRotation* rotation = (FCDTRotation*) child->AddTransform(FCDTransform::ROTATION);
|
||||
rotation->SetAxis(FMVector3::ZAxis);
|
||||
rotation->SetAngle(45.0f);
|
||||
FCDTTranslation* translation = (FCDTTranslation*) child->AddTransform(FCDTransform::TRANSLATION);
|
||||
translation->SetTranslation(0.0f, 4.0f, 6.0f);
|
||||
FCDTScale* scale = (FCDTScale*) child->AddTransform(FCDTransform::SCALE);
|
||||
scale->SetScale(FMVector3(3.0f, 0.5f, 2.0f));
|
||||
FCDTMatrix* matrix = (FCDTMatrix*) child->AddTransform(FCDTransform::MATRIX);
|
||||
matrix->SetTransform(FMMatrix44(sampleMatrix));
|
||||
FCDTLookAt* lookAt = (FCDTLookAt*) child->AddTransform(FCDTransform::LOOKAT);
|
||||
lookAt->SetPosition(1.0f, 2.0f, 3.0f);
|
||||
lookAt->SetTarget(5.0f, 6.0f, 9.0f);
|
||||
lookAt->SetUp(12.0f, 0.3f, 0.4f);
|
||||
FCDTSkew* skew = (FCDTSkew*) child->AddTransform(FCDTransform::SKEW);
|
||||
skew->SetAroundAxis(FMVector3::ZAxis);
|
||||
skew->SetRotateAxis(FMVector3::XAxis);
|
||||
skew->SetAngle(60.0f);
|
||||
}
|
||||
|
||||
void CheckVisualScene(FCDSceneNode* imported)
|
||||
{
|
||||
// NOTE: the transforms must be in the same order as the exported order.
|
||||
|
||||
PassIf(imported->GetChildrenCount() == 1);
|
||||
PassIf(imported->GetParent() == NULL);
|
||||
FCDSceneNode* child = imported->GetChild(0);
|
||||
FailIf(child == NULL);
|
||||
PassIf(child->GetParent() == imported);
|
||||
PassIf(child->GetTransformCount() == 6);
|
||||
|
||||
FCDTransform* transform = child->GetTransform(0);
|
||||
FailIf(transform == NULL);
|
||||
FailIf(transform->GetParent() != child);
|
||||
PassIf(transform->GetType() == FCDTransform::ROTATION);
|
||||
FCDTRotation* rotation = (FCDTRotation*) transform;
|
||||
PassIf(IsEquivalent(rotation->GetAxis(), FMVector3::ZAxis));
|
||||
PassIf(IsEquivalent(rotation->GetAngle(), 45.0f));
|
||||
|
||||
transform = child->GetTransform(1);
|
||||
FailIf(transform == NULL);
|
||||
FailIf(transform->GetParent() != child);
|
||||
PassIf(transform->GetType() == FCDTransform::TRANSLATION);
|
||||
FCDTTranslation* translation = (FCDTTranslation*) transform;
|
||||
PassIf(IsEquivalent(translation->GetTranslation(), FMVector3(0.0f, 4.0f, 6.0f)));
|
||||
|
||||
transform = child->GetTransform(2);
|
||||
FailIf(transform == NULL);
|
||||
FailIf(transform->GetParent() != child);
|
||||
PassIf(transform->GetType() == FCDTransform::SCALE);
|
||||
FCDTScale* scale = (FCDTScale*) transform;
|
||||
PassIf(IsEquivalent(scale->GetScale(), FMVector3(3.0f, 0.5f, 2.0f)));
|
||||
|
||||
transform = child->GetTransform(3);
|
||||
FailIf(transform == NULL);
|
||||
FailIf(transform->GetParent() != child);
|
||||
PassIf(transform->GetType() == FCDTransform::MATRIX);
|
||||
FCDTMatrix* mx = (FCDTMatrix*) transform;
|
||||
PassIf(IsEquivalent(mx->GetTransform(), FMMatrix44(sampleMatrix)));
|
||||
|
||||
transform = child->GetTransform(4);
|
||||
FailIf(transform == NULL);
|
||||
FailIf(transform->GetParent() != child);
|
||||
PassIf(transform->GetType() == FCDTransform::LOOKAT);
|
||||
FCDTLookAt* lookAt = (FCDTLookAt*) transform;
|
||||
PassIf(IsEquivalent(lookAt->GetPosition(), FMVector3(1.0f, 2.0f, 3.0f)));
|
||||
PassIf(IsEquivalent(lookAt->GetTarget(), FMVector3(5.0f, 6.0f, 9.0f)));
|
||||
PassIf(IsEquivalent(lookAt->GetUp(), FMVector3(12.0f, 0.3f, 0.4f)));
|
||||
|
||||
transform = child->GetTransform(5);
|
||||
FailIf(transform == NULL);
|
||||
FailIf(transform->GetParent() != child);
|
||||
PassIf(transform->GetType() == FCDTransform::SKEW);
|
||||
FCDTSkew* skew = (FCDTSkew*) transform;
|
||||
PassIf(IsEquivalent(skew->GetAroundAxis(), FMVector3::ZAxis));
|
||||
PassIf(IsEquivalent(skew->GetRotateAxis(), FMVector3::XAxis));
|
||||
PassIf(IsEquivalent(skew->GetAngle(), 60.0f));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FCDocument/FCDocument.h"
|
||||
#include "FCDocument/FCDCamera.h"
|
||||
#include "FCDocument/FCDGeometry.h"
|
||||
#include "FCDocument/FCDGeometryMesh.h"
|
||||
#include "FCDocument/FCDGeometrySource.h"
|
||||
#include "FCDocument/FCDGeometrySpline.h"
|
||||
#include "FCDocument/FCDGeometryPolygons.h"
|
||||
#include "FCDocument/FCDLibrary.h"
|
||||
#include "FCDocument/FCDSceneNode.h"
|
||||
#include "FCDocument/FCDTransform.h"
|
||||
|
||||
#include "FCTestExportImport.h"
|
||||
using namespace FCTestExportImport;
|
||||
|
||||
// Test import of a code-generated scene, with library entities.
|
||||
// Does the export, re-import and validates that the information is intact.
|
||||
void TestUniqueScene()
|
||||
{
|
||||
// Write out a simple document with three visual scenes
|
||||
FCDocument* doc = new FCDocument();
|
||||
FCDSceneNode* sceneNode1 = doc->AddVisualScene();
|
||||
sceneNode1->SetName(FC("Scene1"));
|
||||
FCDSceneNode* sceneNode2 = doc->AddVisualScene();
|
||||
sceneNode2->SetName(FC("Scene2"));
|
||||
FCDSceneNode* sceneNode3 = doc->AddVisualScene();
|
||||
sceneNode3->SetName(FC("Scene3"));
|
||||
FillVisualScene(sceneNode2);
|
||||
|
||||
// Fill in the other libraries
|
||||
FillImageLibrary(doc->GetImageLibrary());
|
||||
FillCameraLibrary(doc->GetCameraLibrary());
|
||||
FillLightLibrary(doc->GetLightLibrary());
|
||||
FillGeometryLibrary(doc->GetGeometryLibrary());
|
||||
FillControllerLibrary(doc->GetControllerLibrary()); // must occur after FillGeometryLibrary.
|
||||
FillMaterialLibrary(doc->GetMaterialLibrary()); // must occur after FillImageLibrary.
|
||||
FillAnimationLibrary(doc->GetAnimationLibrary()); // must occur last.
|
||||
doc->WriteToFile(FC("TestOut.dae"));
|
||||
FailIf(sceneNode1->GetDaeId() == sceneNode2->GetDaeId());
|
||||
FailIf(sceneNode1->GetDaeId() == sceneNode3->GetDaeId());
|
||||
FailIf(sceneNode2->GetDaeId() == sceneNode3->GetDaeId());
|
||||
|
||||
// Import back this document
|
||||
FCDocument* idoc = new FCDocument();
|
||||
FUStatus stat = idoc->LoadFromFile(FC("TestOut.dae"));
|
||||
#ifdef _WIN32
|
||||
OutputDebugStringW(stat.GetErrorString());
|
||||
#endif
|
||||
PassIf(stat.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.
|
||||
for (size_t i = 0; i < vsl->GetEntityCount(); ++i)
|
||||
{
|
||||
FCDSceneNode* inode = vsl->GetEntity(i);
|
||||
for (size_t j = 0; j < i; ++j)
|
||||
{
|
||||
FCDSceneNode* jnode = vsl->GetEntity(j);
|
||||
FailIf(inode->GetDaeId() == jnode->GetDaeId());
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that the three wanted visual scene ids exist and find the one we fill in.
|
||||
bool found1 = false, found3 = false;
|
||||
FCDSceneNode* found2 = NULL;
|
||||
for (size_t i = 0; i < vsl->GetEntityCount(); ++i)
|
||||
{
|
||||
FCDSceneNode* inode = vsl->GetEntity(i);
|
||||
if (inode->GetDaeId() == sceneNode1->GetDaeId())
|
||||
{
|
||||
FailIf(found1);
|
||||
PassIf(inode->GetName() == FC("Scene1"));
|
||||
found1 = true;
|
||||
}
|
||||
else if (inode->GetDaeId() == sceneNode3->GetDaeId())
|
||||
{
|
||||
FailIf(found3);
|
||||
PassIf(inode->GetName() == FC("Scene3"));
|
||||
found3 = true;
|
||||
}
|
||||
else if (inode->GetDaeId() == sceneNode2->GetDaeId())
|
||||
{
|
||||
FailIf(found2 != NULL);
|
||||
PassIf(inode->GetName() == FC("Scene2"));
|
||||
found2 = inode;
|
||||
}
|
||||
}
|
||||
PassIf(found2 != NULL);
|
||||
CheckVisualScene(found2);
|
||||
|
||||
// Compare all these re-imported library contents
|
||||
CheckImageLibrary(idoc->GetImageLibrary());
|
||||
CheckCameraLibrary(idoc->GetCameraLibrary());
|
||||
CheckLightLibrary(idoc->GetLightLibrary());
|
||||
CheckGeometryLibrary(idoc->GetGeometryLibrary());
|
||||
CheckControllerLibrary(idoc->GetControllerLibrary());
|
||||
CheckMaterialLibrary(idoc->GetMaterialLibrary());
|
||||
CheckAnimationLibrary(idoc->GetAnimationLibrary());
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (C) 2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#ifndef _FC_TEST_SCENE_
|
||||
#define _FC_TEST_SCENE_
|
||||
|
||||
#include "FCDocument/FCDocument.h"
|
||||
#include "FCDocument/FCDLibrary.h"
|
||||
|
||||
class FCDAnimation;
|
||||
class FCDEffectProfileFX;
|
||||
class FCDEffectStandard;
|
||||
class FCDExtra;
|
||||
class FCDGeometryMesh;
|
||||
class FCDGeometrySpline;
|
||||
class FCDMorphController;
|
||||
class FCDSceneNode;
|
||||
class FCDSkinController;
|
||||
|
||||
namespace FCTestExportImport
|
||||
{
|
||||
// Information pushing functions for the export
|
||||
void FillCameraLibrary(FCDCameraLibrary* library);
|
||||
void FillLightLibrary(FCDLightLibrary* library);
|
||||
void FillVisualScene(FCDSceneNode* scene);
|
||||
void FillExtraTree(FCDExtra* extra);
|
||||
|
||||
void FillGeometryLibrary(FCDGeometryLibrary* library);
|
||||
void FillGeometryMesh(FCDGeometryMesh* mesh);
|
||||
void FillGeometrySpline(FCDGeometrySpline* spline);
|
||||
void FillControllerLibrary(FCDControllerLibrary* library);
|
||||
void FillControllerMorph(FCDMorphController* controller);
|
||||
void FillControllerSkin(FCDSkinController* controller);
|
||||
|
||||
void FillImageLibrary(FCDImageLibrary* library);
|
||||
void FillMaterialLibrary(FCDMaterialLibrary* library);
|
||||
void FillEffectStandard(FCDEffectStandard* profile);
|
||||
void FillEffectFX(FCDEffectProfileFX* profile);
|
||||
|
||||
void FillAnimationLibrary(FCDAnimationLibrary* library);
|
||||
void FillAnimationLight(FCDocument* document, FCDAnimation* animationTree);
|
||||
|
||||
// Re-import verification functions
|
||||
void CheckCameraLibrary(FCDCameraLibrary* library);
|
||||
void CheckLightLibrary(FCDLightLibrary* library);
|
||||
void CheckVisualScene(FCDSceneNode* imported);
|
||||
void CheckExtraTree(FCDExtra* extra);
|
||||
|
||||
void CheckGeometryLibrary(FCDGeometryLibrary* library);
|
||||
void CheckGeometryMesh(FCDGeometryMesh* mesh);
|
||||
void CheckGeometrySpline(FCDGeometrySpline* spline);
|
||||
void CheckControllerLibrary(FCDControllerLibrary* library);
|
||||
void CheckControllerMorph(FCDMorphController* controller);
|
||||
void CheckControllerSkin(FCDSkinController* controller);
|
||||
|
||||
void CheckImageLibrary(FCDImageLibrary* library);
|
||||
void CheckMaterialLibrary(FCDMaterialLibrary* library);
|
||||
void CheckEffectStandard(FCDEffectStandard* profile);
|
||||
void CheckEffectFX(FCDEffectProfileFX* profile);
|
||||
|
||||
void CheckAnimationLibrary(FCDAnimationLibrary* library);
|
||||
void CheckAnimationLight(FCDocument* document, FCDAnimation* animationTree);
|
||||
};
|
||||
|
||||
#endif // _FC_TEST_SCENE_
|
||||
17
Extras/FCollada/FColladaTest/FCTestList.h
Normal file
17
Extras/FCollada/FColladaTest/FCTestList.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
Copyright (C) 2005-2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
/* It is intentional that there is no multiple #include barrier here. */
|
||||
/* This function is included directly twice by FCTest.cpp */
|
||||
|
||||
// FCTestUtils.cpp
|
||||
FCTEST(TestUniqueStringMap);
|
||||
|
||||
// FCTestAnimation.cpp
|
||||
FCTEST(TestImportSampling);
|
||||
|
||||
// FCTestScene.cpp
|
||||
FCTEST(TestUniqueScene);
|
||||
71
Extras/FCollada/FColladaTest/FCTestUtils.cpp
Normal file
71
Extras/FCollada/FColladaTest/FCTestUtils.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (C) 2005-2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "FUtils/FUUniqueStringMap.h"
|
||||
|
||||
void TestUniqueStringMap()
|
||||
{
|
||||
#define VERIFY_UNIQUE(c) { for (StringList::iterator itN = uniqueNames.begin(); itN != uniqueNames.end(); ++itN) { FailIf((*itN) == (c)); } }
|
||||
StringList uniqueNames;
|
||||
|
||||
FUSUniqueStringMap names;
|
||||
FailIf(names.Exists("Test"));
|
||||
FailIf(names.Exists("Test0"));
|
||||
FailIf(names.Exists("Test1"));
|
||||
FailIf(names.Exists("Test2"));
|
||||
|
||||
// Add a first name: should always be unique
|
||||
string name1 = "Test";
|
||||
names.AddUniqueString(name1);
|
||||
PassIf(names.Exists("Test"));
|
||||
PassIf(name1 == "Test");
|
||||
uniqueNames.push_back(name1);
|
||||
|
||||
// Add a second name that should also be unique
|
||||
string name2 = "Glad";
|
||||
names.AddUniqueString(name2);
|
||||
PassIf(names.Exists("Glad"));
|
||||
PassIf(name2 == "Glad");
|
||||
uniqueNames.push_back(name2);
|
||||
|
||||
// Add the first name a couple more times
|
||||
string name3 = name1;
|
||||
names.AddUniqueString(name3);
|
||||
PassIf(names.Exists(name3));
|
||||
VERIFY_UNIQUE(name3);
|
||||
uniqueNames.push_back(name3);
|
||||
|
||||
name3 = name1;
|
||||
names.AddUniqueString(name3);
|
||||
PassIf(names.Exists(name3));
|
||||
VERIFY_UNIQUE(name3);
|
||||
uniqueNames.push_back(name3);
|
||||
|
||||
// Add the second name a couple more times
|
||||
name3 = name2;
|
||||
names.AddUniqueString(name3);
|
||||
PassIf(names.Exists(name3));
|
||||
VERIFY_UNIQUE(name3);
|
||||
uniqueNames.push_back(name3);
|
||||
|
||||
name3 = name2;
|
||||
names.AddUniqueString(name3);
|
||||
PassIf(names.Exists(name3));
|
||||
VERIFY_UNIQUE(name3);
|
||||
uniqueNames.push_back(name3);
|
||||
|
||||
// There should now be 6 unique names, so pick some randomly and verify that we're always getting more unique names.
|
||||
for (int32 i = 0; i < 5; ++i)
|
||||
{
|
||||
int32 index = rand() % ((int32)uniqueNames.size());
|
||||
name3 = uniqueNames[index];
|
||||
names.AddUniqueString(name3);
|
||||
PassIf(names.Exists(name3));
|
||||
VERIFY_UNIQUE(name3);
|
||||
uniqueNames.push_back(name3);
|
||||
}
|
||||
}
|
||||
1899
Extras/FCollada/FColladaTest/Samples/Eagle.DAE
Normal file
1899
Extras/FCollada/FColladaTest/Samples/Eagle.DAE
Normal file
File diff suppressed because it is too large
Load Diff
7
Extras/FCollada/FColladaTest/StdAfx.cpp
Normal file
7
Extras/FCollada/FColladaTest/StdAfx.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
Copyright (C) 2005-2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
20
Extras/FCollada/FColladaTest/StdAfx.h
Normal file
20
Extras/FCollada/FColladaTest/StdAfx.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (C) 2005-2006 Feeling Software Inc.
|
||||
Available only to licensees.
|
||||
Distribution of this file or its content is strictly prohibited.
|
||||
*/
|
||||
|
||||
#ifndef _STDAFX_H_
|
||||
#define _STDAFX_H_
|
||||
|
||||
// FCollada
|
||||
#include "FCollada.h"
|
||||
#include "FUtils/FUAssert.h"
|
||||
|
||||
// STL
|
||||
#include <iostream>
|
||||
|
||||
// FColladaTest
|
||||
#include "FCTest.h"
|
||||
|
||||
#endif // _STDAFX_H_
|
||||
Reference in New Issue
Block a user