1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
46 #include "OSGConfig.h"
48 #include "OSGLogicOpChunk.h"
49 #include "OSGDrawEnv.h"
53 // Documentation for this class is emitted in the
54 // OSGLogicOpChunkBase.cpp file.
55 // To modify it, please change the .fcd file (OSGLogicOpChunk.fcd) and
56 // regenerate the base file.
58 /***************************************************************************\
60 \***************************************************************************/
63 StateChunkClass
LogicOpChunk::_class("LogicOp", 1, 50);
65 StateChunkClass
LogicOpChunk::_class("LogicOp", 1, 110);
68 /***************************************************************************\
70 \***************************************************************************/
72 void LogicOpChunk::initMethod(InitPhase ePhase
)
74 Inherited::initMethod(ePhase
);
78 /***************************************************************************\
80 \***************************************************************************/
82 /*------------------------- Chunk Class Access ---------------------------*/
84 const StateChunkClass
*LogicOpChunk::getClass(void) const
89 /*--------------------------------- Sync ---------------------------------*/
91 void LogicOpChunk::changed(ConstFieldMaskArg whichField
,
95 Inherited::changed(whichField
, origin
, details
);
98 /*-------------------------------- Output --------------------------------*/
100 void LogicOpChunk::dump( UInt32
,
101 const BitVector
) const
103 SLOG
<< "Dump LogicOpChunk NI" << std::endl
;
106 /*----------------------------- State Commands ---------------------------*/
108 void LogicOpChunk::activate(DrawEnv
*pEnv
, UInt32 index
)
111 pEnv
->incNumChunkChanges();
113 if(_sfLogicOp
.getValue() != GL_COPY
)
115 glLogicOp(_sfLogicOp
.getValue());
116 glEnable (GL_COLOR_LOGIC_OP
);
121 void LogicOpChunk::changeFrom(DrawEnv
*pEnv
,
125 old
->deactivate(pEnv
, index
);
126 this->activate (pEnv
, index
);
129 void LogicOpChunk::deactivate(DrawEnv
*pEnv
, UInt32 index
)
132 if(_sfLogicOp
.getValue() != GL_COPY
)
134 glDisable(GL_COLOR_LOGIC_OP
);
140 /*------------------------------- Comparison -----------------------------*/
142 Real32
LogicOpChunk::switchCost(StateChunk
*chunk
)
147 bool LogicOpChunk::operator < (const StateChunk
&other
) const
149 return this < &other
;
152 bool LogicOpChunk::operator == (const StateChunk
&other
) const
154 LogicOpChunk
const *tOther
= dynamic_cast<LogicOpChunk
const *>(&other
);
162 if(getLogicOp() != tOther
->getLogicOp())
168 bool LogicOpChunk::operator != (const StateChunk
&other
) const
170 return !(*this == other
);
173 /*-------------------------------------------------------------------------*\
175 \*-------------------------------------------------------------------------*/
177 /*----------------------- constructors & destructors ----------------------*/
179 LogicOpChunk::LogicOpChunk(void) :
184 LogicOpChunk::LogicOpChunk(const LogicOpChunk
&source
) :
189 LogicOpChunk::~LogicOpChunk(void)
193 /*----------------------------- class specific ----------------------------*/