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 <boost/bind.hpp>
48 #include "OSGConfig.h"
50 #include "OSGComplexSceneManager.h"
51 #include "OSGOSGSceneFileType.h"
52 #include "OSGContainerCollection.h"
53 #include "OSGSceneFileHandler.h"
54 #include "OSGImageFileHandler.h"
55 #include "OSGNameAttachment.h"
56 #include "OSGAction.h"
57 #include "OSGCSMResetInterface.h"
58 #include "OSGFrameHandler.h"
59 #include "OSGGeoProperty.h"
61 #include "OSGGeoFunctions.h"
62 #include "OSGGraphOpFactory.h"
64 #include "OSGCSMDrawManager.h"
66 //#include "OSGFieldContainerFactory.h"
67 //#include "OSGTypeFactory.h"
71 // Documentation for this class is emitted in the
72 // OSGComplexSceneManagerBase.cpp file.
73 // To modify it, please change the .fcd file (OSGComplexSceneManager.fcd) and
74 // regenerate the base file.
78 std::string _szRefName
;
87 Action::ResultE
enter(Node
* const pNode
)
89 Action::ResultE returnValue
= Action::Continue
;
91 const Char8
*szName
= OSG::getName(pNode
);
95 if(osgStringCmp(_szRefName
.c_str(), szName
) == 0)
99 returnValue
= Action::Quit
;
108 NodeFinder(const NodeFinder
&other
);
109 void operator=(const NodeFinder
&rhs
);
114 std::string _szRefName
;
115 FieldContainer
*_pResult
;
117 ElementFinder(void) :
123 Action::ResultE
enter(Node
* const pNode
)
125 Action::ResultE returnValue
= Action::Continue
;
127 const Char8
*szName
= OSG::getName(pNode
);
131 if(osgStringCmp(_szRefName
.c_str(), szName
) == 0)
135 returnValue
= Action::Quit
;
138 else if(pNode
->getCore() != NULL
)
140 szName
= OSG::getName(pNode
->getCore());
144 if(osgStringCmp(_szRefName
.c_str(), szName
) == 0)
148 returnValue
= Action::Quit
;
158 ElementFinder(const ElementFinder
&other
);
159 void operator=(const ElementFinder
&rhs
);
163 /***************************************************************************\
165 \***************************************************************************/
167 Time
ComplexSceneManager::SystemTime
= 0.0;
169 ComplexSceneManagerUnrecPtr
ComplexSceneManager::_the
= NULL
;
170 PathHandler
ComplexSceneManager::_oPathHandler
;
171 std::vector
<FieldContainerUnrecPtr
> ComplexSceneManager::_vStaticGlobals
;
173 ComplexSceneManager::DeferredFCUse
> ComplexSceneManager::_vStaticUnresolvedFCs
;
175 /***************************************************************************\
177 \***************************************************************************/
179 void ComplexSceneManager::initMethod(InitPhase ePhase
)
181 Inherited::initMethod(ePhase
);
183 if(ePhase
== TypeObject::SystemPost
)
189 ComplexSceneManager
*ComplexSceneManager::the(void)
194 FieldContainer
*ComplexSceneManager::resolveStatic(
196 FieldContainer
*pDestContainer
,
199 std::vector
<FieldContainerUnrecPtr
>::const_iterator gIt
=
200 _vStaticGlobals
.begin();
202 std::vector
<FieldContainerUnrecPtr
>::const_iterator gEnd
=
203 _vStaticGlobals
.end ();
205 AttachmentContainer
*pAttCnt
= NULL
;
207 const Char8
*szTmpName
= NULL
;
211 pNode
= dynamic_cast<Node
*>((*gIt
).get());
215 ElementFinder oFinder
;
217 oFinder
._szRefName
= szName
;
219 traverse(pNode
, boost::bind(&ElementFinder::enter
, &oFinder
, _1
));
221 if(oFinder
._pResult
!= NULL
)
223 return oFinder
._pResult
;
227 pAttCnt
= dynamic_cast<AttachmentContainer
*>((*gIt
).get());
231 szTmpName
= OSG::getName(pAttCnt
);
233 if(szTmpName
!= NULL
&& osgStringCmp(szTmpName
, szName
) == 0)
240 FieldContainer
*tmpVal
= pAttCnt
->findNamedComponent(szName
);
251 if(pDestContainer
!= NULL
&& iDestFieldId
>= 0)
253 DeferredFCUse tmpBlock
;
255 tmpBlock
._szName
= szName
;
256 tmpBlock
._pDstCnt
= pDestContainer
;
257 tmpBlock
._uiDstFieldId
= UInt32(iDestFieldId
);
259 _vStaticUnresolvedFCs
.push_back(tmpBlock
);
265 void ComplexSceneManager::addStaticGlobals(const Char8
*szFilename
)
267 std::string szFilenameResolved
= _oPathHandler
.findFile(szFilename
);
269 if(szFilenameResolved
.empty() == true)
271 fprintf(stderr
, "Could not find static global file %s\n",
277 FieldContainerUnrecPtr pRes
=
278 readOSGFile(szFilenameResolved
,
279 boost::bind(&ComplexSceneManager::resolveStatic
,
285 ContainerCollectionUnrecPtr pColl
=
286 dynamic_pointer_cast
<ContainerCollection
>(pRes
);
291 MFUnrecFieldContainerPtr::const_iterator fIt
=
292 pColl
->getMFContainers()->begin();
294 MFUnrecFieldContainerPtr::const_iterator fEnd
=
295 pColl
->getMFContainers()->end();
299 _vStaticGlobals
.push_back(*fIt
);
305 void ComplexSceneManager::scanParamFile(
306 const Char8
*szFilename
,
307 std::vector
<std::string
> &vParams
)
309 FILE *pIn
= fopen(szFilename
, "r");
313 std::string szBuffer
;
314 const Char8
*szDelim
= " \t\n ";
320 fgets(szRow
, 1024, pIn
);
325 szBuffer
.empty() == true ||
326 szBuffer
[0] == '\n' ||
332 string_token_iterator
cIt (szBuffer
, szDelim
);
333 string_token_iterator cEnd
;
337 vParams
.push_back(*cIt
);
345 void ComplexSceneManager::scanPreSystem(std::vector
<std::string
> &vParams
)
347 static const UInt32 ScanSystem
= 0;
348 static const UInt32 ScanData
= 1;
349 static const UInt32 ScanGlobals
= 2;
351 UInt32 uiState
= ScanSystem
;
353 std::vector
<std::string
>::iterator pIt
= vParams
.begin();
354 std::vector
<std::string
>::const_iterator pEnd
= vParams
.end ();
358 if((*pIt
)[0] == '-' && (*pIt
)[1] == '-')
360 if((*pIt
)[2] == 'd' && (*pIt
)[3] == 'a' &&
361 (*pIt
)[4] == 't' && (*pIt
)[5] == 'a')
365 else if((*pIt
)[2] == 'g' && (*pIt
)[3] == 'l' &&
366 (*pIt
)[4] == 'o' && (*pIt
)[5] == 'b' &&
367 (*pIt
)[6] == 'a' && (*pIt
)[7] == 'l')
369 uiState
= ScanGlobals
;
371 else if((*pIt
)[2] == 's' && (*pIt
)[3] == 'y' &&
372 (*pIt
)[4] == 's' && (*pIt
)[5] == 't' &&
373 (*pIt
)[6] == 'e' && (*pIt
)[7] == 'm')
375 uiState
= ScanSystem
;
379 fprintf(stderr
, "Unknow option %s\n", (*pIt
).c_str());
385 if(uiState
== ScanSystem
)
389 else if(uiState
== ScanGlobals
)
391 addStaticGlobals((*pIt
).c_str());
393 else if(uiState
== ScanData
)
395 FWARNING(("Error data not allowed at this point, "
396 "ignoring %s\n", (*pIt
).c_str()));
403 if(pIt
!= vParams
.begin())
405 vParams
.erase(vParams
.begin(), pIt
);
409 void ComplexSceneManager::startFrom(const std::string
&szParamFilename
)
411 _oPathHandler
.clearPathList();
412 _oPathHandler
.clearBaseFile();
414 _oPathHandler
.push_frontCurrentDir();
416 std::string szParamFileResolved
=
417 _oPathHandler
.findFile(szParamFilename
.c_str());
419 if(szParamFileResolved
.empty() == true)
421 fprintf(stderr
, "Could not find param file %s\n",
422 szParamFilename
.c_str());
427 _oPathHandler
.setBaseFile(szParamFileResolved
.c_str());
429 OSG::SceneFileHandler::the()->setPathHandler(&_oPathHandler
);
431 std::vector
<std::string
> vParams
;
433 scanParamFile(szParamFileResolved
.c_str(), vParams
);
435 Self::startUp(vParams
);
438 /***************************************************************************\
440 \***************************************************************************/
442 /*-------------------------------------------------------------------------*\
444 \*-------------------------------------------------------------------------*/
446 /*----------------------- constructors & destructors ----------------------*/
448 ComplexSceneManager::ComplexSceneManager(void) :
453 #ifdef OSG_WITH_WEBSERVICE
454 ,_pWebInterface (NULL
)
459 ComplexSceneManager::ComplexSceneManager(const ComplexSceneManager
&source
) :
464 #ifdef OSG_WITH_WEBSERVICE
465 ,_pWebInterface (NULL
)
470 ComplexSceneManager::~ComplexSceneManager(void)
474 FieldContainer
*ComplexSceneManager::resolve(
476 FieldContainer
*pDestContainer
,
479 FieldContainer
*returnValue
= this->findNamedComponent(szName
);
481 if(returnValue
== NULL
&& pDestContainer
!= NULL
&& iDestFieldId
>= 0)
483 DeferredFCUse tmpBlock
;
485 tmpBlock
._szName
= szName
;
486 tmpBlock
._pDstCnt
= pDestContainer
;
487 tmpBlock
._uiDstFieldId
= UInt32(iDestFieldId
);
489 _vUnresolvedFCs
.push_back(tmpBlock
);
495 void ComplexSceneManager::addGlobals(const std::string
&filename
)
497 if(_sfDrawManager
.getValue() == NULL
)
502 std::string szFilenameResolved
= _oPathHandler
.findFile(filename
.c_str());
504 if(szFilenameResolved
.empty() == true)
509 FieldContainerUnrecPtr pRes
=
510 readOSGFile(szFilenameResolved
,
511 boost::bind(&ComplexSceneManager::resolve
, this,
514 fprintf(stderr
, "addGlobals::pres %p\n", static_cast<void *>(pRes
.get()));
519 ContainerCollectionUnrecPtr pColl
=
520 dynamic_pointer_cast
<ContainerCollection
>(pRes
);
524 MFUnrecFieldContainerPtr::const_iterator fIt
=
525 pColl
->getMFContainers()->begin();
527 MFUnrecFieldContainerPtr::const_iterator fEnd
=
528 pColl
->getMFContainers()->end();
532 this->pushToGlobals(*fIt
);
538 this->pushToGlobals(pRes
);
544 void ComplexSceneManager::addData(const std::string
&filename
)
546 Node
*pModelRoot
= findNode("ModelRoot");
548 if(pModelRoot
== NULL
)
553 std::string szFilenameResolved
= _oPathHandler
.findFile(filename
.c_str());
555 if(szFilenameResolved
.empty() == true)
557 fprintf(stderr
, "Could not find data file %s\n",
563 _oPathHandler
.pushState();
565 _oPathHandler
.setBaseFile(szFilenameResolved
.c_str());
567 fprintf(stderr
, "loading data %s ...\n",
571 OSG::SceneFileHandler::the()->read(
572 szFilenameResolved
.c_str(),
574 boost::bind(&ComplexSceneManager::resolve
, this, _1
, _2
, _3
),
577 _oPathHandler
.popState();
581 #if defined(OSG_OGL_ES2)
582 OSG::GraphOpRefPtr op
=
583 OSG::GraphOpFactory::the()->create("PrepareES");
585 fprintf(stderr
, "do es prep %p\n", static_cast<void *>(op
.get()));
590 pModelRoot
->addChild(pFile
);
594 Node
*ComplexSceneManager::findNode(const std::string
&filename
) const
596 MFGlobalsType::const_iterator gIt
= _mfGlobals
.begin();
597 MFGlobalsType::const_iterator gEnd
= _mfGlobals
.end ();
600 Node
*returnValue
= NULL
;
604 pNode
= dynamic_cast<Node
*>(*gIt
);
610 oFinder
._szRefName
= filename
;
612 traverse(pNode
, boost::bind(&NodeFinder::enter
, &oFinder
, _1
));
614 if(oFinder
._pResult
!= NULL
)
616 returnValue
= oFinder
._pResult
;
627 void ComplexSceneManager::processUnresolved(void)
629 std::vector
<DeferredFCUse
>::const_iterator uIt
= _vUnresolvedFCs
.begin();
630 std::vector
<DeferredFCUse
>::const_iterator uEnd
= _vUnresolvedFCs
.end ();
632 for(; uIt
!= uEnd
; ++uIt
)
634 if(uIt
->_pDstCnt
== NULL
)
637 FieldContainer
*pTmpFC
= this->findNamedComponent(uIt
->_szName
.c_str());
644 EditFieldHandlePtr pDstField
=
645 uIt
->_pDstCnt
->editField(uIt
->_uiDstFieldId
);
647 FieldContainerPtrSFieldBase::EditHandlePtr pSFHandle
=
648 boost::dynamic_pointer_cast
<
649 FieldContainerPtrSFieldBase::EditHandle
>(
652 FieldContainerPtrMFieldBase::EditHandlePtr pMFHandle
=
653 boost::dynamic_pointer_cast
<
654 FieldContainerPtrMFieldBase::EditHandle
>(
657 EditMapFieldHandlePtr pMapHandle
=
658 boost::dynamic_pointer_cast
<
659 EditMapFieldHandle
>(pDstField
);
661 if(pSFHandle
!= NULL
&& pSFHandle
->isValid())
663 pSFHandle
->set(pTmpFC
);
665 else if(pMFHandle
!= NULL
&& pMFHandle
->isValid())
667 pMFHandle
->add(pTmpFC
);
669 else if(pMapHandle
!= NULL
&& pMapHandle
->isValid())
671 pMapHandle
->add(pTmpFC
, "0");
676 _vUnresolvedFCs
.clear();
679 FieldContainerTransitPtr
ComplexSceneManager::readOSGFile(
680 const std::string
&filename
,
683 FieldContainerTransitPtr
returnValue(NULL
);
685 _oPathHandler
.pushState();
687 _oPathHandler
.setBaseFile(filename
.c_str());
689 ImageFileHandler::the()->setPathHandler(&_oPathHandler
);
691 fprintf(stderr
, "loading osg file %s ...\n",
694 returnValue
= OSG::OSGSceneFileType::the().readContainer(
698 ImageFileHandler::the()->setPathHandler(NULL
);
700 _oPathHandler
.popState();
705 FieldContainer
*ComplexSceneManager::findNamedComponent(
708 MFGlobalsType::const_iterator gIt
= _mfGlobals
.begin();
709 MFGlobalsType::const_iterator gEnd
= _mfGlobals
.end ();
711 AttachmentContainer
*pAttCnt
= NULL
;
713 const Char8
*szTmpName
= NULL
;
715 if(_sfDrawManager
.getValue() != NULL
)
717 szTmpName
= OSG::getName(_sfDrawManager
.getValue());
719 if(szTmpName
!= NULL
&& osgStringCmp(szTmpName
, szName
) == 0)
721 return _sfDrawManager
.getValue();
724 FieldContainer
*tmpVal
=
725 _sfDrawManager
.getValue()->findNamedComponent(szName
);
733 pNode
= dynamic_cast<Node
*>(*gIt
);
737 ElementFinder oFinder
;
739 oFinder
._szRefName
= szName
;
741 traverse(pNode
, boost::bind(&ElementFinder::enter
, &oFinder
, _1
));
743 if(oFinder
._pResult
!= NULL
)
745 return oFinder
._pResult
;
749 pAttCnt
= dynamic_cast<AttachmentContainer
*>(*gIt
);
753 szTmpName
= OSG::getName(pAttCnt
);
755 if(szTmpName
!= NULL
&& osgStringCmp(szTmpName
, szName
) == 0)
761 FieldContainer
*tmpVal
= pAttCnt
->findNamedComponent(szName
);
774 void ComplexSceneManager::addFrameProducer(
775 FrameProducerInterface
*pProducer
)
777 if(_sfDrawManager
.getValue() != NULL
)
779 _sfDrawManager
.getValue()->addProducer(pProducer
);
783 void ComplexSceneManager::removeFrameProducer(
784 FrameProducerInterface
*pProducer
)
786 if(_sfDrawManager
.getValue() != NULL
)
788 _sfDrawManager
.getValue()->removeProducer(pProducer
);
792 /*----------------------------- class specific ----------------------------*/
794 void ComplexSceneManager::changed(ConstFieldMaskArg whichField
,
798 Inherited::changed(whichField
, origin
, details
);
801 void ComplexSceneManager::dump( UInt32
,
802 const BitVector
) const
804 SLOG
<< "Dump ComplexSceneManager NI" << std::endl
;
807 void ComplexSceneManager::onCreate(const ComplexSceneManager
*source
)
809 Inherited::onCreate(source
);
811 // Don't add the prototype instances to the list
812 if(GlobalSystemState
!= Running
)
817 fprintf(stderr
, "WARNING ADDING SECOND COMPLEX SCENE MANAGER,"
818 " WILL SELF DESTRUCT IN 45 SECONDS");
823 std::vector
<FieldContainerUnrecPtr
>::const_iterator gIt
=
824 _vStaticGlobals
.begin();
826 std::vector
<FieldContainerUnrecPtr
>::const_iterator gEnd
=
827 _vStaticGlobals
.end ();
831 this->pushToGlobals(*gIt
);
836 SensorTaskUnrecPtr pSensorTask
= SensorTask::create();
838 setSensorTask(pSensorTask
);
842 bool ComplexSceneManager::startFrom(int argc
, char **argv
)
844 _oPathHandler
.clearPathList();
845 _oPathHandler
.clearBaseFile();
847 _oPathHandler
.push_frontCurrentDir();
849 std::vector
<std::string
> vParams
;
852 for(Int32 i
= 1; i
< argc
; ++i
)
856 vParams
.push_back(szTmp
);
859 Self::startUp(vParams
);
864 bool ComplexSceneManager::startUp(std::vector
<std::string
> &vParams
)
866 setVBOUsageOnPropertyProtos(true);
868 scanPreSystem(vParams
);
870 std::string szSystemFile
= vParams
[0];
872 std::string szSystemFileResolved
=
873 _oPathHandler
.findFile(szSystemFile
.c_str());
875 if(szSystemFileResolved
.empty() == true)
877 fprintf(stderr
, "Could not find system file %s\n",
878 szSystemFile
.c_str());
883 readOSGFile(szSystemFileResolved
,
884 boost::bind(&ComplexSceneManager::resolveStatic
,
887 _vStaticGlobals
.clear();
889 if(OSG::ComplexSceneManager::the() == NULL
)
891 fprintf(stderr
, "Error could not find any complex scenemanager\n");
895 OSG::SceneFileHandler::the()->setGlobalResolver(
896 boost::bind(&ComplexSceneManager::resolve
, _the
.get(), _1
, _2
, _3
));
898 OSG::ComplexSceneManager::the()->init(vParams
);
900 OSG::ComplexSceneManager::the()->run();
905 bool ComplexSceneManager::init(const std::vector
<std::string
> &vParams
)
907 bool returnValue
= true;
909 bool bDoData
= false;
911 _vUnresolvedFCs
.insert(_vUnresolvedFCs
.begin(),
912 _vStaticUnresolvedFCs
.begin(),
913 _vStaticUnresolvedFCs
.end ());
915 _vStaticUnresolvedFCs
.clear();
917 for(UInt32 i
= 1; i
< vParams
.size(); ++i
)
919 if(vParams
[i
][0] == '-' && vParams
[i
][1] == '-')
921 if(vParams
[i
][2] == 'd' && vParams
[i
][3] == 'a' &&
922 vParams
[i
][4] == 't' && vParams
[i
][5] == 'a')
926 else if(vParams
[i
][2] == 'g' && vParams
[i
][3] == 'l' &&
927 vParams
[i
][4] == 'o' && vParams
[i
][5] == 'b' &&
928 vParams
[i
][6] == 'a' && vParams
[i
][7] == 'l')
934 fprintf(stderr
, "Unknow option %s\n", vParams
[i
].c_str());
947 addGlobals(vParams
[i
]);
952 this->processUnresolved();
954 if(_sfDrawManager
.getValue() == NULL
)
961 returnValue
= _sfDrawManager
.getValue()->init();
963 if(returnValue
== true && FrameHandler::the() != NULL
)
965 returnValue
&= FrameHandler::the()->init();
971 void ComplexSceneManager::terminate(void)
973 _vStaticGlobals
.clear();
980 void ComplexSceneManager::shutdown(void)
982 #ifdef OSG_WITH_WEBSERVICE
983 _pWebInterface
= NULL
;
986 if(FrameHandler::the() != NULL
)
988 FrameHandler::the()->shutdown();
991 this->clearGlobals();
993 if(_sfDrawManager
.getValue() != NULL
)
995 _sfDrawManager
.getValue()->shutdown();
999 this->setDrawManager(NULL
);
1000 // this->setSensorTask (NULL);
1003 void ComplexSceneManager::setMainloop(MainLoopFuncF fMainloop
)
1005 _fMainloop
= fMainloop
;
1008 void ComplexSceneManager::run(void)
1010 #ifdef OSG_WITH_WEBSERVICE
1011 if(this->getEnableWebService() == true)
1013 _pWebInterface
= WebInterface::create(this->getWebServicePort());
1015 FieldContainer
*pRoot
=
1016 this->resolve(this->getWebServiceRoot().c_str(), NULL
, 0);
1018 Node
*pRootNode
= dynamic_cast<Node
*>(pRoot
);
1020 if(pRootNode
!= NULL
)
1022 fprintf(stderr
, "WebService using : %p\n",
1023 static_cast<void *>(pRootNode
) );
1025 _pWebInterface
->setRoot (pRootNode
);
1026 _pWebInterface
->setSystemContainer(this );
1037 FWARNING(("ComplexSceneManager: no mainloop exiting\n"));
1043 void ComplexSceneManager::frame(void)
1046 setCurrTime(getSystemTime());
1048 if(osgAbs(_sfStartTime
.getValue()) < 0.00001)
1050 setStartTime(_sfCurrTime
.getValue());
1055 _sfCurrTime
.getValue() -= _sfStartTime
.getValue();
1057 if(_sfPaused
.getValue() == false)
1059 SFTime
*pSFTimeStamp
= editSFTimeStamp();
1061 if(_sfConstantTime
.getValue() == true)
1063 pSFTimeStamp
->getValue() += _sfConstantTimeStep
.getValue();
1065 if(pSFTimeStamp
->getValue() < 0.)
1066 pSFTimeStamp
->setValue(0.0);
1070 pSFTimeStamp
->getValue() +=
1071 (_sfCurrTime
.getValue() - _sfLastTime
.getValue()) *
1072 _sfTimeScale
.getValue();
1074 if(pSFTimeStamp
->getValue() < 0.)
1075 pSFTimeStamp
->setValue(0.0);
1079 setLastTime(_sfCurrTime
.getValue());
1081 SystemTime
= _sfTimeStamp
.getValue();
1083 ++(editSFFrameCount()->getValue());
1085 if(_sfSensorTask
.getValue() != NULL
)
1087 _sfSensorTask
.getValue()->frame(_sfTimeStamp
.getValue (),
1088 _sfFrameCount
.getValue());
1092 if(_sfDumpFrameStart
.getValue() == true)
1094 fprintf(stderr
, "=================================================\n");
1095 fprintf(stderr
, "Render Frame\n");
1096 fprintf(stderr
, "=================================================\n");
1099 FrameHandler::the()->frame();
1101 SystemTime
= FrameHandler::the()->getTimeStamp();
1105 #ifdef OSG_WITH_WEBSERVICE
1106 if(_pWebInterface
!= NULL
)
1108 _pWebInterface
->waitRequest(0.01);
1109 _pWebInterface
->handleRequests();
1113 if(_sfDrawManager
.getValue() != NULL
)
1115 _sfDrawManager
.getValue()->frame(FrameHandler::the()->getTimeStamp(),
1116 FrameHandler::the()->getFrameCount());
1119 if(this->getWaitKeyAfterFrame() == true)
1125 void ComplexSceneManager::resetScene(void)
1127 MFGlobalsType::const_iterator gIt
= _mfGlobals
.begin();
1128 MFGlobalsType::const_iterator gEnd
= _mfGlobals
.end ();
1130 CSMResetInterface
*pIf
= NULL
;
1132 for(; gIt
!= gEnd
; ++gIt
)
1134 pIf
= dynamic_cast<CSMResetInterface
*>(*gIt
);
1138 fprintf(stderr
, "found if %p\n", static_cast<void *>(pIf
));
1145 void ComplexSceneManager::key(Int32 x
,
1150 _oKeyHelper
.update(x
, y
, iState
, cKey
);
1153 void ComplexSceneManager::updateKeySensor(KeySensor
*pSensor
)
1155 _oKeyHelper
.updateSensors(pSensor
);
1158 void ComplexSceneManager::removeKeySensor(KeySensor
*pSensor
)
1160 _oKeyHelper
.removeSensor(pSensor
);