Skip to content

Commit

Permalink
https://github.com/KhronosGroup/glTF/issues/195
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrobinet committed Jan 31, 2014
1 parent 3eb5004 commit 795a2b0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,8 @@ namespace GLTF

if (shouldExportTRS) {
GLTF::decomposeMatrix(matrix, translation, rotation, scale);
bool exportDefaultValues = converterContext.converterConfig()->boolForKeyPath("exportDefaultValues");

bool exportDefaultValues = CONFIG_BOOL("exportDefaultValues");
bool exportTranslation = !(!exportDefaultValues &&
((translation[0] == 0) && (translation[1] == 0) && (translation[2] == 0)));
if (exportTranslation)
Expand All @@ -987,7 +988,7 @@ namespace GLTF

} else {
//FIXME: OpenCOLLADA typo
bool exportMatrix = !((matrix.isIdentiy() && (converterContext.converterConfig()->boolForKeyPath("exportDefaultValues") == false) ));
bool exportMatrix = !((matrix.isIdentiy() && (CONFIG_BOOL("exportDefaultValues") == false) ));
if (exportMatrix)
nodeObject->setValue("matrix", this->serializeMatrix4Array(matrix));
}
Expand Down Expand Up @@ -1431,7 +1432,12 @@ namespace GLTF
textureObject->setString("source", imageUID);
textureObject->setString("sampler", samplerUID);
textureObject->setUnsignedInt32("format", profile->getGLenumForString("RGBA"));
textureObject->setUnsignedInt32("internalFormat", profile->getGLenumForString("RGBA"));

if (CONFIG_BOOL("exportDefaultValues")) {
textureObject->setUnsignedInt32("internalFormat", profile->getGLenumForString("RGBA"));
//UNSIGNED_BYTE is default https://github.com/KhronosGroup/glTF/issues/195
textureObject->setUnsignedInt32("type", profile->getGLenumForString("UNSIGNED_BYTE"));
}
textureObject->setUnsignedInt32("target", profile->getGLenumForString("TEXTURE_2D"));
textures->setValue(textureUID, textureObject);
}
Expand Down

0 comments on commit 795a2b0

Please sign in to comment.