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 "OSGChunkOverrideGroup.h"
49 #include "OSGRenderAction.h"
50 #include "OSGChunkBlock.h"
51 #include "OSGStateChunk.h"
55 // Documentation for this class is emitted in the
56 // OSGChunkOverrideGroupBase.cpp file.
57 // To modify it, please change the .fcd file (OSGChunkOverrideGroup.fcd) and
58 // regenerate the base file.
60 /***************************************************************************\
62 \***************************************************************************/
64 /***************************************************************************\
66 \***************************************************************************/
68 void ChunkOverrideGroup::classDescInserter(TypeObject
&oType
)
70 Inherited::classDescInserter(oType
);
73 void ChunkOverrideGroup::initMethod(InitPhase ePhase
)
75 Inherited::initMethod(ePhase
);
77 if(ePhase
== TypeObject::SystemPost
)
79 RenderAction::registerEnterDefault(
80 ChunkOverrideGroup::getClassType(),
81 reinterpret_cast<Action::Callback
>(
82 &ChunkOverrideGroup::renderEnter
));
84 RenderAction::registerLeaveDefault(
85 ChunkOverrideGroup::getClassType(),
86 reinterpret_cast<Action::Callback
>(
87 &ChunkOverrideGroup::renderLeave
));
92 /***************************************************************************\
94 \***************************************************************************/
96 /*-------------------------------------------------------------------------*\
98 \*-------------------------------------------------------------------------*/
100 /*----------------------- constructors & destructors ----------------------*/
102 ChunkOverrideGroup::ChunkOverrideGroup(void) :
107 ChunkOverrideGroup::ChunkOverrideGroup(const ChunkOverrideGroup
&source
) :
112 ChunkOverrideGroup::~ChunkOverrideGroup(void)
116 /*----------------------------- class specific ----------------------------*/
118 bool ChunkOverrideGroup::addChunk(StateChunk
*chunk
,
121 ChunkBlockUnrecPtr pBlock
= this->finalize(0x0000);
125 pBlock
= ChunkBlock::create();
127 this->addChunkBlock(pBlock
, 0x0000);
130 return pBlock
->addChunk(chunk
, slot
);
133 bool ChunkOverrideGroup::subChunk(StateChunk
*chunk
,
139 ChunkBlock
*pBlock
= this->finalize(0x0000);
143 return pBlock
->subChunk(chunk
, slot
);
149 Int32
ChunkOverrideGroup::find(StateChunk
*chunk
)
151 ChunkBlock
*pBlock
= this->finalize(0x0000);
155 return pBlock
->find(chunk
);
161 StateChunk
*ChunkOverrideGroup::find(const StateChunkClass
&type
,
164 ChunkBlock
*pBlock
= this->finalize(0x0000);
168 return pBlock
->find(type
, slot
);
174 /*-------------------------------------------------------------------------*/
177 void ChunkOverrideGroup::addChunkBlock(ChunkBlock
* const pBlock
,
178 ChunkBlockMapKey key
)
180 Inherited::addElement(pBlock
, key
);
184 void ChunkOverrideGroup::subChunkBlock(ChunkBlockMapKey key
)
186 Inherited::subElement(key
);
189 const SFChunkBlockPtrMap
*ChunkOverrideGroup::getSFChunkBlockStore(void) const
191 return Inherited::getMapCacheField();
194 void ChunkOverrideGroup::changed(ConstFieldMaskArg whichField
,
198 Inherited::changed(whichField
, origin
, details
);
201 void ChunkOverrideGroup::dump( UInt32
,
202 const BitVector
) const
204 SLOG
<< "Dump ChunkOverrideGroup NI" << std::endl
;
207 Action::ResultE
ChunkOverrideGroup::renderEnter(Action
*action
)
209 RenderAction
*pAction
= dynamic_cast<RenderAction
*>(action
);
213 pAction
->pushState();
215 ChunkBlock
*pBlock
= this->finalize(pAction
->getRenderProperties());
218 return Inherited::renderEnter(action
);
220 MFUnrecStateChunkPtr::const_iterator chIt
= pBlock
->beginChunks();
221 MFUnrecStateChunkPtr::const_iterator chEnd
= pBlock
->endChunks ();
226 if(*chIt
!= NULL
&& (*chIt
)->getIgnore() == false)
228 if (getSubOverride())
230 pAction
->subOverride(uiSlot
, *chIt
);
234 pAction
->addOverride(uiSlot
, *chIt
);
243 return Inherited::renderEnter(action
);
246 Action::ResultE
ChunkOverrideGroup::renderLeave(Action
*action
)
248 RenderAction
*pAction
=
249 dynamic_cast<RenderAction
*>(action
);
257 return Inherited::renderLeave(action
);