Procházet zdrojové kódy

Added isFloat function.

Branimir Karadžić před 8 roky
rodič
revize
e8e94127ba
2 změnil soubory, kde provedl 9 přidání a 1 odebrání
  1. 3 0
      include/bimg/bimg.h
  2. 6 1
      src/image.cpp

+ 3 - 0
include/bimg/bimg.h

@@ -231,6 +231,9 @@ namespace bimg
 	/// Returns true if texture format is valid.
 	bool isValid(TextureFormat::Enum _format);
 
+	/// returns true if texture format encoding is float.
+	bool isFloat(TextureFormat::Enum _format);
+
 	/// Returns bits per pixel.
 	uint8_t getBitsPerPixel(TextureFormat::Enum _format);
 

+ 6 - 1
src/image.cpp

@@ -26,7 +26,7 @@ namespace bimg
 		{   8, 4, 4, 16, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Unorm) }, // BC3
 		{   4, 4, 4,  8, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Unorm) }, // BC4
 		{   8, 4, 4, 16, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Unorm) }, // BC5
-		{   8, 4, 4, 16, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Unorm) }, // BC6H
+		{   8, 4, 4, 16, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Float) }, // BC6H
 		{   8, 4, 4, 16, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Unorm) }, // BC7
 		{   4, 4, 4,  8, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Unorm) }, // ETC1
 		{   4, 4, 4,  8, 1, 1,  0, 0,  0,  0,  0,  0, uint8_t(bx::EncodingType::Unorm) }, // ETC2
@@ -208,6 +208,11 @@ namespace bimg
 			;
 	}
 
+	bool isFloat(TextureFormat::Enum _format)
+	{
+		return uint8_t(bx::EncodingType::Float) == s_imageBlockInfo[_format].encoding;
+	}
+
 	uint8_t getBitsPerPixel(TextureFormat::Enum _format)
 	{
 		return s_imageBlockInfo[_format].bitsPerPixel;