Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
IMPORTANT: simplified interpolation/colorSpace. Now all imagebuffers …
Browse files Browse the repository at this point in the history
…are internally linear and optimized by default.

To avoid the "double RAM" requirement with the new "correct" texture interpolation, I've simplified the interpolation interface to remove the option "colorspace_interpolation_method" introduced in the previous commit. From now on, all image textures are stored in RAM as LinearRGB and no longer stored "as is". The "old-legacy" interpolation method used in old YafaRay versions will no longer be available.

From now on the user will be responsible for selecting correct ColorSpaces for all textures, including bump map, normal map, etc. For example for Non-RGB / Stencil / Bump / Normal maps, etc, textures are typically already linear and the user should select "linearRGB" in the texture properties, but if the user (by mistake) keeps the default sRGB for them, YafaRay will (incorrectly) apply the sRGB->LinearRGB conversion causing the values to be incorrect. However, I've added a "fail safe" so for any "float" textures, bump maps, normal maps, etc, when getting colors after interpolatio YafaRay will to a "inverse" color conversion to the original Color Space. This way, even a mistake in user's color space selection in bump maps, normal maps, etc, will not cause any significant problems in the image as they will be converted back to their original color space. However, in this case rendering will be slower and potential artifacts can appear due to interpolation taking place in the wrong color space. For optimal results, the user must select correctly the color space for all textures.

Also, all textures will be "optimized" by default. I think it's clear by now that optimized textures greatly improve memory usage and apparently don't cause slowdowns (might even make it slightly faster due to reduced RAM access?)

 Changes to be committed:
	modified:   include/core_api/imagehandler.h
	modified:   include/core_api/texture.h
	modified:   include/textures/basictex.h
	modified:   include/textures/imagetex.h
	modified:   src/backgrounds/textureback.cc
	modified:   src/bindings/yafaray_v3_interface.i
	modified:   src/image_handlers/exrHandler.cc
	modified:   src/image_handlers/hdrHandler.cc
	modified:   src/image_handlers/jpgHandler.cc
	modified:   src/image_handlers/pngHandler.cc
	modified:   src/image_handlers/tgaHandler.cc
	modified:   src/image_handlers/tifHandler.cc
	modified:   src/textures/basicnodes.cc
	modified:   src/textures/basictex.cc
	modified:   src/textures/imagetex.cc
	modified:   src/yafraycore/imagefilm.cc
	modified:   src/yafraycore/imagehandler.cc
  • Loading branch information
DavidBluecame committed Feb 17, 2017
1 parent 22f0ac8 commit 003d614
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 279 deletions.
44 changes: 20 additions & 24 deletions include/core_api/imagehandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,6 @@ enum textureOptimization_t
TEX_OPTIMIZATION_HALF_FLOAT = 4 //Only available if built with OpenEXR support
};

enum colorSpaceProcessing_t
{
CS_USE_RAW,
CS_GET_LINEAR
};

enum interpolationColorSpaceConversion_t
{
INTP_COLORSPACE_NONE_RAW,
INTP_COLORSPACE_GET_LINEAR_OLD_LEGACY,
INTP_COLORSPACE_GET_LINEAR_SPEED,
INTP_COLORSPACE_GET_LINEAR_MEMORY
};

