Hi.
Is there a reason, why there's no "+"-operator defined for OSGColor? I
have a template function that interpolates between 2 values that needs this.
In case the reason is "nobody needed it before" or "we're short of time"
I attached two diff files.
Thanks & regards,
Dominik
--- /home/iod/OSGColor.h 2005-11-02 13:57:10.000000000 +0100
+++ OSGColor.h 2005-11-02 12:39:06.000000000 +0100
@@ -148,6 +148,7 @@ class Color3
/*! \{ */
Color3 operator *(const ValueType val );
+ Color3 operator +(const Color3 &other );
ValueType &operator [](const UInt32 uiIndex );
const ValueType &operator [](const UInt32 uiIndex ) const;
@@ -252,6 +253,7 @@ class Color4
/*! \{ */
Color4 operator * (const ValueType val );
+ Color4 operator +(const Color4 &other );
ValueType &operator [](const UInt32 uiIndex );
const ValueType &operator [](const UInt32 uiIndex ) const;
--- /home/iod/OSGColor.inl 2005-11-02 13:57:39.000000000 +0100
+++ OSGColor.inl 2005-11-02 12:38:36.000000000 +0100
@@ -438,6 +438,18 @@ Color3<ValueTypeT> Color3<ValueTypeT>::o
return returnValue;
}
+template <class ValueTypeT> inline
+Color3<ValueTypeT> Color3<ValueTypeT>::operator +(const Color3 &other)
+{
+ Color3<ValueTypeT> returnValue;
+
+ returnValue._rgb[0] = _rgb[0] + other._rgb[0];
+ returnValue._rgb[1] = _rgb[1] + other._rgb[1];
+ returnValue._rgb[2] = _rgb[2] + other._rgb[2];
+
+ return returnValue;
+}
+
template <class ValueTypeT> inline
typename Color3<ValueTypeT>::ValueType &Color3<ValueTypeT>::operator[] (
@@ -738,6 +750,18 @@ Color4<ValueTypeT> Color4<ValueTypeT>::o
return returnValue;
}
+template <class ValueTypeT> inline
+Color4<ValueTypeT> Color4<ValueTypeT>::operator +(const Color4 &other)
+{
+ Color4<ValueTypeT> returnValue;
+
+ returnValue._rgba[0] = _rgba[0] + other._rgba[0];
+ returnValue._rgba[1] = _rgba[1] + other._rgba[1];
+ returnValue._rgba[2] = _rgba[2] + other._rgba[2];
+ returnValue._rgba[3] = _rgba[3] + other._rgba[3];
+
+ return returnValue;
+}
template <class ValueTypeT> inline
typename Color4<ValueTypeT>::ValueType &Color4<ValueTypeT>::operator[] (