Skip to content

Commit

Permalink
libgui|Image: 16-bit floating point image formats
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 783f30e commit 02be3fe
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 36 deletions.
28 changes: 16 additions & 12 deletions doomsday/libs/gui/include/de/graphics/image.h
Expand Up @@ -65,18 +65,22 @@ class LIBGUI_PUBLIC Image : public ISerializable
RGBA_5551 = 9,
RGBA_8888 = 10,
RGBx_8888 = 11, ///< 32-bit depth, alpha data ignored.
R_32f = 12,
RG_32f = 13,
RGB_32f = 14,
RGBA_32f = 15,
R_32i = 16,
RG_32i = 17,
RGB_32i = 18,
RGBA_32i = 19,
R_32ui = 20,
RG_32ui = 21,
RGB_32ui = 22,
RGBA_32ui = 23,
R_16f = 12,
RG_16f = 13,
RGB_16f = 14,
RGBA_16f = 15,
R_32f = 16,
RG_32f = 17,
RGB_32f = 18,
RGBA_32f = 19,
R_32i = 20,
RG_32i = 21,
RGB_32i = 22,
RGBA_32i = 23,
R_32ui = 24,
RG_32ui = 25,
RGB_32ui = 26,
RGBA_32ui = 27,
};

typedef Vector2ui Size;
Expand Down
55 changes: 31 additions & 24 deletions doomsday/libs/gui/src/graphics/image.cpp
Expand Up @@ -333,10 +333,10 @@ using namespace internal;

DENG2_PIMPL(Image)
{
Format format;
Size size;
QImage image;
Block pixels;
Format format;
Size size;
QImage image;
Block pixels;
ByteRefArray refPixels;
float pointRatio = 1.f;

Expand Down Expand Up @@ -423,48 +423,43 @@ int Image::depth() const
{
switch (d->format)
{
case UseQImageFormat:
return d->image.depth();
case UseQImageFormat: return d->image.depth();

case Luminance_8:
case Alpha_8:
return 8;
case Alpha_8: return 8;

case LuminanceAlpha_88:
case RGB_565:
case RGBA_4444:
case RGBA_5551:
return 16;
case RGBA_5551: return 16;

case RGB_888:
return 24;
case RGB_888: return 24;

case RGBA_8888:
case RGBx_8888:
return 32;
case RGBx_8888: return 32;

case R_16f: return 16;
case RG_16f: return 32;
case RGB_16f: return 48;
case RGBA_16f: return 64;

case R_32f:
case R_32i:
case R_32ui:
return 32;
case R_32ui: return 32;

case RG_32f:
case RG_32i:
case RG_32ui:
return 64;
case RG_32ui: return 64;

case RGB_32f:
case RGB_32i:
case RGB_32ui:
return 96;
case RGB_32ui: return 96;

case RGBA_32f:
case RGBA_32i:
case RGBA_32ui:
return 128;
case RGBA_32ui: return 128;

default:
return 0;
default: return 0;
}
}

Expand Down Expand Up @@ -821,6 +816,18 @@ GLPixelFormat Image::glFormat(Format imageFormat)
case RGBx_8888:
return GLPixelFormat(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, 4);

case R_16f:
return GLPixelFormat(GL_R16F, GL_RED, GL_FLOAT, 2);

case RG_16f:
return GLPixelFormat(GL_RG16F, GL_RG, GL_FLOAT, 4);

case RGB_16f:
return GLPixelFormat(GL_RGB16F, GL_RGB, GL_FLOAT, 2);

case RGBA_16f:
return GLPixelFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT, 4);

case R_32f:
return GLPixelFormat(GL_R32F, GL_RED, GL_FLOAT, 4);

Expand Down

0 comments on commit 02be3fe

Please sign in to comment.