Home Hierarchy Members Alphabetical Related Pages

sfcolor.h

Go to the documentation of this file.
00001 #ifndef XDKWRL_SFCOLOR_H
00002 #define XDKWRL_SFCOLOR_H
00003 
00004 #include <xdkwrl/config.h>
00005 #include <xdkwrl/fieldtypes.h>
00006 #include <iostream>
00007 
00008 namespace wrl
00009 {
00010   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00011   // Interface of  SFColor
00012   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00013   /*! \ingroup fieldtypes
00014    *
00015    * Represents a RGB color value. Below is included the documentation for
00016    * this field type from the ISO standard.
00017    * \htmlinclude sfcolor.html
00018    */
00019   class XDKWRL_EXPORT SFColor 
00020   {
00021   public:
00022     inline SFColor();
00023     inline SFColor(const float* c);
00024     inline SFColor(const float r,const float g,const float b);
00025     inline SFColor& operator=(const SFColor& c);
00026     inline operator const float*() const;
00027     inline float red() const;
00028     inline float green() const;
00029     inline float blue() const;
00030     inline void setRGB(const float r,const float g,const float b);
00031     inline void setRed(const float);
00032     inline void setGreen(const float);
00033     inline void setBlue(const float);
00034     static inline const char* typeName();
00035     static inline FieldTypeId typeId();
00036     inline bool operator==(const SFColor& c) const;
00037     friend std::ostream& operator<<(std::ostream& s,const SFColor& f);
00038   protected:
00039   private:
00040     float red_;
00041     float green_;
00042     float blue_;
00043   };
00044   //************************************************************
00045   // Implementation of SFColor
00046   //************************************************************
00047   inline
00048   SFColor::SFColor()
00049     : red_(0.0f),green_(0.0f),blue_(0.0f)
00050   {
00051   }
00052   inline
00053   SFColor::SFColor(const float* c)
00054     : red_(c[0]),green_(c[1]),blue_(c[2])    
00055   {    
00056   }
00057   inline
00058   SFColor::SFColor(const float r,const float g,const float b)
00059     : red_(r),green_(g),blue_(b)    
00060   {    
00061   }    
00062   inline SFColor&
00063   SFColor::operator=(const SFColor& c)
00064   {
00065     red_ = c.red_;
00066     green_ = c.green_;
00067     blue_ = c.blue_;
00068     return *this;
00069   }
00070   inline
00071   SFColor::operator const float*() const
00072   {
00073     return &red_;
00074   }
00075   inline float
00076   SFColor::red() const
00077   {
00078     return red_;
00079   }
00080   inline float
00081   SFColor::green() const
00082   {
00083     return green_;
00084   }
00085   inline float
00086   SFColor::blue() const
00087   {
00088     return blue_;
00089   }
00090   inline void
00091   SFColor::setRed(const float f)
00092   {
00093     red_ = f;
00094   }
00095   inline void
00096   SFColor::setGreen(const float f)
00097   {
00098     green_ = f;
00099   }
00100   inline void
00101   SFColor::setBlue(const float f)
00102   {
00103     blue_ = f;
00104   }  
00105   inline void
00106   SFColor::setRGB(const float r,const float g,const float b)
00107   {
00108     red_ = r;
00109     green_ = g;
00110     blue_ = b;
00111   }  
00112   inline bool
00113   SFColor::operator==(const SFColor& c) const
00114   {
00115     return red_ == c.red_ && green_ == c.green_ && blue_ == c.blue_;
00116   }
00117   inline const char*
00118   SFColor::typeName()
00119   {
00120     return "SFColor";
00121   }
00122   inline FieldTypeId
00123   SFColor::typeId()
00124   {
00125     return sfColor;
00126   }  
00127 };
00128 
00129 #endif // XDKWRL_SFCOLOR_H

Generated on 5 Jan 2007 with doxygen version 1.5.1. Valid HTML 4.0! Valid CSS!