From b36e41cb7117757011e6f1ccc476ccc806219a58 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 6 Apr 2015 21:48:20 -0300 Subject: Added a PVRTC encoder for iOS --- drivers/pvr/PvrTcPacket.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 drivers/pvr/PvrTcPacket.h (limited to 'drivers/pvr/PvrTcPacket.h') diff --git a/drivers/pvr/PvrTcPacket.h b/drivers/pvr/PvrTcPacket.h new file mode 100644 index 0000000000..ac3b6a4dd1 --- /dev/null +++ b/drivers/pvr/PvrTcPacket.h @@ -0,0 +1,65 @@ +//============================================================================ +// +// Modulation data specifies weightings of colorA to colorB for each pixel +// +// For mode = 0 +// 00: 0/8 +// 01: 3/8 +// 10: 5/8 +// 11: 8/8 +// +// For mode = 1 +// 00: 0/8 +// 01: 4/8 +// 10: 4/8 with alpha punchthrough +// 11: 8/8 +// +// For colorIsOpaque=0 +// 3 bits A +// 4 bits R +// 4 bits G +// 3/4 bits B +// +// For colorIsOpaque=1 +// 5 bits R +// 5 bits G +// 4/5 bits B +// +//============================================================================ + +#pragma once +#include "ColorRgba.h" + +//============================================================================ + +namespace Javelin +{ +//============================================================================ + + struct PvrTcPacket + { + unsigned int modulationData; + unsigned usePunchthroughAlpha : 1; + unsigned colorA : 14; + unsigned colorAIsOpaque : 1; + unsigned colorB : 15; + unsigned colorBIsOpaque : 1; + + ColorRgb GetColorRgbA() const; + ColorRgb GetColorRgbB() const; + ColorRgba GetColorRgbaA() const; + ColorRgba GetColorRgbaB() const; + + void SetColorA(const ColorRgb& c); + void SetColorB(const ColorRgb& c); + + void SetColorA(const ColorRgba& c); + void SetColorB(const ColorRgba& c); + + static const unsigned char BILINEAR_FACTORS[16][4]; + static const unsigned char WEIGHTS[8][4]; + }; + +//============================================================================ +} // namespace Javelin +//============================================================================ -- cgit v1.2.3