diff --git a/src/gltf/TextureBuilder.cpp b/src/gltf/TextureBuilder.cpp index 32873ff..4329c5f 100644 --- a/src/gltf/TextureBuilder.cpp +++ b/src/gltf/TextureBuilder.cpp @@ -89,11 +89,10 @@ std::shared_ptr TextureBuilder::combine( int channels = includeAlphaChannel ? 4 : 3; std::vector mergedPixels(static_cast(channels * width * height)); - std::vector pixels(texes.size()); - std::vector pixelPointers(texes.size()); for (int xx = 0; xx < width; xx++) { for (int yy = 0; yy < height; yy++) { - pixels.clear(); + std::vector pixels(texes.size()); + std::vector pixelPointers(texes.size(), nullptr); for (int jj = 0; jj < texes.size(); jj++) { const TexInfo& tex = texes[jj]; // each texture's structure will depend on its channel count @@ -216,4 +215,4 @@ std::shared_ptr TextureBuilder::simple(int rawTexIndex, const std:: new TextureData(textureName, *gltf.defaultSampler, *gltf.images.hold(image))); textureByIndicesKey.insert(std::make_pair(key, texDat)); return texDat; -} \ No newline at end of file +}