
#ifndef __WFX_SCENE_COLOR_H__
#define __WFX_SCENE_COLOR_H__

#include <WFX/WFXIncludes.h>

namespace WFX {

    namespace scene {

        /**
         * Color Value
         * contains Channels for red, green, blue and alpha channels. Valid Values are
         * [0,1], different Values are changed to match those bounderies
         */
        class Color {
            public:
                static const Color RED;
                static const Color GREEN;
                static const Color BLUE;
                static const Color WHITE;
                static const Color BLACK;
                
                /** rgb and alpha channels */
                Real R,G,B,A;
                /**
                 * Ctor/Dtor
                 */
                Color();
                Color(Real r, Real g, Real b);
                Color(Real r, Real g, Real b, Real a);
                Color(const Color& c);
                ~Color() { 
                }

                inline Real operator [](UInt i ) const {
                    assert( i < 3 );
                    return *(&R+i);
                }
                inline Real& operator [](UInt i) {
                    assert( i < 3 );
                    return *(&R+i);
                }
                inline Color& operator =(const Color& v) {
                    R = v.R;
                    G = v.G;
                    B = v.B;
                    A = v.A;
                    return *this;
                }

                inline bool operator ==(const Color& v) const {
                    return (R == v.R && G == v.G && B == v.B && A == v.A);
                }

                inline bool operator !=(const Color& v) const {
                    return (R != v.R && G != v.G && B != v.B && A != v.A);
                }

                void printDebug() const;

            protected:
                /** 
                 * internal function to validate channel values
                 */
                Real validate(Real v) {
                    if (v < 0.0f) return 0.0f;
                    if (v > 1.0f) return 1.0f;
                    return v;
                }
                

        };

    }

}


#endif //include guard


