changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Base / OSGRootGroup.cpp
blob6d911f4a58b4141d29bf48f2983b50d8fbe1722c
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #include <cstdlib>
40 #include <cstdio>
42 #include "OSGConfig.h"
44 #include "OSGRenderAction.h"
45 #include "OSGIntersectAction.h"
47 #include "OSGRootGroup.h"
49 OSG_USING_NAMESPACE
51 // Documentation for this class is emited in the
52 // OSGRootGroupBase.cpp file.
53 // To modify it, please change the .fcd file (OSGRootGroup.fcd) and
54 // regenerate the base file.
56 /*-------------------------------------------------------------------------*/
57 /* Sync */
59 void RootGroup::changed(ConstFieldMaskArg whichField,
60 UInt32 origin,
61 BitVector details)
63 Inherited::changed(whichField, origin, details);
66 /*-------------------------------------------------------------------------*/
67 /* Dump */
69 void RootGroup::dump( UInt32 uiIndent,
70 const BitVector bvFlags) const
72 Inherited::dump(uiIndent, bvFlags);
75 /*-------------------------------------------------------------------------*/
76 /* Constructors */
78 RootGroup::RootGroup(void) :
79 Inherited()
83 RootGroup::RootGroup(const RootGroup &source) :
84 Inherited(source)
88 /*-------------------------------------------------------------------------*/
89 /* Destructor */
91 RootGroup::~RootGroup(void)
95 /*-------------------------------------------------------------------------*/
96 /* Render */
98 Action::ResultE RootGroup::renderEnter(Action *action)
100 RenderAction *ra = dynamic_cast<RenderAction *>(action);
102 if(ra->pushVisibility() == true)
104 if(ra->selectVisibles() == 0)
106 ra->popVisibility();
107 return Action::Skip;
111 return Action::Continue;
114 Action::ResultE RootGroup::renderLeave(Action *action)
116 RenderAction *ra = dynamic_cast<RenderAction *>(action);
118 ra->popVisibility();
120 return Action::Continue;
123 /*-------------------------------------------------------------------------*/
124 /* Intersect */
126 Action::ResultE RootGroup::intersectEnter(Action *action)
128 IntersectAction *ia = dynamic_cast<IntersectAction *>(action);
129 const BoxVolume &bv = ia->getActNode()->getVolume();
131 if(bv.isValid() && ! bv.intersect(ia->getLine()))
133 return Action::Skip; //bv missed -> can not hit children
136 return Action::Continue;
139 /*-------------------------------------------------------------------------*/
140 /* Init */
142 void RootGroup::initMethod(InitPhase ePhase)
144 Inherited::initMethod(ePhase);
147 if(ePhase == TypeObject::SystemPost)
149 RenderAction::registerEnterDefault(
150 RootGroup::getClassType(),
151 reinterpret_cast<Action::Callback>(&RootGroup::renderEnter));
153 RenderAction::registerLeaveDefault(
154 RootGroup::getClassType(),
155 reinterpret_cast<Action::Callback>(&RootGroup::renderLeave));
157 IntersectAction::registerEnterDefault(
158 getClassType(),
159 reinterpret_cast<Action::Callback>(&RootGroup::intersectEnter));