Skip to content

Commit 62e8de2

Browse files
authored
Merge pull request #1634 from Azaezel/alpha41/getColorAugs
add optional mip and face lookups for gbitmap::getcolor
2 parents f55d061 + 17326b2 commit 62e8de2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Engine/source/gfx/bitmap/gBitmap.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,13 @@ LinearColorF GBitmap::sampleTexel(F32 u, F32 v, bool retAlpha) const
721721
}
722722

723723
//--------------------------------------------------------------------------
724-
bool GBitmap::getColor(const U32 x, const U32 y, ColorI& rColor) const
724+
bool GBitmap::getColor(const U32 x, const U32 y, ColorI& rColor, const U32 mipLevel, const U32 face) const
725725
{
726726
if (x >= mWidth || y >= mHeight)
727727
return false;
728-
729-
const U8* p = getAddress(x, y);
728+
U32 targMip = getNumMipLevels() < mipLevel ? getNumMipLevels()-1 : mipLevel;
729+
U32 targFace = getNumFaces() < face ? getNumFaces()-1 : face;
730+
const U8* p = getAddress(x, y, targMip, targFace);
730731

731732
switch (mInternalFormat)
732733
{

Engine/source/gfx/bitmap/gBitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class GBitmap
223223
bool checkForTransparency();
224224

225225
LinearColorF sampleTexel(F32 u, F32 v, bool retAlpha = false) const;
226-
bool getColor(const U32 x, const U32 y, ColorI& rColor) const;
226+
bool getColor(const U32 x, const U32 y, ColorI& rColor, const U32 mipLevel = 0, const U32 face = 0) const;
227227
bool setColor(const U32 x, const U32 y, const ColorI& rColor);
228228
U8 getChanelValueAt(U32 x, U32 y, U32 chan);
229229
U32 getNumFaces() const { return mNumFaces; }

0 commit comments

Comments
 (0)