Merge branch 'master' into MemoryOptimizationForGLTFWithSharedAttr
BIN
test/models-nonbsd/BLEND/guard1_body.png
Normal file
|
After Width: | Height: | Size: 228 KiB |
BIN
test/models-nonbsd/BLEND/guard1_face.png
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
test/models-nonbsd/BLEND/guard1_helmet.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
test/models-nonbsd/BLEND/iron_grill.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
test/models-nonbsd/BLEND/round_grill.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
test/models-nonbsd/IRR/skybox_UTF16LE.xml
Normal file
BIN
test/models/COB/axe.jpg
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
test/models/COB/dwarf.jpg
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
test/models/COB/dwarf2.jpg
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
test/models/IRR/1.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
test/models/IRR/EpisodeII_TheDwarfesStrikeBack_UTF16LE.irr
Normal file
BIN
test/models/IRR/EpisodeI_ANewDwarf_UTF16LE.irr
Normal file
BIN
test/models/IRR/animMesh_UTF16LE.irr
Normal file
BIN
test/models/IRR/box_UTF16LE.irr
Normal file
BIN
test/models/IRR/brownground_1-1.jpg
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
test/models/IRR/crackedground_1-6.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
test/models/IRR/dawfInCellar_ChildOfCellar_UTF16LE.irr
Normal file
BIN
test/models/IRR/dawfInCellar_SameHierarchy_UTF16LE.irr
Normal file
BIN
test/models/IRR/multipleAnimators_UTF16LE.irr
Normal file
BIN
test/models/IRR/scenegraphAnim_UTF16LE.irr
Normal file
BIN
test/models/IRR/sphere_UTF16LE.irr
Normal file
BIN
test/models/IRRMesh/cellar_UTF16LE.irrmesh
Normal file
BIN
test/models/IRRMesh/spider_UTF16LE.irrmesh
Normal file
BIN
test/models/IRRMesh/testFormatDetection_UTF16LE.xml
Normal file
BIN
test/models/MDL/MDL (HL1)/multiple_roots.mdl
Normal file
@@ -190,7 +190,7 @@ private:
|
||||
Assimp::Importer importer;
|
||||
importer.SetPropertyBool(setting_key, setting_value);
|
||||
const aiScene *scene = importer.ReadFile(file_path, aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
func(scene);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ public:
|
||||
void flatShadeTexture() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "chrome_sphere.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
aiShadingMode shading_mode = aiShadingMode_Flat;
|
||||
scene->mMaterials[0]->Get(AI_MATKEY_SHADING_MODEL, shading_mode);
|
||||
@@ -74,8 +74,8 @@ public:
|
||||
void chromeTexture() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "chrome_sphere.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
int chrome;
|
||||
scene->mMaterials[0]->Get(AI_MDL_HL1_MATKEY_CHROME(aiTextureType_DIFFUSE, 0), chrome);
|
||||
@@ -87,8 +87,8 @@ public:
|
||||
void additiveBlendTexture() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "blend_additive.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
aiBlendMode blend_mode = aiBlendMode_Default;
|
||||
scene->mMaterials[0]->Get(AI_MATKEY_BLEND_FUNC, blend_mode);
|
||||
@@ -101,8 +101,8 @@ public:
|
||||
void textureWithColorMask() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "alpha_test.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
int texture_flags = 0;
|
||||
scene->mMaterials[0]->Get(AI_MATKEY_TEXFLAGS_DIFFUSE(0), texture_flags);
|
||||
|
||||
@@ -55,6 +55,17 @@ using namespace Assimp;
|
||||
|
||||
class utMDLImporter_HL1_Nodes : public ::testing::Test {
|
||||
|
||||
/**
|
||||
* @note Represents a flattened node hierarchy where each item is a pair
|
||||
* containing the node level and it's name.
|
||||
*/
|
||||
using Hierarchy = std::vector<std::pair<unsigned int, std::string>>;
|
||||
|
||||
/**
|
||||
* @note A vector of strings. Used for symplifying syntax.
|
||||
*/
|
||||
using StringVector = std::vector<std::string>;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @note The following tests require a basic understanding
|
||||
@@ -63,6 +74,51 @@ public:
|
||||
* (Valve Developer Community).
|
||||
*/
|
||||
|
||||
// Given a model, verify that the bones nodes hierarchy is correctly formed.
|
||||
void checkBoneHierarchy() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "multiple_roots.mdl", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mRootNode);
|
||||
|
||||
// First, check that "<MDL_root>" and "<MDL_bones>" are linked.
|
||||
const aiNode* node_MDL_root = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_ROOT);
|
||||
ASSERT_NE(nullptr, node_MDL_root);
|
||||
|
||||
const aiNode *node_MDL_bones = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BONES);
|
||||
ASSERT_NE(nullptr, node_MDL_bones);
|
||||
ASSERT_NE(nullptr, node_MDL_bones->mParent);
|
||||
ASSERT_EQ(node_MDL_root, node_MDL_bones->mParent);
|
||||
|
||||
// Second, verify "<MDL_bones>" hierarchy.
|
||||
const Hierarchy expected_hierarchy = {
|
||||
{ 0, AI_MDL_HL1_NODE_BONES },
|
||||
{ 1, "root1_bone1" },
|
||||
{ 2, "root1_bone2" },
|
||||
{ 3, "root1_bone4" },
|
||||
{ 3, "root1_bone5" },
|
||||
{ 2, "root1_bone3" },
|
||||
{ 3, "root1_bone6" },
|
||||
{ 1, "root2_bone1" },
|
||||
{ 2, "root2_bone2" },
|
||||
{ 2, "root2_bone3" },
|
||||
{ 3, "root2_bone5" },
|
||||
{ 2, "root2_bone4" },
|
||||
{ 3, "root2_bone6" },
|
||||
{ 1, "root3_bone1" },
|
||||
{ 2, "root3_bone2" },
|
||||
{ 2, "root3_bone3" },
|
||||
{ 2, "root3_bone4" },
|
||||
{ 3, "root3_bone5" },
|
||||
{ 4, "root3_bone6" },
|
||||
{ 4, "root3_bone7" },
|
||||
};
|
||||
|
||||
Hierarchy actual_hierarchy;
|
||||
flatten_hierarchy(node_MDL_bones, actual_hierarchy);
|
||||
ASSERT_EQ(expected_hierarchy, actual_hierarchy);
|
||||
}
|
||||
|
||||
/* Given a model with bones that have empty names,
|
||||
verify that all the bones of the imported model
|
||||
have unique and no empty names.
|
||||
@@ -80,9 +136,9 @@ public:
|
||||
void emptyBonesNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_bones.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_bones_names = {
|
||||
const StringVector expected_bones_names = {
|
||||
"Bone",
|
||||
"Bone_0",
|
||||
"Bone_1",
|
||||
@@ -94,7 +150,9 @@ public:
|
||||
"Bone_7"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_BONES, expected_bones_names);
|
||||
StringVector actual_bones_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BONES), actual_bones_names);
|
||||
ASSERT_EQ(expected_bones_names, actual_bones_names);
|
||||
}
|
||||
|
||||
/* Given a model with bodyparts that have empty names,
|
||||
@@ -114,9 +172,9 @@ public:
|
||||
void emptyBodypartsNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_bodyparts.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_bodyparts_names = {
|
||||
const StringVector expected_bodyparts_names = {
|
||||
"Bodypart",
|
||||
"Bodypart_1",
|
||||
"Bodypart_5",
|
||||
@@ -128,7 +186,10 @@ public:
|
||||
"Bodypart_7"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_BODYPARTS, expected_bodyparts_names);
|
||||
StringVector actual_bodyparts_names;
|
||||
// Get the bodyparts names "without" the submodels.
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BODYPARTS), actual_bodyparts_names, 0);
|
||||
ASSERT_EQ(expected_bodyparts_names, actual_bodyparts_names);
|
||||
}
|
||||
|
||||
/* Given a model with bodyparts that have duplicate names,
|
||||
@@ -148,9 +209,9 @@ public:
|
||||
void duplicateBodypartsNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_bodyparts.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_bodyparts_names = {
|
||||
const StringVector expected_bodyparts_names = {
|
||||
"Bodypart",
|
||||
"Bodypart_1",
|
||||
"Bodypart_2",
|
||||
@@ -162,7 +223,10 @@ public:
|
||||
"Bodypart_4"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_BODYPARTS, expected_bodyparts_names);
|
||||
StringVector actual_bodyparts_names;
|
||||
// Get the bodyparts names "without" the submodels.
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BODYPARTS), actual_bodyparts_names, 0);
|
||||
ASSERT_EQ(expected_bodyparts_names, actual_bodyparts_names);
|
||||
}
|
||||
|
||||
/* Given a model with several bodyparts that contains multiple
|
||||
@@ -190,9 +254,9 @@ public:
|
||||
void duplicateSubModelsNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_submodels.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::vector<std::string>> expected_bodypart_sub_models_names = {
|
||||
const std::vector<StringVector> expected_bodypart_sub_models_names = {
|
||||
{
|
||||
"triangle",
|
||||
"triangle_0",
|
||||
@@ -208,11 +272,15 @@ public:
|
||||
};
|
||||
|
||||
const aiNode *bodyparts_node = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BODYPARTS);
|
||||
EXPECT_NE(nullptr, bodyparts_node);
|
||||
ASSERT_NE(nullptr, bodyparts_node);
|
||||
EXPECT_EQ(3u, bodyparts_node->mNumChildren);
|
||||
for (unsigned int i = 0; i < bodyparts_node->mNumChildren; ++i) {
|
||||
expect_named_children(bodyparts_node->mChildren[i],
|
||||
expected_bodypart_sub_models_names[i]);
|
||||
|
||||
StringVector actual_submodels_names;
|
||||
for (unsigned int i = 0; i < bodyparts_node->mNumChildren; ++i)
|
||||
{
|
||||
actual_submodels_names.clear();
|
||||
get_node_children_names(bodyparts_node->mChildren[i], actual_submodels_names);
|
||||
ASSERT_EQ(expected_bodypart_sub_models_names[i], actual_submodels_names);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,9 +301,9 @@ public:
|
||||
void duplicateSequenceNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_sequences.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"idle_1",
|
||||
"idle",
|
||||
"idle_2",
|
||||
@@ -247,7 +315,9 @@ public:
|
||||
"idle_7"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_INFOS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_INFOS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Given a model with sequences that have empty names, verify
|
||||
@@ -267,9 +337,9 @@ public:
|
||||
void emptySequenceNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_sequences.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"Sequence",
|
||||
"Sequence_1",
|
||||
"Sequence_0",
|
||||
@@ -281,7 +351,9 @@ public:
|
||||
"Sequence_6"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_INFOS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_INFOS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Given a model with sequence groups that have duplicate names,
|
||||
@@ -302,9 +374,9 @@ public:
|
||||
void duplicateSequenceGroupNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_sequence_groups/duplicate_sequence_groups.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"default",
|
||||
"SequenceGroup",
|
||||
"SequenceGroup_1",
|
||||
@@ -317,7 +389,9 @@ public:
|
||||
"SequenceGroup_2"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_GROUPS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_GROUPS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Given a model with sequence groups that have empty names,
|
||||
@@ -338,9 +412,9 @@ public:
|
||||
void emptySequenceGroupNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_sequence_groups/unnamed_sequence_groups.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"default",
|
||||
"SequenceGroup",
|
||||
"SequenceGroup_2",
|
||||
@@ -353,7 +427,9 @@ public:
|
||||
"SequenceGroup_4"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_GROUPS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_GROUPS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Verify that mOffsetMatrix applies the correct
|
||||
@@ -364,7 +440,7 @@ public:
|
||||
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(MDL_HL1_FILE_MAN, aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
aiNode *scene_bones_node = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BONES);
|
||||
|
||||
@@ -398,26 +474,58 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void expect_named_children(const aiNode *parent_node, const std::vector<std::string> &expected_names) {
|
||||
EXPECT_NE(nullptr, parent_node);
|
||||
EXPECT_EQ(expected_names.size(), parent_node->mNumChildren);
|
||||
|
||||
for (unsigned int i = 0; i < parent_node->mNumChildren; ++i)
|
||||
EXPECT_EQ(expected_names[i], parent_node->mChildren[i]->mName.C_Str());
|
||||
}
|
||||
|
||||
void expect_named_children(const aiScene *scene, const char *node_name, const std::vector<std::string> &expected_names) {
|
||||
expect_named_children(scene->mRootNode->FindNode(node_name), expected_names);
|
||||
}
|
||||
|
||||
void expect_equal_matrices(const aiMatrix4x4 &expected, const aiMatrix4x4 &actual, float abs_error) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
for (int j = 0; j < 4; ++j)
|
||||
EXPECT_NEAR(expected[i][j], actual[i][j], abs_error);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get a flattened representation of a node's hierarchy.
|
||||
* \param[in] node The node.
|
||||
* \param[out] hierarchy The flattened node's hierarchy.
|
||||
*/
|
||||
void flatten_hierarchy(const aiNode *node, Hierarchy &hierarchy)
|
||||
{
|
||||
flatten_hierarchy_impl(node, hierarchy, 0);
|
||||
}
|
||||
|
||||
void flatten_hierarchy_impl(const aiNode *node, Hierarchy &hierarchy, unsigned int level)
|
||||
{
|
||||
hierarchy.push_back({ level, node->mName.C_Str() });
|
||||
for (size_t i = 0; i < node->mNumChildren; ++i)
|
||||
{
|
||||
flatten_hierarchy_impl(node->mChildren[i], hierarchy, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get all node's children names beneath max_level.
|
||||
* \param[in] node The parent node from which to get all children names.
|
||||
* \param[out] names The list of children names.
|
||||
* \param[in] max_level If set to -1, all children names will be collected.
|
||||
*/
|
||||
void get_node_children_names(const aiNode *node, StringVector &names, const int max_level = -1)
|
||||
{
|
||||
get_node_children_names_impl(node, names, 0, max_level);
|
||||
}
|
||||
|
||||
void get_node_children_names_impl(const aiNode *node, StringVector &names, int level, const int max_level = -1)
|
||||
{
|
||||
for (size_t i = 0; i < node->mNumChildren; ++i)
|
||||
{
|
||||
names.push_back(node->mChildren[i]->mName.C_Str());
|
||||
if (max_level == -1 || level < max_level)
|
||||
{
|
||||
get_node_children_names_impl(node->mChildren[i], names, level + 1, max_level);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(utMDLImporter_HL1_Nodes, checkBoneHierarchy) {
|
||||
checkBoneHierarchy();
|
||||
}
|
||||
|
||||
TEST_F(utMDLImporter_HL1_Nodes, emptyBonesNames) {
|
||||
emptyBonesNames();
|
||||
}
|
||||
|
||||
@@ -65,3 +65,24 @@ TEST(ut3DImportExport, importBoxUC) {
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box.uc", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST(ut3DImportExport, importMarRifle) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3D/mar_rifle.uc", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST(ut3DImportExport, importMarRifleA) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3D/mar_rifle_a.3d", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST(ut3DImportExport, importMarRifleD) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3D/mar_rifle_d.3d", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
@@ -70,3 +70,115 @@ TEST_F(ut3DSImportExport, import3DSformatdetection) {
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCameraRollAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/CameraRollAnim.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCameraRollAnimWithChildObject) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/CameraRollAnimWithChildObject.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCubesWithAlpha) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/cubes_with_alpha.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCubeWithDiffuseTexture) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/cube_with_diffuse_texture.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCubeWithSpecularTexture) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/cube_with_specular_texture.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importRotatingCube) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/RotatingCube.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importTargetCameraAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/TargetCameraAnim.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importTest1) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/test1.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCartWheel) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/cart_wheel.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importGranate) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/Granate.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importJeep1) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/jeep1.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importMarRifle) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/mar_rifle.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importMp5Sil) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/mp5_sil.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importPyramob) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/pyramob.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,81 @@ TEST_F(utAMFImportExport, importAMFFromFileTest) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
||||
|
||||
// TODO: test models-nonbsd/AMF/3_bananas.amf.7z
|
||||
// requires uncompressing it in memory and we don't currently have 7z decompressor
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest2) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test2.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest3) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test3.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest4) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test4.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest5) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test5.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest5a) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test5a.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest6) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test6.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest7) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test7.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// FIXME: these tests are disabled because they leak memory in AMFImporter_Postprocess.cpp
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest8) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test8.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest9) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test9.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
#endif // 0
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importAMFWithMatFromFileTest) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test_with_mat.amf", aiProcess_ValidateDataStructure);
|
||||
|
||||
@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
@@ -63,3 +64,112 @@ public:
|
||||
TEST_F(utASEImportExport, importACFromFileTest) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importAnim1) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/anim.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importAnim2) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/anim2.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importCameraRollAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/CameraRollAnim.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importMotionCaptureROM) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/MotionCaptureROM.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importRotatingCube) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/RotatingCube.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importTargetCameraAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TargetCameraAnim.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importTestFormatDetection) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestFormatDetection", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importThreeCubesGreen) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
::Assimp::Importer importerLE;
|
||||
const aiScene *sceneLE = importerLE.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen_UTF16LE.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, sceneLE);
|
||||
|
||||
::Assimp::Importer importerBE;
|
||||
const aiScene *sceneBE = importerBE.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen_UTF16BE.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, sceneBE);
|
||||
|
||||
// TODO: these scenes should probably be identical
|
||||
// verify that is the case and then add tests to check it
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_Normal) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_Normal.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_ScaleUV1_2_OffsetUV0_0_9_Rotate_72_mirrorU) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_ScaleUV1-2_OffsetUV0-0.9_Rotate-72_mirrorU.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_ScaleUV2x) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_ScaleUV2x.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_ScaleUV2x_Rotate45) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_ScaleUV2x_Rotate45.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,20 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(utBVHImportExport, importBlenFromFileTest) {
|
||||
TEST_F(utBVHImportExport, import01_01) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utBVHImportExport, import01_03) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BVH/01_03.bvh", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utBVHImportExport, importBoxingToes) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BVH/Boxing_Toes.bvh", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
@@ -71,3 +71,17 @@ TEST_F(utDXFImporterExporter, issue2229) {
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/DXF/issue_2229.dxf", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utDXFImporterExporter, importWuson) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/DXF/wuson.dxf", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utDXFImporterExporter, importRifle) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/DXF/rifle.dxf", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||