#include <OSGVRMLWriteAction.h>
Inheritance diagram for osg::VRMLWriteAction:

Public Types | |
| enum | TraversalMode { OSGCollectFC = 0x0001, OSGWrite = 0x0002 } |
| enum | WriterOption { OSGNoOptions = 0x0000, OSGNoIndent = 0x0001, OSGNoNormals = 0x0002 } |
| typedef ArgsCollector< Action * > | FunctorArgs |
| typedef TypedFunctor2Base< ResultE, CPtrRefCallArg< CNodePtr >, FunctorArgs > | Functor |
| enum | ResultE { Continue, Skip, Quit } |
Public Member Functions | |
| virtual | ~VRMLWriteAction (void) |
| Destructor. | |
| MaterialPtr | getMaterial (void) const |
| Constructor Destructor. | |
| void | setMaterial (MaterialPtr material) |
| FILE * | getFilePtr (void) const |
| TraversalMode | getMode (void) const |
| bool | open (const Char8 *szFilename) |
| void | close (void) |
| void | addOptions (UInt32 uiOptions) |
| void | subOptions (UInt32 uiOptions) |
| UInt32 | getOptions (void) |
| virtual Action::ResultE | write (NodePtr node) |
| bool | operator< (const VRMLWriteAction &other) const |
| assignment assignment | |
| bool | operator== (const VRMLWriteAction &other) const |
| equal | |
| bool | operator!= (const VRMLWriteAction &other) const |
| unequal | |
| void | registerEnterFunction (const FieldContainerType &type, const Functor &func) |
| void | registerLeaveFunction (const FieldContainerType &type, const Functor &func) |
| NodePtr | getActNode (void) |
| UInt32 | getNNodes (void) const |
| const NodePtr | getNode (int index) |
| void | addNode (NodePtr node) |
| void | useNodeList (void) |
| void | printTable (void) |
| UInt32 | getTravMask (void) const |
| void | setTravMask (UInt32 val) |
| bool | operator< (const Action &other) |
| assignment | |
| bool | operator== (const Action &other) |
| equal | |
| bool | operator!= (const Action &other) |
| unequal | |
Static Public Member Functions | |
| static const char * | getClassname (void) |
| static VRMLWriteAction * | create (void) |
| create a new action | |
| static void | setPrototype (VRMLWriteAction *proto) |
| static VRMLWriteAction * | getPrototype (void) |
| static void | registerEnterDefault (const FieldContainerType &type, const Functor &func) |
| static void | registerLeaveDefault (const FieldContainerType &type, const Functor &func) |
| static void | setPrototype (Action *proto) |
| static void | registerEnterDefault (const FieldContainerType &type, const Functor &func) |
| static void | registerLeaveDefault (const FieldContainerType &type, const Functor &func) |
Protected Member Functions | |
| virtual std::vector< Functor > * | getDefaultEnterFunctors (void) |
| virtual std::vector< Functor > * | getDefaultLeaveFunctors (void) |
| virtual Action::ResultE | apply (std::vector< NodePtr >::iterator begin, std::vector< NodePtr >::iterator end) |
| virtual Action::ResultE | apply (NodePtr node) |
| ResultE | callEnter (NodePtr node) |
| ResultE | callLeave (NodePtr node) |
| virtual ResultE | start (void) |
| virtual ResultE | stop (ResultE res) |
| ResultE | recurse (NodePtr node) |
| ResultE | callNewList (void) |
| void | setActNode (NodePtr node) |
Static Protected Member Functions | |
| static ResultE | _defaultEnterFunction (CNodePtr &node, Action *action) |
| static ResultE | _defaultLeaveFunction (CNodePtr &node, Action *action) |
Protected Attributes | |
| std::vector< Functor > | _enterFunctors |
| std::vector< Functor > | _leaveFunctors |
Private Types | |
| typedef Action | Inherited |
Private Member Functions | |
| VRMLWriteAction (void) | |
| Constructor. | |
| VRMLWriteAction (const VRMLWriteAction &source) | |
| Copy-Constructor. | |
| VRMLWriteAction & | operator= (const VRMLWriteAction &source) |
| void | incIndent (UInt32 uiDelta) |
| void | decIndent (UInt32 uiDelta) |
| void | printIndent (void) |
| void | setCurrentUse (bool bVal) |
| bool | isCurrentUse (void) |
| void | addNodeUse (CNodePtr &pNode) |
| void | addContainerUse (FieldContainerPtr &pContainer) |
| FCInfo * | getInfo (FieldContainerPtr &pContainer) |
| bool | isWritten (FieldContainerPtr &fc) |
| UInt32 | getIndex (FieldContainerPtr &fc) |
| UInt32 | setWritten (FieldContainerPtr &fc) |
Static Private Member Functions | |
| static Action::ResultE | writeGroupEnter (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeGroupLeave (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeMatGroupEnter (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeMatGroupLeave (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeComponentTransformEnter (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeComponentTransformLeave (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeTransformEnter (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeTransformLeave (CNodePtr &pGroup, Action *pAction) |
| static void | writePoints (GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static void | writeNormals (GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static void | writeColors (GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static void | writeTexCoords (GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static void | writeIndex (GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static void | writeLineIndex (GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static void | writeMaterial (GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static bool | writeGeoCommon (NodePtr pNode, GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter, const Char8 *setTypename) |
| static void | writePointSet (NodePtr pNode, GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter) |
| static void | writeLineSet (NodePtr pNode, GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter, bool bSinglePrimitiveGeo) |
| static void | writeFaceSet (NodePtr pNode, GeometryPtr pGeo, FILE *pFile, VRMLWriteAction *pWriter, bool bSinglePrimitiveGeo) |
| static Action::ResultE | writeGeoEnter (CNodePtr &pGroup, Action *pAction) |
| static Action::ResultE | writeGeoLeave (CNodePtr &pGroup, Action *pAction) |
| static bool | initializeAction (void) |
| static bool | terminateAction (void) |
Private Attributes | |
| MaterialPtr | _material |
| UInt32 | _uiIndent |
| FILE * | _pFile |
| TraversalMode | _eTraversalMode |
| bool | _currentUse |
| UInt32 | _uiOptions |
| std::vector< FCInfo > | _vFCInfos |
| std::vector< FieldContainerPtr > | _writtenFCs |
Static Private Attributes | |
| static char | cvsid [] = "@(#)$Id: $" |
| static VRMLWriteAction * | _prototype = NULL |
| static std::vector< Functor > * | _defaultEnterFunctors |
| static std::vector< Functor > * | _defaultLeaveFunctors |
| static ActionInitializer | _actionInitializer |
Friends | |
| struct | ActionInitializer |
Classes | |
| struct | ActionInitializer |
| struct | FCInfo |
Definition at line 81 of file OSGVRMLWriteAction.h.
|
|
Definition at line 212 of file OSGVRMLWriteAction.h. |
|
|
Definition at line 95 of file OSGAction.h. |
|
|
Definition at line 99 of file OSGAction.h. |
|
|
Definition at line 89 of file OSGVRMLWriteAction.h. 00090 { 00091 OSGCollectFC = 0x0001, 00092 OSGWrite = 0x0002 00093 };
|
|
|
Definition at line 95 of file OSGVRMLWriteAction.h. 00096 { 00097 OSGNoOptions = 0x0000, 00098 OSGNoIndent = 0x0001, 00099 OSGNoNormals = 0x0002 00100 };
|
|
|
Definition at line 87 of file OSGAction.h. 00088 { 00089 Continue, // continue with my children 00090 Skip, // skip my children 00091 // really needed? Cancel, // skip my brothers, go one step up 00092 Quit // forget it, you're done 00093 };
|
|
|
Definition at line 2007 of file OSGVRMLWriteAction.cpp.
|
|
|
Definition at line 1948 of file OSGVRMLWriteAction.cpp. References _defaultEnterFunctors, _defaultLeaveFunctors, osg::Action::_enterFunctors, and osg::Action::_leaveFunctors. Referenced by create(). 01948 : 01949 Inherited ( ), 01950 _material (NULL ), 01951 _uiIndent (0 ), 01952 _pFile (NULL ), 01953 _eTraversalMode(OSGCollectFC), 01954 _currentUse (false ), 01955 _uiOptions (OSGNoOptions), 01956 _vFCInfos ( ), 01957 _writtenFCs ( ) 01958 { 01959 if(_defaultEnterFunctors) 01960 _enterFunctors = *_defaultEnterFunctors; 01961 01962 if(_defaultLeaveFunctors) 01963 _leaveFunctors = *_defaultLeaveFunctors; 01964 }
|
|
|
Definition at line 1970 of file OSGVRMLWriteAction.cpp. References _defaultEnterFunctors, _defaultLeaveFunctors, osg::Action::_enterFunctors, and osg::Action::_leaveFunctors. 01970 : 01971 Inherited (source ), 01972 _material (source._material ), 01973 _uiIndent (source._uiIndent ), 01974 _pFile (NULL ), 01975 _eTraversalMode(source._eTraversalMode), 01976 _currentUse (source._currentUse ), 01977 _uiOptions (source._uiOptions ), 01978 _vFCInfos (source._vFCInfos ), 01979 _writtenFCs (source._writtenFCs ) 01980 { 01981 if(_defaultEnterFunctors) 01982 _enterFunctors = *_defaultEnterFunctors; 01983 01984 if(_defaultLeaveFunctors) 01985 _leaveFunctors = *_defaultLeaveFunctors; 01986 }
|
|
|
Reimplemented from osg::Action. Definition at line 110 of file OSGVRMLWriteAction.h.
|
|
|
Reimplemented from osg::Action. Definition at line 1991 of file OSGVRMLWriteAction.cpp. References _prototype, and VRMLWriteAction(). Referenced by osg::VRMLSceneFileType::write(). 01992 { 01993 VRMLWriteAction * act; 01994 01995 if(_prototype) 01996 act = new VRMLWriteAction(*_prototype); 01997 else 01998 act = new VRMLWriteAction(); 01999 02000 return act; 02001 }
|
|
|
Definition at line 295 of file OSGVRMLWriteAction.cpp. References _prototype. 00296 { 00297 _prototype = proto; 00298 }
|
|
|
Reimplemented from osg::Action. Definition at line 300 of file OSGVRMLWriteAction.cpp. References _prototype. 00301 { 00302 return _prototype; 00303 }
|
|
||||||||||||
|
Referenced by initializeAction(). |
|
||||||||||||
|
Referenced by initializeAction(). |
|
|
Definition at line 105 of file OSGVRMLWriteAction.inl. References _material. Referenced by writeMaterial(). 00106 { 00107 return _material; 00108 }
|
|
|
Definition at line 2015 of file OSGVRMLWriteAction.cpp. References _material. Referenced by write(), writeMatGroupEnter(), and writeMatGroupLeave(). 02016 { 02017 _material = material; 02018 }
|
|
|
Definition at line 111 of file OSGVRMLWriteAction.inl. References _pFile. Referenced by writeComponentTransformEnter(), writeComponentTransformLeave(), writeGeoEnter(), writeGeoLeave(), writeGroupEnter(), writeGroupLeave(), writeTransformEnter(), and writeTransformLeave(). 00112 { 00113 return _pFile; 00114 }
|
|
|
Definition at line 117 of file OSGVRMLWriteAction.inl. References _eTraversalMode. Referenced by writeComponentTransformEnter(), writeComponentTransformLeave(), writeGeoEnter(), writeGeoLeave(), writeGroupEnter(), writeGroupLeave(), writeMatGroupEnter(), writeMatGroupLeave(), writeTransformEnter(), and writeTransformLeave(). 00118 { 00119 return _eTraversalMode; 00120 }
|
|
|
Definition at line 2020 of file OSGVRMLWriteAction.cpp. References _pFile. Referenced by osg::VRMLSceneFileType::write(). 02021 { 02022 if(szFilename != NULL) 02023 { 02024 _pFile = fopen(szFilename, "w"); 02025 02026 if(_pFile != NULL) 02027 { 02028 fprintf(_pFile, "#VRML V2.0 utf8 \n"); 02029 } 02030 } 02031 02032 return _pFile != NULL; 02033 }
|
|
|
Definition at line 2035 of file OSGVRMLWriteAction.cpp. References _pFile. Referenced by osg::VRMLSceneFileType::write().
|
|
|
Definition at line 2043 of file OSGVRMLWriteAction.cpp. References _uiOptions. 02044 { 02045 _uiOptions |= uiOptions; 02046 }
|
|
|
Definition at line 2048 of file OSGVRMLWriteAction.cpp. References _uiOptions. 02049 { 02050 _uiOptions &= ~uiOptions; 02051 }
|
|
|
Definition at line 2053 of file OSGVRMLWriteAction.cpp. References _uiOptions. Referenced by writeIndex(), and writeNormals(). 02054 { 02055 return _uiOptions; 02056 }
|
|
|
Definition at line 2058 of file OSGVRMLWriteAction.cpp. References _eTraversalMode, _vFCInfos, _writtenFCs, osg::Action::apply(), osg::VRMLWriteAction::FCInfo::clear(), osg::Action::Continue, osg::NullFC, OSGCollectFC, OSGWrite, setMaterial(), and osg::FieldContainerFactory::the(). Referenced by osg::VRMLSceneFileType::write(). 02059 { 02060 Action::ResultE returnValue = Action::Continue; 02061 02062 _eTraversalMode = OSGCollectFC; 02063 02064 std::for_each(_vFCInfos.begin(), 02065 _vFCInfos.end(), 02066 std::mem_fun_ref(&FCInfo::clear)); 02067 02068 _vFCInfos.resize( 02069 FieldContainerFactory::the()->getFieldContainerStore()->size()); 02070 02071 _writtenFCs.clear(); 02072 02073 setMaterial(NullFC); 02074 02075 returnValue = Inherited::apply(node); 02076 02077 if(returnValue == Action::Continue) 02078 { 02079 _eTraversalMode = OSGWrite; 02080 returnValue = Inherited::apply(node); 02081 } 02082 02083 return returnValue; 02084 }
|
|
|
Definition at line 2117 of file OSGVRMLWriteAction.cpp.
|
|
|
Definition at line 2125 of file OSGVRMLWriteAction.cpp.
|
|
|
Definition at line 2134 of file OSGVRMLWriteAction.cpp.
|
|
|
Reimplemented from osg::Action. Definition at line 2146 of file OSGVRMLWriteAction.cpp. References _defaultEnterFunctors. 02147 { 02148 return _defaultEnterFunctors; 02149 }
|
|
|
Reimplemented from osg::Action. Definition at line 2152 of file OSGVRMLWriteAction.cpp. References _defaultLeaveFunctors. 02153 { 02154 return _defaultLeaveFunctors; 02155 }
|
|
||||||||||||
|
Reimplemented from osg::Action. Definition at line 2157 of file OSGVRMLWriteAction.cpp. References osg::Action::apply(). 02159 { 02160 return Inherited::apply(begin, end); 02161 }
|
|
|
Reimplemented from osg::Action. Definition at line 2163 of file OSGVRMLWriteAction.cpp. References osg::Action::apply(). 02164 { 02165 return Inherited::apply(node); 02166 }
|
|
||||||||||||
|
Definition at line 314 of file OSGVRMLWriteAction.cpp. References addNodeUse(), osg::Action::Continue, FDEBUG, FWARNING, osg::NodePtr::getCore(), getFilePtr(), getInfo(), getMode(), osg::VRMLWriteAction::FCInfo::getName(), osg::VRMLWriteAction::FCInfo::getUse(), osg::VRMLWriteAction::FCInfo::getWritten(), incIndent(), OSGCollectFC, printIndent(), osg::Action::Quit, and osg::VRMLWriteAction::FCInfo::setWritten(). Referenced by initializeAction(). 00316 { 00317 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00318 00319 NodePtr pNode(pGroup); 00320 00321 if(pWriter == NULL) 00322 { 00323 return Action::Quit; 00324 } 00325 00326 FDEBUG(("Write Group Enter 0x%04x\n", pWriter->getMode())); 00327 00328 if(pWriter->getMode() == VRMLWriteAction::OSGCollectFC) 00329 { 00330 pWriter->addNodeUse(pGroup); 00331 } 00332 else 00333 { 00334 FILE *pFile = pWriter->getFilePtr(); 00335 00336 if(pFile == NULL) 00337 { 00338 return Action::Quit; 00339 } 00340 00341 NodeCorePtr pCore = pNode->getCore(); 00342 00343 FCInfo *pInfo = pWriter->getInfo(pGroup); 00344 FCInfo *pCoreInfo = pWriter->getInfo(pCore ); 00345 00346 if(pInfo == NULL || pCoreInfo == NULL) 00347 { 00348 FWARNING(("Info missing %p %p\n", pInfo, pCoreInfo)); 00349 return Action::Quit; 00350 } 00351 00352 if(pCoreInfo->getUse() > 0 && 00353 pCoreInfo->getWritten() == true) 00354 { 00355 pWriter->printIndent(); 00356 fprintf(pFile, "Group # osg shared %s\n", pCoreInfo->getName()); 00357 00358 // pWriter->setCurrentUse(true); 00359 } 00360 else if((pCoreInfo->getName() != NULL) && 00361 (pCoreInfo->getName()[0] != '\0')) 00362 { 00363 pWriter->printIndent(); 00364 fprintf(pFile, "DEF %s Group\n", pCoreInfo->getName()); 00365 00366 pCoreInfo->setWritten(); 00367 } 00368 else if((pInfo->getName() != NULL) && 00369 (pInfo->getName()[0] != '\0')) 00370 { 00371 pWriter->printIndent(); 00372 fprintf(pFile, "DEF %s Group\n", pInfo->getName()); 00373 00374 pInfo->setWritten(); 00375 } 00376 else 00377 { 00378 pWriter->printIndent(); 00379 fprintf(pFile, "Group\n"); 00380 } 00381 00382 pWriter->printIndent(); 00383 fprintf(pFile, "{\n"); 00384 00385 if(pNode->getNChildren() != 0) 00386 { 00387 pWriter->incIndent(4); 00388 00389 pWriter->printIndent(); 00390 fprintf(pFile, "children [\n"); 00391 00392 pWriter->incIndent(4); 00393 } 00394 } 00395 00396 return Action::Continue; 00397 }
|
|
||||||||||||
|
Definition at line 399 of file OSGVRMLWriteAction.cpp. References osg::Action::Continue, decIndent(), FDEBUG, getFilePtr(), getMode(), isCurrentUse(), OSGCollectFC, printIndent(), osg::Action::Quit, and setCurrentUse(). Referenced by initializeAction(). 00401 { 00402 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00403 00404 NodePtr pNode(pGroup); 00405 00406 if(pWriter == NULL) 00407 { 00408 return Action::Quit; 00409 } 00410 00411 FDEBUG(("Write Group Leave 0x%04x\n", pWriter->getMode())); 00412 00413 if(pWriter->getMode() != VRMLWriteAction::OSGCollectFC) 00414 { 00415 FILE *pFile = pWriter->getFilePtr(); 00416 00417 if(pFile == NULL) 00418 { 00419 return Action::Quit; 00420 } 00421 00422 if(pWriter->isCurrentUse() == false) 00423 { 00424 if(pNode->getNChildren() != 0) 00425 { 00426 pWriter->decIndent(4); 00427 00428 pWriter->printIndent(); 00429 fprintf(pFile, "]\n"); 00430 00431 pWriter->decIndent(4); 00432 } 00433 00434 pWriter->printIndent(); 00435 fprintf(pFile, "}\n"); 00436 } 00437 00438 pWriter->setCurrentUse(false); 00439 } 00440 00441 return Action::Continue; 00442 }
|
|
||||||||||||
|
Definition at line 1686 of file OSGVRMLWriteAction.cpp. References osg::Action::Continue, osg::AttachmentContainerPtr::dcast(), FDEBUG, osg::Node::getCore(), getMode(), osg::CNodePtr::getNode(), osg::NullFC, osg::Action::Quit, and setMaterial(). Referenced by initializeAction(). 01688 { 01689 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 01690 01691 MaterialGroupPtr pMatGroup = 01692 MaterialGroupPtr::dcast(pGroup.getNode()->getCore()); 01693 01694 if(pWriter == NULL || pMatGroup == NullFC) 01695 { 01696 return Action::Quit; 01697 } 01698 01699 FDEBUG(("Write MatGroup Enter 0x%04x\n", pWriter->getMode())); 01700 01701 pWriter->setMaterial(pMatGroup->getMaterial()); 01702 01703 return Action::Continue; 01704 }
|
|
||||||||||||
|
Definition at line 1706< |