Merge branch 'master' into master
commit
2b18903f12
|
@ -121,6 +121,21 @@ bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static aiTextureMapMode ConvertWrappingMode(SamplerWrap gltfWrapMode)
|
||||||
|
{
|
||||||
|
switch (gltfWrapMode) {
|
||||||
|
case SamplerWrap::Mirrored_Repeat:
|
||||||
|
return aiTextureMapMode_Mirror;
|
||||||
|
|
||||||
|
case SamplerWrap::Clamp_To_Edge:
|
||||||
|
return aiTextureMapMode_Clamp;
|
||||||
|
|
||||||
|
case SamplerWrap::UNSET:
|
||||||
|
case SamplerWrap::Repeat:
|
||||||
|
default:
|
||||||
|
return aiTextureMapMode_Wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//static void CopyValue(const glTF2::vec3& v, aiColor3D& out)
|
//static void CopyValue(const glTF2::vec3& v, aiColor3D& out)
|
||||||
//{
|
//{
|
||||||
|
@ -198,8 +213,10 @@ inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset&
|
||||||
mat->AddProperty(&name, AI_MATKEY_GLTF_MAPPINGNAME(texType, texSlot));
|
mat->AddProperty(&name, AI_MATKEY_GLTF_MAPPINGNAME(texType, texSlot));
|
||||||
mat->AddProperty(&id, AI_MATKEY_GLTF_MAPPINGID(texType, texSlot));
|
mat->AddProperty(&id, AI_MATKEY_GLTF_MAPPINGID(texType, texSlot));
|
||||||
|
|
||||||
mat->AddProperty(&sampler->wrapS, 1, AI_MATKEY_MAPPINGMODE_U(texType, texSlot));
|
aiTextureMapMode wrapS = ConvertWrappingMode(sampler->wrapS);
|
||||||
mat->AddProperty(&sampler->wrapT, 1, AI_MATKEY_MAPPINGMODE_V(texType, texSlot));
|
aiTextureMapMode wrapT = ConvertWrappingMode(sampler->wrapT);
|
||||||
|
mat->AddProperty(&wrapS, 1, AI_MATKEY_MAPPINGMODE_U(texType, texSlot));
|
||||||
|
mat->AddProperty(&wrapT, 1, AI_MATKEY_MAPPINGMODE_V(texType, texSlot));
|
||||||
|
|
||||||
if (sampler->magFilter != SamplerMagFilter::UNSET) {
|
if (sampler->magFilter != SamplerMagFilter::UNSET) {
|
||||||
mat->AddProperty(&sampler->magFilter, 1, AI_MATKEY_GLTF_MAPPINGFILTER_MAG(texType, texSlot));
|
mat->AddProperty(&sampler->magFilter, 1, AI_MATKEY_GLTF_MAPPINGFILTER_MAG(texType, texSlot));
|
||||||
|
|
|
@ -146,8 +146,8 @@
|
||||||
{
|
{
|
||||||
"magFilter": 9729,
|
"magFilter": 9729,
|
||||||
"minFilter": 9986,
|
"minFilter": 9986,
|
||||||
"wrapS": 10497,
|
"wrapS": 33648,
|
||||||
"wrapT": 10497
|
"wrapT": 33071
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bufferViews": [
|
"bufferViews": [
|
||||||
|
|
|
@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -54,7 +55,21 @@ public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure);
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure);
|
||||||
return nullptr != scene;
|
EXPECT_NE( scene, nullptr );
|
||||||
|
if ( !scene ) return false;
|
||||||
|
|
||||||
|
EXPECT_TRUE( scene->HasMaterials() );
|
||||||
|
if ( !scene->HasMaterials() ) return false;
|
||||||
|
const aiMaterial *material = scene->mMaterials[0];
|
||||||
|
|
||||||
|
aiString path;
|
||||||
|
aiTextureMapMode modes[2];
|
||||||
|
EXPECT_EQ( aiReturn_SUCCESS, material->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes) );
|
||||||
|
EXPECT_STREQ( path.C_Str(), "CesiumLogoFlat.png" );
|
||||||
|
EXPECT_EQ( modes[0], aiTextureMapMode_Mirror );
|
||||||
|
EXPECT_EQ( modes[1], aiTextureMapMode_Clamp );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool binaryImporterTest() {
|
virtual bool binaryImporterTest() {
|
||||||
|
|
Loading…
Reference in New Issue