Skip to content

Commit

Permalink
Merge pull request #183 from KhronosGroup/fix-no-image-reference
Browse files Browse the repository at this point in the history
Don't make textures if there is no image backing it
  • Loading branch information
lasalvavida authored Apr 23, 2018
2 parents 08447f5 + fccd8a5 commit 1ed629e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Change Log
##### Fixes :wrench:
* Upgrade to Draco 1.2.5 [#179](https://github.com/KhronosGroup/COLLADA2GLTF/pull/179)
* Fix issue with exporting normal maps [#182](https://github.com/KhronosGroup/COLLADA2GLTF/pull/182)
* Fix issue with COLLADA textures with no backing image [#183](https://github.com/KhronosGroup/COLLADA2GLTF/pull/183)

### v2.1.1 - 2018-04-04

Expand Down
9 changes: 7 additions & 2 deletions src/COLLADA2GLTFWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,15 @@ void packColladaColor(COLLADAFW::Color color, float* packArray) {
}

GLTF::Texture* COLLADA2GLTF::Writer::fromColladaTexture(const COLLADAFW::EffectCommon* effectCommon, COLLADAFW::SamplerID samplerId) {
GLTF::Texture* texture = new GLTF::Texture();
const COLLADAFW::SamplerPointerArray& samplers = effectCommon->getSamplerPointerArray();
COLLADAFW::Sampler* colladaSampler = (COLLADAFW::Sampler*)samplers[samplerId];
GLTF::Image* image = _images[colladaSampler->getSourceImage()];
std::map<COLLADAFW::UniqueId, GLTF::Image*>::iterator findImage = _images.find(colladaSampler->getSourceImage());
if (findImage == _images.end()) {
return NULL;
}
GLTF::Texture* texture = new GLTF::Texture();
GLTF::Image* image = findImage->second;

texture->source = image;
texture->sampler = _asset->globalSampler;
return texture;
Expand Down

0 comments on commit 1ed629e

Please sign in to comment.