Skip to content

Commit

Permalink
Merge pull request #24667 from akien-mga/fix-exr-alpha
Browse files Browse the repository at this point in the history
Fix loading EXR with alpha channel
  • Loading branch information
akien-mga committed Dec 30, 2018
2 parents 1d7b69e + 08f71ba commit 534044e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/tinyexr/image_loader_tinyexr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
Image::Format format;
int output_channels = 0;

if (idxA > 0) {
if (idxA != -1) {

imgdata.resize(exr_image.width * exr_image.height * 8); //RGBA16
format = Image::FORMAT_RGBAH;
Expand Down Expand Up @@ -187,7 +187,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
const float *b_channel_start = reinterpret_cast<const float *>(tile.images[idxB]);
const float *a_channel_start = NULL;

if (idxA > 0) {
if (idxA != -1) {
a_channel_start = reinterpret_cast<const float *>(tile.images[idxA]);
}

Expand Down Expand Up @@ -216,7 +216,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
*row_w++ = Math::make_half_float(color.g);
*row_w++ = Math::make_half_float(color.b);

if (idxA > 0) {
if (idxA != -1) {
*row_w++ = Math::make_half_float(*a_channel++);
}
}
Expand Down

0 comments on commit 534044e

Please sign in to comment.