Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGGroup.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #include <stdlib.h>
00040 #include <stdio.h>
00041 
00042 #include "OSGConfig.h"
00043 
00044 #include <OSGDrawAction.h>
00045 #include <OSGRenderAction.h>
00046 #include <OSGIntersectAction.h>
00047 
00048 #include "OSGGroup.h"
00049 
00050 OSG_USING_NAMESPACE
00051 
00060 /*-------------------------------------------------------------------------*/
00061 /*                               Sync                                      */
00062 
00063 void Group::changed(BitVector whichField, UInt32 origin)
00064 {
00065     Inherited::changed(whichField, origin);
00066 }
00067 
00068 /*-------------------------------------------------------------------------*/
00069 /*                               Dump                                      */
00070 
00071 void Group::dump(      UInt32    uiIndent, 
00072                  const BitVector bvFlags) const
00073 {
00074    Inherited::dump(uiIndent, bvFlags);
00075 }
00076 
00077 /*-------------------------------------------------------------------------*/
00078 /*                            Constructors                                 */
00079 
00080 Group::Group(void) :
00081     Inherited()
00082 {
00083 }
00084 
00085 Group::Group(const Group &source) :
00086     Inherited(source)
00087 {
00088 }
00089 
00090 /*-------------------------------------------------------------------------*/
00091 /*                             Destructor                                  */
00092 
00093 Group::~Group(void)
00094 {
00095 }
00096 
00097 /*-------------------------------------------------------------------------*/
00098 /*                               Draw                                      */
00099 
00100 Action::ResultE Group::drawEnter(Action *action)
00101 {
00102     DrawActionBase *da = dynamic_cast<DrawActionBase *>(action);
00103 
00104     if(da->selectVisibles() == 0)
00105         return Action::Skip;
00106     
00107     return Action::Continue;
00108 }
00109 
00110 Action::ResultE Group::drawLeave(Action *)
00111 {
00112     return Action::Continue;
00113 }
00114 
00115 /*-------------------------------------------------------------------------*/
00116 /*                              Render                                     */
00117 
00118 Action::ResultE Group::renderEnter(Action *action)
00119 {
00120     RenderAction *ra = dynamic_cast<RenderAction *>(action);
00121 
00122     ra->pushVisibility();
00123     
00124     return Action::Continue;
00125 }
00126 
00127 Action::ResultE Group::renderLeave(Action *action)
00128 {
00129     RenderAction *ra = dynamic_cast<RenderAction *>(action);
00130 
00131     ra->popVisibility();
00132     
00133     return Action::Continue;
00134 }
00135 
00136 /*-------------------------------------------------------------------------*/
00137 /*                             Intersect                                   */
00138 
00139 Action::ResultE Group::intersect(Action *action)
00140 {
00141           IntersectAction *ia = dynamic_cast<IntersectAction *>(action);
00142     const DynamicVolume   &dv = ia->getActNode()->getVolume();
00143     
00144     if(dv.isValid() && ! dv.intersect(ia->getLine()))
00145     {
00146         return Action::Skip;  //bv missed -> can not hit children
00147     }
00148     
00149     return Action::Continue;
00150 }
00151 
00152 /*-------------------------------------------------------------------------*/
00153 /*                                Init                                     */
00154 
00155 void Group::initMethod (void)
00156 {
00157     DrawAction::registerEnterDefault( 
00158         getClassType(), 
00159         osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
00160                                           GroupPtr  , 
00161                                           CNodePtr  ,  
00162                                           Action   *>(&Group::drawEnter));
00163     DrawAction::registerLeaveDefault( 
00164         getClassType(), 
00165         osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
00166                                           GroupPtr  , 
00167                                           CNodePtr  ,  
00168                                           Action   *>(&Group::drawLeave));
00169 
00170     RenderAction::registerEnterDefault( 
00171         getClassType(), 
00172         osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
00173                                           GroupPtr  , 
00174                                           CNodePtr  ,  
00175                                           Action   *>(&Group::renderEnter));
00176 
00177     RenderAction::registerLeaveDefault( 
00178         getClassType(), 
00179         osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
00180                                           GroupPtr  , 
00181                                           CNodePtr  ,  
00182                                           Action   *>(&Group::renderLeave));
00183     
00184     IntersectAction::registerEnterDefault( 
00185         getClassType(),
00186         osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
00187                                           GroupPtr  ,
00188                                           CNodePtr  ,
00189                                           Action   *>(&Group::intersect));
00190 }
00191 
00192 
00193 /*-------------------------------------------------------------------------*/
00194 /*                              cvs id's                                   */
00195 
00196 #ifdef __sgi
00197 #pragma set woff 1174
00198 #endif
00199 
00200 #ifdef OSG_LINUX_ICC
00201 #pragma warning( disable : 177 )
00202 #endif
00203 
00204 namespace
00205 {
00206     static Char8 cvsid_cpp[] = "@(#)$Id: $";
00207     static Char8 cvsid_hpp[] = OSGGROUP_HEADER_CVSID;
00208     static Char8 cvsid_inl[] = OSGGROUP_INLINE_CVSID;
00209 }
00210 
00211 
00212 
00213 
00214 

Generated on Thu Aug 25 04:05:53 2005 for OpenSG by  doxygen 1.4.3