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 "OSGTestStage.h"
49 #include "OSGRenderAction.h"
53 // Documentation for this class is emitted in the
54 // OSGTestStageBase.cpp file.
55 // To modify it, please change the .fcd file (OSGTestStage.fcd) and
56 // regenerate the base file.
58 /***************************************************************************\
60 \***************************************************************************/
62 /***************************************************************************\
64 \***************************************************************************/
66 void TestStage::initMethod(InitPhase ePhase
)
68 Inherited::initMethod(ePhase
);
70 if(ePhase
== TypeObject::SystemPost
)
72 RenderAction::registerEnterDefault(
73 TestStage::getClassType(),
74 reinterpret_cast<Action::Callback
>(&TestStage::renderEnter
));
76 RenderAction::registerLeaveDefault(
77 TestStage::getClassType(),
78 reinterpret_cast<Action::Callback
>(&TestStage::renderLeave
));
83 /***************************************************************************\
85 \***************************************************************************/
87 /*-------------------------------------------------------------------------*\
89 \*-------------------------------------------------------------------------*/
91 /*----------------------- constructors & destructors ----------------------*/
93 TestStage::TestStage(void) :
98 TestStage::TestStage(const TestStage
&source
) :
103 TestStage::~TestStage(void)
107 /*----------------------------- class specific ----------------------------*/
109 void TestStage::changed(ConstFieldMaskArg whichField
,
113 Inherited::changed(whichField
, origin
, details
);
116 void TestStage::enterCB(DrawEnv
*pEnv
)
118 fprintf(stderr
, "TestStage Part Enter\n");
121 void TestStage::dump( UInt32
,
122 const BitVector
) const
124 SLOG
<< "Dump TestStage NI" << std::endl
;
128 Action::ResultE
TestStage::renderEnter(Action
*action
)
130 #ifdef OSG_DUMP_TRAVERSAL
131 FDEBUG_GV(("Enter TestStage %p\n", &(*pCore
)));
134 RenderAction
*a
= dynamic_cast<RenderAction
*>(action
);
137 if(this != NULL
&& this->getMessage().size() != 0)
139 fprintf(stderr
, "StartEnter TS %s\n",
140 this->getMessage().c_str());
144 Stage::ValidationStatus eStatus
= this->validateOnEnter(a
);
146 if(eStatus
== TraversalValidator::Run
)
148 this->pushPartition(a
);
151 RenderPartition
*pPart
= a
->getActivePartition();
153 if(this != NULL
&& this->getMessage().size() != 0)
155 pPart
->setDebugString(this->getMessage());
162 if(this != NULL
&& this->getMessage().size() != 0)
164 fprintf(stderr
, "FinishedEnter TS %s\n",
165 this->getMessage().c_str());
169 return Action::Continue
;
172 Action::ResultE
TestStage::renderLeave(Action
*action
)
174 #ifdef OSG_DUMP_TRAVERSAL
175 FDEBUG_GV(("Leave TestStage %p\n", &(*pCore
)));
178 RenderAction
*a
= dynamic_cast<RenderAction
*>(action
);
181 if(this != NULL
&& this->getMessage().size() != 0)
183 fprintf(stderr
, "StartLeave TS %s\n",
184 this->getMessage().c_str());
188 TraversalValidator::ValidationStatus eStatus
= this->validateOnLeave(a
);
190 if(eStatus
== TraversalValidator::Run
)
192 this->popPartition(a
);
196 if(this != NULL
&& this->getMessage().size() != 0)
198 fprintf(stderr
, "FinishedLeave TS %s\n",
199 this->getMessage().c_str());
202 a
->dumpPartitionList();
205 return Action::Continue
;
208 /*------------------------------------------------------------------------*/