00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045
00046 #include <OSGConfig.h>
00047
00048 #include "OSGColorMaskChunk.h"
00049
00050 OSG_USING_NAMESPACE
00051
00052
00053
00054
00055
00060
00061
00062
00063
00064 StateChunkClass ColorMaskChunk::_class("Color");
00065
00066
00067
00068
00069
00070 void ColorMaskChunk::initMethod (void)
00071 {
00072 }
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 ColorMaskChunk::ColorMaskChunk(void) :
00086 Inherited()
00087 {
00088 }
00089
00090 ColorMaskChunk::ColorMaskChunk(const ColorMaskChunk &source) :
00091 Inherited(source)
00092 {
00093 }
00094
00095 ColorMaskChunk::~ColorMaskChunk(void)
00096 {
00097 }
00098
00099
00100
00101 const StateChunkClass *ColorMaskChunk::getClass(void) const
00102 {
00103 return &_class;
00104 }
00105
00106
00107
00108 void ColorMaskChunk::changed(BitVector whichField, UInt32 origin)
00109 {
00110 Inherited::changed(whichField, origin);
00111 }
00112
00113 void ColorMaskChunk::dump( UInt32 ,
00114 const BitVector ) const
00115 {
00116 SLOG << "Dump ColorMaskChunk NI" << std::endl;
00117 }
00118
00119
00120
00121 void ColorMaskChunk::activate(DrawActionBase *, UInt32)
00122 {
00123 glColorMask(getMaskR(), getMaskG(), getMaskB(), getMaskA());
00124 }
00125
00126 void ColorMaskChunk::changeFrom( DrawActionBase *act, StateChunk * old_chunk, UInt32 index )
00127 {
00128 old_chunk->deactivate( act, index );
00129 activate( act, index );
00130 }
00131
00132 void ColorMaskChunk::deactivate ( DrawActionBase *, UInt32 )
00133 {
00134 glColorMask(true, true, true, true);
00135 }
00136
00137
00138
00139 Real32 ColorMaskChunk::switchCost(StateChunk *)
00140 {
00141 return 0;
00142 }
00143
00147 bool ColorMaskChunk::operator < (const StateChunk &other) const
00148 {
00149 return this < &other;
00150 }
00151
00155 bool ColorMaskChunk::operator == (const StateChunk &other) const
00156 {
00157 ColorMaskChunk const *tother = dynamic_cast<ColorMaskChunk const*>(&other);
00158
00159 if(!tother)
00160 return false;
00161
00162 if(tother == this)
00163 return true;
00164
00165 if(getMaskR() != tother->getMaskR() ||
00166 getMaskG() != tother->getMaskG() ||
00167 getMaskB() != tother->getMaskB() ||
00168 getMaskA() != tother->getMaskA() )
00169 return false;
00170
00171 return true;
00172 }
00173
00177 bool ColorMaskChunk::operator != (const StateChunk &other) const
00178 {
00179 return ! (*this == other);
00180 }
00181
00182
00183
00184
00185 #ifdef OSG_SGI_CC
00186 #pragma set woff 1174
00187 #endif
00188
00189 #ifdef OSG_LINUX_ICC
00190 #pragma warning( disable : 177 )
00191 #endif
00192
00193 namespace
00194 {
00195 static Char8 cvsid_cpp [] = "@(#)$Id: OSGColorMaskChunk.cpp,v 1.1 2005/06/06 17:14:20 yjung Exp $";
00196 static Char8 cvsid_hpp [] = OSGCOLORMASKCHUNKBASE_HEADER_CVSID;
00197 static Char8 cvsid_inl [] = OSGCOLORMASKCHUNKBASE_INLINE_CVSID;
00198
00199 static Char8 cvsid_fields_hpp[] = OSGCOLORMASKCHUNKFIELDS_HEADER_CVSID;
00200 }
00201
00202 #ifdef __sgi
00203 #pragma reset woff 1174
00204 #endif
00205