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 "OSGLogicOpChunk.h"
00049
00050 OSG_BEGIN_NAMESPACE
00051
00052
00053
00054
00055
00060
00061
00062
00063
00064 StateChunkClass LogicOpChunk::_class("LogicOp");
00065
00066
00067
00068
00069
00070 void LogicOpChunk::initMethod (void)
00071 {
00072 Inherited::initMethod();
00073 }
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 LogicOpChunk::LogicOpChunk(void) :
00087 Inherited()
00088 {
00089 }
00090
00091 LogicOpChunk::LogicOpChunk(const LogicOpChunk &source) :
00092 Inherited(source)
00093 {
00094 }
00095
00096 LogicOpChunk::~LogicOpChunk(void)
00097 {
00098 }
00099
00100
00101
00102 const StateChunkClass *LogicOpChunk::getClass(void) const
00103 {
00104 return &_class;
00105 }
00106
00107
00108
00109 void LogicOpChunk::changed(BitVector whichField, UInt32 origin)
00110 {
00111 Inherited::changed(whichField, origin);
00112 }
00113
00114
00115
00116 void LogicOpChunk::dump( UInt32,
00117 const BitVector) const
00118 {
00119 SLOG << "Dump LogicOpChunk NI" << std::endl;
00120 }
00121
00122
00123
00124 void LogicOpChunk::activate(DrawActionBase *, UInt32)
00125 {
00126 if(_sfLogicOp.getValue() != GL_COPY)
00127 {
00128 glEnable (GL_COLOR_LOGIC_OP );
00129 glLogicOp(_sfLogicOp.getValue());
00130 }
00131 }
00132
00133 void LogicOpChunk::changeFrom( DrawActionBase *act, StateChunk * old_chunk, UInt32 index )
00134 {
00135 old_chunk->deactivate( act, index );
00136 activate( act, index );
00137 }
00138
00139 void LogicOpChunk::deactivate ( DrawActionBase *, UInt32 )
00140 {
00141 if(_sfLogicOp.getValue() != GL_COPY)
00142 {
00143 glDisable(GL_COLOR_LOGIC_OP);
00144 glLogicOp(GL_COPY );
00145 }
00146 }
00147
00148
00149
00150 Real32 LogicOpChunk::switchCost(StateChunk *)
00151 {
00152 return 0;
00153 }
00154
00158 bool LogicOpChunk::operator < (const StateChunk &other) const
00159 {
00160 return this < &other;
00161 }
00162
00166 bool LogicOpChunk::operator == (const StateChunk &other) const
00167 {
00168 LogicOpChunk const *tother = dynamic_cast<LogicOpChunk const*>(&other);
00169
00170 if(!tother)
00171 return false;
00172
00173 if(tother == this)
00174 return true;
00175
00176 if(getLogicOp() != tother->getLogicOp())
00177 return false;
00178
00179 return true;
00180 }
00181
00185 bool LogicOpChunk::operator != (const StateChunk &other) const
00186 {
00187 return ! (*this == other);
00188 }
00189
00190
00191
00192
00193 #ifdef OSG_SGI_CC
00194 #pragma set woff 1174
00195 #endif
00196
00197 #ifdef OSG_LINUX_ICC
00198 #pragma warning( disable : 177 )
00199 #endif
00200
00201 namespace
00202 {
00203 static Char8 cvsid_cpp [] = "@(#)$Id: OSGLogicOpChunk.cpp,v 1.1 2007/06/25 14:32:45 neumannc Exp $";
00204 static Char8 cvsid_hpp [] = OSGLOGICOPCHUNKBASE_HEADER_CVSID;
00205 static Char8 cvsid_inl [] = OSGLOGICOPCHUNKBASE_INLINE_CVSID;
00206
00207 static Char8 cvsid_fields_hpp[] = OSGLOGICOPCHUNKFIELDS_HEADER_CVSID;
00208 }
00209
00210 #ifdef __sgi
00211 #pragma reset woff 1174
00212 #endif
00213
00214 OSG_END_NAMESPACE
00215