00001 /* 00002 * Software OpenMASK-3DVis © INRIA 1993-2002, thereinafter the Software 00003 * 00004 * The software has been developed within the Siames Project. 00005 * INRIA hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.500027.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA for the software may use 00015 * this file in accordance with that specific license 00016 * 00017 */ 00018 #include "OMKColor.h" 00019 #include "OMKIncomingSynchronisationMessage.h" 00020 #include "OMKOutgoingSynchronisationMessage.h" 00021 #include "OMKSimpleTypeT.inl" 00022 00023 using namespace OMK ; 00024 using namespace OMK::Type ; 00025 00027 // Color 00029 //---------------------------------------------------------------------------- 00030 Color::Color() 00031 { 00032 _array[0] = 0.0f ; 00033 _array[1] = 0.0f ; 00034 _array[2] = 0.0f ; 00035 _array[3] = 1.0f ; 00036 } 00037 //---------------------------------------------------------------------------- 00038 Color::Color( const Color& color ) 00039 { 00040 _copy( color ) ; 00041 } 00042 //---------------------------------------------------------------------------- 00043 Color::Color( float r, float g, float b, float a ) 00044 { 00045 _array[0] = r ; 00046 _array[1] = g ; 00047 _array[2] = b ; 00048 _array[3] = a ; 00049 } 00050 //---------------------------------------------------------------------------- 00051 Color::~Color() 00052 { 00053 } 00054 //---------------------------------------------------------------------------- 00055 Color& Color::operator = ( float values[4] ) 00056 { 00057 for ( int i = 0 ; i < 4 ; i++ ) 00058 { 00059 _array[i] = values[i] ; 00060 } 00061 return * this ; 00062 } 00063 //----------------------------------------------------------------------------- 00064 void Color::_copy( const Color& color ) 00065 { 00066 for ( int i = 0 ; i < 4 ; i++ ) 00067 { 00068 _array[i] = color._array[i] ; 00069 } 00070 } 00071 //----------------------------------------------------------------------------- 00072 00073 //---------------------------------------------------------------------------- 00074 bool OMK::Type::operator == ( const Color& c0, const Color& c1 ) 00075 { 00076 return c0._array[0] == c1._array[0] 00077 && c0._array[1] == c1._array[1] 00078 && c0._array[2] == c1._array[2] 00079 && c0._array[3] == c1._array[3] ; 00080 } 00081 //---------------------------------------------------------------------------- 00082 bool OMK::Type::operator != ( const Color& c0, const Color& c1 ) 00083 { 00084 return !( c0 == c1 ) ; 00085 } 00086 //----------------------------------------------------------------------------- 00087 IncomingSynchronisationMessage& 00088 operator >> ( IncomingSynchronisationMessage& in, Color& color ) 00089 { 00090 in.get( color._array, 4 ) ; 00091 return in ; 00092 } 00093 //----------------------------------------------------------------------------- 00094 OutgoingSynchronisationMessage& 00095 operator << ( OutgoingSynchronisationMessage& out, const Color& color ) 00096 { 00097 out.pack( color._array, 4 ) ; 00098 return out ; 00099 } 00100 //---------------------------------------------------------------------------- 00101 std::istream& operator >> ( std::istream& in, Color& color ) 00102 { 00103 for ( int i = 0 ; i < 4 ; i++ ) 00104 { 00105 in >> color._array[i] ; 00106 } 00107 return in ; 00108 } 00109 //----------------------------------------------------------------------------- 00110 std::ostream& operator << ( std::ostream& out, const Color& color ) 00111 { 00112 for( int i = 0 ; i < 4 ; i++ ) 00113 { 00114 out << color._array[i] << " " ; 00115 } 00116 return out ; 00117 } 00118 //----------------------------------------------------------------------------- 00119
Documentation generated on Mon Jun 9 11:45:55 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |