|
@@ -99,14 +99,14 @@ const aiImporterDesc* glTF2Importer::GetInfo() const
|
|
|
return &desc;
|
|
|
}
|
|
|
|
|
|
-bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
|
|
+bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool /* checkSig */) const
|
|
|
{
|
|
|
const std::string &extension = GetExtension(pFile);
|
|
|
|
|
|
if (extension != "gltf" && extension != "glb")
|
|
|
return false;
|
|
|
|
|
|
- if (checkSig && pIOHandler) {
|
|
|
+ if (pIOHandler) {
|
|
|
glTF2::Asset asset(pIOHandler);
|
|
|
try {
|
|
|
asset.Load(pFile, extension == "glb");
|
|
@@ -211,6 +211,24 @@ inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset&
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset& r, glTF2::NormalTextureInfo& prop, aiMaterial* mat, aiTextureType texType, unsigned int texSlot = 0)
|
|
|
+{
|
|
|
+ SetMaterialTextureProperty( embeddedTexIdxs, r, (glTF2::TextureInfo) prop, mat, texType, texSlot );
|
|
|
+
|
|
|
+ if (prop.texture && prop.texture->source) {
|
|
|
+ mat->AddProperty(&prop.scale, 1, AI_MATKEY_GLTF_TEXTURE_SCALE(texType, texSlot));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset& r, glTF2::OcclusionTextureInfo& prop, aiMaterial* mat, aiTextureType texType, unsigned int texSlot = 0)
|
|
|
+{
|
|
|
+ SetMaterialTextureProperty( embeddedTexIdxs, r, (glTF2::TextureInfo) prop, mat, texType, texSlot );
|
|
|
+
|
|
|
+ if (prop.texture && prop.texture->source) {
|
|
|
+ mat->AddProperty(&prop.strength, 1, AI_MATKEY_GLTF_TEXTURE_STRENGTH(texType, texSlot));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static aiMaterial* ImportMaterial(std::vector<int>& embeddedTexIdxs, Asset& r, Material& mat)
|
|
|
{
|
|
|
aiMaterial* aimat = new aiMaterial();
|