Merge pull request #2312 from LoicFr/master

Fix glTF2 export with no texture coordinates
pull/2317/head
Kim Kulling 2019-01-30 16:09:10 +01:00 committed by GitHub
commit e878560b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -732,6 +732,9 @@ void glTF2Exporter::ExportMeshes()
/************** Texture coordinates **************/ /************** Texture coordinates **************/
for (int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) { for (int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
if (!aim->HasTextureCoords(i))
continue;
// Flip UV y coords // Flip UV y coords
if (aim -> mNumUVComponents[i] > 1) { if (aim -> mNumUVComponents[i] > 1) {
for (unsigned int j = 0; j < aim->mNumVertices; ++j) { for (unsigned int j = 0; j < aim->mNumVertices; ++j) {
@ -967,7 +970,7 @@ void glTF2Exporter::ExportMetadata()
inline Ref<Accessor> GetSamplerInputRef(Asset& asset, std::string& animId, Ref<Buffer>& buffer, std::vector<float>& times) inline Ref<Accessor> GetSamplerInputRef(Asset& asset, std::string& animId, Ref<Buffer>& buffer, std::vector<float>& times)
{ {
return ExportData(asset, animId, buffer, times.size(), &times[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT); return ExportData(asset, animId, buffer, (unsigned int)times.size(), &times[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
} }
inline void ExtractTranslationSampler(Asset& asset, std::string& animId, Ref<Buffer>& buffer, const aiNodeAnim* nodeChannel, float ticksPerSecond, Animation::Sampler& sampler) inline void ExtractTranslationSampler(Asset& asset, std::string& animId, Ref<Buffer>& buffer, const aiNodeAnim* nodeChannel, float ticksPerSecond, Animation::Sampler& sampler)