-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple maps (#180)
* Add support for multiple maps * Fixed a few issues with mapping COLLADA sets -> semantics; added optimization for removing unused of multiple texture coordindates * Update CHANGES.md * Added GLTF::Asset test for removing unused semantics * Updated CHANGES.md
- Loading branch information
1 parent
34f55fe
commit 078f05f
Showing
9 changed files
with
174 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include "gtest/gtest.h" | ||
|
||
namespace { | ||
class GLTFAssetTest : public ::testing::Test {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "GLTFAsset.h" | ||
#include "GLTFAssetTest.h" | ||
|
||
TEST(GLTFAssetTest, RemoveUnusedSemantics) { | ||
GLTF::Asset* asset = new GLTF::Asset(); | ||
|
||
GLTF::Scene* scene = new GLTF::Scene(); | ||
asset->scenes.push_back(scene); | ||
asset->scene = 0; | ||
|
||
GLTF::Node* node = new GLTF::Node(); | ||
scene->nodes.push_back(node); | ||
|
||
GLTF::Mesh* mesh = new GLTF::Mesh(); | ||
node->mesh = mesh; | ||
|
||
GLTF::Primitive* primitive = new GLTF::Primitive(); | ||
mesh->primitives.push_back(primitive); | ||
|
||
GLTF::Material* material = new GLTF::Material(); | ||
primitive->material = material; | ||
|
||
// Add an unused texture coordinate attribute | ||
primitive->attributes["TEXCOORD_0"] = NULL; | ||
|
||
EXPECT_EQ(primitive->attributes.size(), 1); | ||
asset->removeUnusedSemantics(); | ||
EXPECT_EQ(primitive->attributes.size(), 0); | ||
|
||
// Add an unused and a used texture coordinaate | ||
primitive->attributes["TEXCOORD_0"] = NULL; | ||
primitive->attributes["TEXCOORD_1"] = (GLTF::Accessor*)1; | ||
|
||
material->values->ambientTexture = new GLTF::Texture(); | ||
material->values->ambientTexCoord = 1; | ||
|
||
EXPECT_EQ(primitive->attributes.size(), 2); | ||
asset->removeUnusedSemantics(); | ||
EXPECT_EQ(primitive->attributes.size(), 1); | ||
EXPECT_EQ(primitive->attributes["TEXCOORD_0"], (GLTF::Accessor*)1); | ||
EXPECT_EQ(material->values->ambientTexCoord, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters