1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 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 \*---------------------------------------------------------------------------*/
42 #include "OSGConfig.h"
44 #include "OSGRenderAction.h"
45 #include "OSGIntersectAction.h"
51 // Documentation for this class is emited in the
52 // OSGGroupBase.cpp file.
53 // To modify it, please change the .fcd file (OSGGroup.fcd) and
54 // regenerate the base file.
56 /*-------------------------------------------------------------------------*/
59 void Group::changed(ConstFieldMaskArg whichField
,
63 Inherited::changed(whichField
, origin
, details
);
66 /*-------------------------------------------------------------------------*/
69 void Group::dump( UInt32 uiIndent
,
70 const BitVector bvFlags
) const
72 Inherited::dump(uiIndent
, bvFlags
);
75 /*-------------------------------------------------------------------------*/
83 Group::Group(const Group
&source
) :
88 /*-------------------------------------------------------------------------*/
95 /*-------------------------------------------------------------------------*/
98 Action::ResultE
Group::renderEnter(Action
*action
)
100 RenderAction
*ra
= dynamic_cast<RenderAction
*>(action
);
102 if(ra
->pushVisibility() == true)
104 if(ra
->selectVisibles() == 0)
111 return Action::Continue
;
114 Action::ResultE
Group::renderLeave(Action
*action
)
116 RenderAction
*ra
= dynamic_cast<RenderAction
*>(action
);
120 return Action::Continue
;
123 /*-------------------------------------------------------------------------*/
126 Action::ResultE
Group::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 /*-------------------------------------------------------------------------*/
142 void Group::initMethod(InitPhase ePhase
)
144 Inherited::initMethod(ePhase
);
147 if(ePhase
== TypeObject::SystemPost
)
149 RenderAction::registerEnterDefault(
150 Group::getClassType(),
151 reinterpret_cast<Action::Callback
>(&Group::renderEnter
));
153 RenderAction::registerLeaveDefault(
154 Group::getClassType(),
155 reinterpret_cast<Action::Callback
>(&Group::renderLeave
));
157 IntersectAction::registerEnterDefault(
159 reinterpret_cast<Action::Callback
>(&Group::intersectEnter
));