diff --git a/Base/include/IPixel.h b/Base/include/IPixel.h index 4b83437..a9bb547 100644 --- a/Base/include/IPixel.h +++ b/Base/include/IPixel.h @@ -54,23 +54,21 @@ #define BASE_INCLUDE_IPIXEL_H_ #include "TexCompTypes.h" +#include "VectorBase.h" namespace FasTC { -class IPixel { - private: - float m_Intensity; - +class IPixel : public VectorBase { public: - IPixel() : m_Intensity(0.0f) { } - IPixel(float f) : m_Intensity(f) { } + IPixel() : VectorBase() { vec[0] = 0.0f; } + IPixel(float f) : VectorBase(&f) { } operator float() const { - return m_Intensity; + return vec[0]; } IPixel operator=(const float &f) { - return m_Intensity = f; + return vec[0] = f; } // Take all of the components, transform them to their 8-bit variants, @@ -80,6 +78,7 @@ class IPixel { uint32 Pack() const; void Unpack(uint32 rgba); }; +REGISTER_VECTOR_TYPE(IPixel); } // namespace FasTC diff --git a/Base/src/IPixel.cpp b/Base/src/IPixel.cpp index e0fc71f..9919a85 100644 --- a/Base/src/IPixel.cpp +++ b/Base/src/IPixel.cpp @@ -62,14 +62,14 @@ namespace FasTC { uint32 IPixel::Pack() const { uint32 ret = 0xFF << 24; for(uint32 i = 0; i < 3; i++) { - ret |= static_cast((255.0 * m_Intensity) + 0.5f) << i*8; + ret |= static_cast((255.0 * vec[0]) + 0.5f) << i*8; } return ret; } void IPixel::Unpack(uint32 rgba) { Pixel p(rgba); - m_Intensity = p.ToIntensity(); + vec[0] = p.ToIntensity(); } } // namespace FasTC