enum interpolationType_t
{
INTP_NONE,
Expand Down Expand Up @@ -109,6 +95,7 @@ class YAFRAYCORE_EXPORT imageBuffer_t

colorA_t getColor(int x, int y) const;
void setColor(int x, int y, const colorA_t & col);
void setColor(int x, int y, const colorA_t & col, colorSpaces_t color_space, float gamma); // Set color after linearizing it from color space

protected:
int m_width;
Expand Down Expand Up @@ -144,19 +131,16 @@ class YAFRAYCORE_EXPORT imageHandler_t
int getTextureOptimization() { return m_textureOptimization; }
void setTextureOptimization(int texture_optimization) { m_textureOptimization = texture_optimization; }
void setGrayScaleSetting(bool grayscale) { m_grayscale = grayscale; }
int getWidth(int imgIndex = 0) { return imgBufferRaw.at(imgIndex)->getWidth(); }
int getHeight(int imgIndex = 0) { return imgBufferRaw.at(imgIndex)->getHeight(); }
int getWidth(int imgIndex = 0) { return imgBuffer.at(imgIndex)->getWidth(); }
int getHeight(int imgIndex = 0) { return imgBuffer.at(imgIndex)->getHeight(); }
std::string getDenoiseParams() const;
void generateMipMaps();
int getHighestImgIndex() const { return (int) imgBufferRaw.size() - 1; }
int getHighestImgIndex() const { return (int) imgBuffer.size() - 1; }
void setColorSpace(colorSpaces_t color_space, float gamma) { m_colorSpace = color_space; m_gamma = gamma; }
int getInterpolationColorSpaceConversion() const { return m_intp_colorspace_conversion; }
void setInterpolationColorSpaceConversion(int conversion) { m_intp_colorspace_conversion = conversion; }
void putPixel(int x, int y, const colorA_t &rgba, int imgIndex = 0);
colorA_t getPixel(int x, int y, colorSpaceProcessing_t colorSpaceProcessing, int imgIndex = 0);
colorA_t getPixel(int x, int y, int imgIndex = 0);
void initForOutput(int width, int height, const renderPasses_t *renderPasses, bool denoiseEnabled, int denoiseHLum, int denoiseHCol, float denoiseMix, bool withAlpha = false, bool multi_layer = false, bool grayscale = false);
void clearImgBuffers();
void createLinearBuffer();

protected:
std::string handlerName;
Expand All @@ -167,14 +151,12 @@ class YAFRAYCORE_EXPORT imageHandler_t
int m_textureOptimization = TEX_OPTIMIZATION_OPTIMIZED;
colorSpaces_t m_colorSpace = RAW_MANUAL_GAMMA;
float m_gamma = 1.f;
std::vector<imageBuffer_t *> imgBufferRaw;
std::vector<imageBuffer_t *> imgBufferLinear;
std::vector<imageBuffer_t *> imgBuffer;
bool m_MultiLayer = false;
bool m_Denoise = false;
int m_DenoiseHLum = 3;
int m_DenoiseHCol = 3;
float m_DenoiseMix = 0.8f; //!< Mix factor between the de-noised image and the original "noisy" image to avoid banding artifacts in images with all noise removed.
int m_intp_colorspace_conversion = INTP_COLORSPACE_GET_LINEAR_OLD_LEGACY;
};


Expand Down Expand Up @@ -282,6 +264,20 @@ inline void imageBuffer_t::setColor(int x, int y, const colorA_t & col)
}
}

inline void imageBuffer_t::setColor(int x, int y, const colorA_t & col, colorSpaces_t color_space, float gamma)
{
if(color_space == LINEAR_RGB || (color_space == RAW_MANUAL_GAMMA && gamma == 1.f))
{
setColor(x, y, col);
}
else
{
colorA_t colLinear = col;
colLinear.linearRGB_from_ColorSpace(color_space, gamma);
setColor(x, y, colLinear);
}
}

__END_YAFRAY

#endif
10 changes: 6 additions & 4 deletions include/core_api/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ class YAFRAYCORE_EXPORT texture_t
virtual bool isThreeD() const { return true; }
virtual bool isNormalmap() const { return false; }

virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const { return colorA_t(0.f); }
virtual colorA_t getColor(int x, int y, int z, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const { return colorA_t(0.f); }
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const { return colorA_t(0.f); }
virtual colorA_t getColor(int x, int y, int z, mipMapParams_t * mmParams = nullptr) const { return colorA_t(0.f); }
virtual colorA_t getRawColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const { return getColor(p, mmParams); }
virtual colorA_t getRawColor(int x, int y, int z, mipMapParams_t * mmParams = nullptr) const { return getColor(x, y, z, mmParams); }

virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const { return applyIntensityContrastAdjustments(getColor(p, colorSpaceProcessing, mmParams).col2bri()); }
virtual float getFloat(int x, int y, int z, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const { return applyIntensityContrastAdjustments(getColor(x, y, z, colorSpaceProcessing, mmParams).col2bri()); }
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const { return applyIntensityContrastAdjustments(getRawColor(p, mmParams).col2bri()); }
virtual float getFloat(int x, int y, int z, mipMapParams_t * mmParams = nullptr) const { return applyIntensityContrastAdjustments(getRawColor(x, y, z, mmParams).col2bri()); }

/* gives the number of values in each dimension for discrete textures */
virtual void resolution(int &x, int &y, int &z) const { x=0, y=0, z=0; }
Expand Down
32 changes: 16 additions & 16 deletions include/textures/basictex.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class textureClouds_t : public texture_t
const color_t &c1, const color_t &c2,
const std::string &ntype, const std::string &btype);
virtual ~textureClouds_t();
virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

virtual void getInterpolationStep(float &step) const { step = size; };

Expand All @@ -43,8 +43,8 @@ class textureMarble_t : public texture_t
}
}

virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

virtual void getInterpolationStep(float &step) const { step = size; };

Expand All @@ -71,8 +71,8 @@ class textureWood_t : public texture_t
}
}

virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

virtual void getInterpolationStep(float &step) const { step = size; };

Expand All @@ -96,8 +96,8 @@ class textureVoronoi_t : public texture_t
float isc, const std::string &dname);
virtual ~textureVoronoi_t() {}

virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

virtual void getInterpolationStep(float &step) const { step = size; };

Expand All @@ -121,8 +121,8 @@ class textureMusgrave_t : public texture_t
const std::string &ntype, const std::string &mtype);
virtual ~textureMusgrave_t();

virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

virtual void getInterpolationStep(float &step) const { step = size; };

Expand All @@ -143,8 +143,8 @@ class textureDistortedNoise_t : public texture_t
const std::string &noiseb1, const std::string noiseb2);
virtual ~textureDistortedNoise_t();

virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

virtual void getInterpolationStep(float &step) const { step = size; };

Expand All @@ -164,8 +164,8 @@ class rgbCube_t : public texture_t
{
public:
rgbCube_t(){}
virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

static texture_t *factory(paraMap_t &params,renderEnvironment_t &render);
};
Expand All @@ -187,8 +187,8 @@ class textureBlend_t : public texture_t
textureBlend_t(const std::string &stype, bool use_flip_axis);
virtual ~textureBlend_t();

virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_USE_RAW, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual float getFloat(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;

static texture_t *factory(paraMap_t &params, renderEnvironment_t &render);

Expand Down
20 changes: 11 additions & 9 deletions include/textures/imagetex.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,26 @@ class textureImage_t : public texture_t
virtual bool discrete() const { return true; }
virtual bool isThreeD() const { return false; }
virtual bool isNormalmap() const { return normalmap; }
virtual colorA_t getColor(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(int x, int y, int z, colorSpaceProcessing_t colorSpaceProcessing = CS_GET_LINEAR, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getColor(int x, int y, int z, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getRawColor(const point3d_t &p, mipMapParams_t * mmParams = nullptr) const;
virtual colorA_t getRawColor(int x, int y, int z, mipMapParams_t * mmParams = nullptr) const;
virtual void resolution(int &x, int &y, int &z) const;
static texture_t *factory(paraMap_t &params,renderEnvironment_t &render);
virtual void generateMipMaps() { if(image->getHighestImgIndex() == 0) image->generateMipMaps(); }

protected:
void setCrop(float minx, float miny, float maxx, float maxy);
void findTextureInterpolationCoordinates(int &coord, int &coord0, int &coord2, int &coord3, float &coord_decimal_part, float coord_float, int resolution, bool repeat, bool mirror) const;
colorA_t noInterpolation(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing, int mipmaplevel=0) const;
colorA_t bilinearInterpolation(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing, int mipmaplevel=0) const;
colorA_t bicubicInterpolation(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing, int mipmaplevel=0) const;
colorA_t mipMapsTrilinearInterpolation(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing, mipMapParams_t * mmParams) const;
colorA_t mipMapsEWAInterpolation(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing, float maxAnisotropy, mipMapParams_t * mmParams) const;
colorA_t EWAEllipticCalculation(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing, float dS0, float dT0, float dS1, float dT1, int mipmaplevel=0) const;
colorA_t noInterpolation(const point3d_t &p, int mipmaplevel=0) const;
colorA_t bilinearInterpolation(const point3d_t &p, int mipmaplevel=0) const;
colorA_t bicubicInterpolation(const point3d_t &p, int mipmaplevel=0) const;
colorA_t mipMapsTrilinearInterpolation(const point3d_t &p, mipMapParams_t * mmParams) const;
colorA_t mipMapsEWAInterpolation(const point3d_t &p, float maxAnisotropy, mipMapParams_t * mmParams) const;
colorA_t EWAEllipticCalculation(const point3d_t &p, float dS0, float dT0, float dS1, float dT1, int mipmaplevel=0) const;
void generateEWALookupTable();
bool doMapping(point3d_t &texp) const;
colorA_t interpolateImage(const point3d_t &p, colorSpaceProcessing_t colorSpaceProcessing, mipMapParams_t * mmParams) const;
colorA_t interpolateImage(const point3d_t &p, mipMapParams_t * mmParams) const;

bool use_alpha, calc_alpha, normalmap;
bool grayscale = false; //!< Converts the information loaded from the texture RGB to grayscale to reduce memory usage for bump or mask textures, for example. Alpha is ignored in this case.
Expand Down
2 changes: 1 addition & 1 deletion src/backgrounds/textureback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ color_t textureBackground_t::eval(const ray_t &ray, bool use_ibl_blur) const
if(use_ibl_blur)
{
mipMapParams_t * mipMapParams = new mipMapParams_t(IBL_Blur_mipmap_level);
ret = tex->getColor(point3d_t(u, v, 0.f), CS_GET_LINEAR, mipMapParams);
ret = tex->getColor(point3d_t(u, v, 0.f), mipMapParams);
delete mipMapParams;
mipMapParams = nullptr;
}
Expand Down
11 changes: 4 additions & 7 deletions src/bindings/yafaray_v3_interface.i
Original file line number Diff line number Diff line change
Expand Up @@ -627,19 +627,16 @@ namespace yafaray
int getTextureOptimization() { return m_textureOptimization; }
void setTextureOptimization(int texture_optimization) { m_textureOptimization = texture_optimization; }
void setGrayScaleSetting(bool grayscale) { m_grayscale = grayscale; }
int getWidth(int imgIndex = 0) { return imgBufferRaw.at(imgIndex)->getWidth(); }
int getHeight(int imgIndex = 0) { return imgBufferRaw.at(imgIndex)->getHeight(); }
int getWidth(int imgIndex = 0) { return imgBuffer.at(imgIndex)->getWidth(); }
int getHeight(int imgIndex = 0) { return imgBuffer.at(imgIndex)->getHeight(); }
std::string getDenoiseParams() const;
void generateMipMaps();
int getHighestImgIndex() const { return (int) imgBufferRaw.size() - 1; }
int getHighestImgIndex() const { return (int) imgBuffer.size() - 1; }
void setColorSpace(colorSpaces_t color_space, float gamma) { m_colorSpace = color_space; m_gamma = gamma; }
int getInterpolationColorSpaceConversion() const { return m_intp_colorspace_conversion; }
void setInterpolationColorSpaceConversion(int conversion) { m_intp_colorspace_conversion = conversion; }
void putPixel(int x, int y, const colorA_t &rgba, int imgIndex = 0);
colorA_t getPixel(int x, int y, colorSpaceProcessing_t colorSpaceProcessing, int imgIndex = 0);
colorA_t getPixel(int x, int y, int imgIndex = 0);
void initForOutput(int width, int height, const renderPasses_t *renderPasses, bool denoiseEnabled, int denoiseHLum, int denoiseHCol, float denoiseMix, bool withAlpha = false, bool multi_layer = false, bool grayscale = false);
void clearImgBuffers();
void createLinearBuffer();
};

// Outputs
Expand Down
20 changes: 10 additions & 10 deletions src/image_handlers/exrHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool exrHandler_t::saveToFile(const std::string &name, int imgIndex)
{
for(int j = 0; j < h; ++j)
{
colorA_t col = imgBufferRaw.at(imgIndex)->getColor(i, j);
colorA_t col = imgBuffer.at(imgIndex)->getColor(i, j);
pixels[j][i].r = col.R;
pixels[j][i].g = col.G;
pixels[j][i].b = col.B;
Expand Down Expand Up @@ -128,14 +128,14 @@ bool exrHandler_t::saveToFile(const std::string &name, int imgIndex)

bool exrHandler_t::saveToFileMultiChannel(const std::string &name, const renderPasses_t *renderPasses)
{
int h0 = imgBufferRaw.at(0)->getHeight();
int w0 = imgBufferRaw.at(0)->getWidth();
int h0 = imgBuffer.at(0)->getHeight();
int w0 = imgBuffer.at(0)->getWidth();

bool allImageBuffersSameSize = true;
for(size_t idx = 0; idx < imgBufferRaw.size(); ++idx)
for(size_t idx = 0; idx < imgBuffer.size(); ++idx)
{
if(imgBufferRaw.at(idx)->getHeight() != h0) allImageBuffersSameSize = false;
if(imgBufferRaw.at(idx)->getWidth() != w0) allImageBuffersSameSize = false;
if(imgBuffer.at(idx)->getHeight() != h0) allImageBuffersSameSize = false;
if(imgBuffer.at(idx)->getWidth() != w0) allImageBuffersSameSize = false;
}

if(!allImageBuffersSameSize)
Expand All @@ -162,7 +162,7 @@ bool exrHandler_t::saveToFileMultiChannel(const std::string &name, const renderP

std::vector<Imf::Array2D<Imf::Rgba> *> pixels;

for(size_t idx = 0; idx < imgBufferRaw.size(); ++idx)
for(size_t idx = 0; idx < imgBuffer.size(); ++idx)
{
extPassName = "RenderLayer." + renderPasses->extPassTypeStringFromIndex(idx) + ".";
Y_VERBOSE << " Writing EXR Layer: " << renderPasses->extPassTypeStringFromIndex(idx) << yendl;
Expand All @@ -189,7 +189,7 @@ bool exrHandler_t::saveToFileMultiChannel(const std::string &name, const renderP
{
for(int j = 0; j < h0; ++j)
{
colorA_t col = imgBufferRaw.at(idx)->getColor(i, j);
colorA_t col = imgBuffer.at(idx)->getColor(i, j);
(*pixels.at(idx))[j][i].r = col.R;
(*pixels.at(idx))[j][i].g = col.G;
(*pixels.at(idx))[j][i].b = col.B;
Expand Down Expand Up @@ -294,7 +294,7 @@ bool exrHandler_t::loadFromFile(const std::string &name)
if(m_grayscale) nChannels = 1;
else if(m_hasAlpha) nChannels = 4;

imgBufferRaw.push_back(new imageBuffer_t(m_width, m_height, nChannels, getTextureOptimization()));
imgBuffer.push_back(new imageBuffer_t(m_width, m_height, nChannels, getTextureOptimization()));

Imf::Array2D<Imf::Rgba> pixels;
pixels.resizeErase(m_width, m_height);
Expand All @@ -310,7 +310,7 @@ bool exrHandler_t::loadFromFile(const std::string &name)
col.G = pixels[i][j].g;
col.B = pixels[i][j].b;
col.A = pixels[i][j].a;
imgBufferRaw.at(0)->setColor(i, j, col);
imgBuffer.at(0)->setColor(i, j, col, m_colorSpace, m_gamma);
}
}
}
Expand Down
Loading

0 comments on commit 003d614

Please sign in to comment.