|
@@ -121,6 +121,21 @@ bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool
|
|
|
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)
|
|
|
//{
|
|
@@ -198,8 +213,10 @@ inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset&
|
|
|
mat->AddProperty(&name, AI_MATKEY_GLTF_MAPPINGNAME(texType, texSlot));
|
|
|
mat->AddProperty(&id, AI_MATKEY_GLTF_MAPPINGID(texType, texSlot));
|
|
|
|
|
|
- mat->AddProperty(&sampler->wrapS, 1, AI_MATKEY_MAPPINGMODE_U(texType, texSlot));
|
|
|
- mat->AddProperty(&sampler->wrapT, 1, AI_MATKEY_MAPPINGMODE_V(texType, texSlot));
|
|
|
+ aiTextureMapMode wrapS = ConvertWrappingMode(sampler->wrapS);
|
|
|
+ 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) {
|
|
|
mat->AddProperty(&sampler->magFilter, 1, AI_MATKEY_GLTF_MAPPINGFILTER_MAG(texType, texSlot));
|