#include <OSGLoader.h>
Inheritance diagram for osg::OSGLoader:

Member | |
| void | initFieldTypeMapper (void) |
| void | setFieldContainerValue (FieldContainerPtr pNewNode) |
| *FieldContainerPtr | _pCurrentFC |
| NodePtr | _pRootNode |
| Field * | _pCurrentField |
| const FieldDescription * | _pCurrentFieldDesc |
| NamedFCMap | _defMap |
| std::stack< FieldContainerPtr > | _fcStack |
| std::stack< Field * > | _fStack |
| std::stack< const FieldDescription * > | _fdStack |
Member | |
| void | reset (void) |
| void | setMapTypeIds (bool bVal) |
| void | setReferenceHeader (const Char8 *szReferenceHeader) |
| *bool | _bMapTypeIds |
| Char8 * | _szReferenceHeader |
| OSGScanParseLexer * | _pLexer |
Public Types | |
| enum | BuildInFieldType { OSGsfBool = TOK_SFBOOL, OSGsfColor = TOK_SFCOLOR, OSGsfFloat = TOK_SFFLOAT, OSGsfImage = TOK_SFIMAGE, OSGsfInt32 = TOK_SFINT32, OSGsfNode = TOK_SFNODE, OSGsfRotation = TOK_SFROTATION, OSGsfString = TOK_SFSTRING, OSGsfTime = TOK_SFTIME, OSGsfVec2f = TOK_SFVEC2F, OSGsfVec3f = TOK_SFVEC3F, OSGmfColor = TOK_MFCOLOR, OSGmfFloat = TOK_MFFLOAT, OSGmfInt32 = TOK_MFINT32, OSGmfNode = TOK_MFNODE, OSGmfRotation = TOK_MFROTATION, OSGmfString = TOK_MFSTRING, OSGmfTime = TOK_MFTIME, OSGmfVec2f = TOK_MFVEC2F, OSGmfVec3f = TOK_MFVEC3F, OSGmfColor4f = TOK_MFCOLOR4F, OSGmfColor4i = TOK_MFCOLOR4I, OSGmfColor3f = TOK_MFCOLOR3F, OSGmfMatrix = TOK_MFMATRIX, OSGmfPnt2f = TOK_MFPNT2F, OSGmfPnt3f = TOK_MFPNT3F, OSGmfPnt4f = TOK_MFPNT4F, OSGmfVec4f = TOK_MFVEC4F, OSGmfPlane = TOK_MFPLANE, OSGsfColor4f = TOK_SFCOLOR4F, OSGsfColor4i = TOK_SFCOLOR4I, OSGsfColor3f = TOK_SFCOLOR3F, OSGsfMatrix = TOK_SFMATRIX, OSGsfPnt2f = TOK_SFPNT2F, OSGsfPnt3f = TOK_SFPNT3F, OSGsfPnt4f = TOK_SFPNT4F, OSGsfVec4f = TOK_SFVEC4F, OSGsfPlane = TOK_SFPLANE, OSGsfVolume = TOK_SFVOLUME } |
| enum | { LastOption = 0x0001 } |
Public Member Functions | |
| * | ScanParseFieldTypeMapper (void) |
| *void | setExtIntMapping (BuildInFieldTypes eBuildInType, UInt32 uiMappedType) |
| void | setIntExtMapping (UInt32 uiMappedType, BuildInFieldTypes eBuildInType) |
| virtual Int32 | mapIntExtFieldType (const Char8 *szFieldname, const Int32 iFieldTypeId) |
Constructors | |
| * | OSGLoader (void) |
| Constructor. | |
Destructor | |
| *virtual | ~OSGLoader (void) |
| Destructor. | |
Skel replacements | |
| *virtual void | scanStream (std::istream &is) |
| virtual void | beginNode (const Char8 *szNodeTypename, const Char8 *szNodename) |
| virtual void | endNode (void) |
| virtual void | use (const Char8 *szName) |
| virtual void | beginField (const Char8 *szFieldname, const UInt32 uiFieldTypeId) |
| virtual void | endField (void) |
| virtual void | addFieldValue (const Char8 *szFieldVal) |
| virtual Int32 | mapExtIntFieldType (const Char8 *szFieldname, const Int32 iFieldTypeId) |
| virtual UInt32 | getFieldType (const Char8 *szFieldname) |
Get | |
| *virtual NodePtr | getRootNode (void) |
| virtual std::vector< FieldContainerPtr > | getRootNodes (void) |
| virtual FieldContainerPtr | getReference (const Char8 *szName) |
Scan | |
| virtual void | scanFile (const Char8 *szFilename) |
| virtual Int32 | lex (void) |
| virtual const Char8 * | getText (void) |
| void | expectType (Int32 iNextType) |
| virtual void | handleError (const Char8 *szErrorText) |
Prototypes | |
| *virtual bool | verifyHeader (const Char8 *szHeader) |
| virtual void | beginProto (const Char8 *szProtoname) |
| virtual void | endProto (void) |
| virtual void | beginExternProto (const Char8 *szProtoname) |
| virtual void | endExternProtoInterface (void) |
| virtual void | endExternProto (void) |
| virtual void | beginScript (const Char8 *szProtoname) |
| virtual void | endScript (void) |
| virtual void | beginEventInDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName) |
| virtual void | beginEventOutDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName) |
| virtual void | endEventDecl (void) |
| virtual void | beginFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName) |
| virtual void | endFieldDecl (void) |
| virtual void | beginExposedFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName) |
| virtual void | endExposedFieldDecl (void) |
| virtual void | addExternEventInDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName) |
| virtual void | addExternEventOutDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName) |
| virtual void | addExternFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName) |
| virtual void | addExternExposedFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName) |
Nodes | |
| virtual void | is (const Char8 *szName) |
Misc | |
| virtual void | addRoute (const Char8 *szOutNodename, const Char8 *szOutFieldname, const Char8 *szInNodename, const Char8 *szInFieldname) |
| virtual void | profileElement (const Char8 *szProfileName) |
| virtual void | componentElement (const Char8 *szComponentName) |
| virtual void | metaElement (const Char8 *szMetaKey, const Char8 *szMetaValue) |
| virtual void | importElement (const Char8 *szInlineName, const Char8 *szNodeName, const Char8 *szImportAs) |
| virtual void | exportElement (const Char8 *szNodeName, const Char8 *szExportAs) |
Type Information | |
| *bool | getMapFieldTypes (void) |
Protected Types | |
| typedef Inherited::BuildInFieldType | BuildInFieldTypes |
| typedef std::map< BuildInFieldTypes, UInt32 > | IntExtMap |
| typedef std::map< UInt32, BuildInFieldTypes > | ExtIntMap |
Protected Attributes | |
| *IntExtMap | _mIntExt |
| ExtIntMap | _mExtInt |
Private Types | |
| typedef ScanParseFieldTypeMapper< ScanParseSkel > | Inherited |
| typedef std::map< std::string, FieldContainerPtr > | NamedFCMap |
| typedef OSGLoader | Self |
Private Member Functions | |
| OSGLoader (const OSGLoader &source) | |
| prohibit default function (move to 'public' if needed) | |
| void | operator= (const OSGLoader &source) |
| prohibit default function (move to 'public' if needed) | |
Definition at line 64 of file OSGLoader.h.
|
|
Reimplemented from osg::ScanParseFieldTypeMapper< ScanParseSkel >. Definition at line 70 of file OSGLoader.h. |
|
|
Definition at line 72 of file OSGLoader.h. |
|
|
Definition at line 73 of file OSGLoader.h. |
|
|
Definition at line 61 of file OSGScanParseFieldTypeMapper.h. |
|
|
Definition at line 64 of file OSGScanParseFieldTypeMapper.h. |
|
|
Definition at line 66 of file OSGScanParseFieldTypeMapper.h. |
|
|
Definition at line 67 of file OSGScanParseSkel.h. 00068 { 00069 OSGsfBool = TOK_SFBOOL, 00070 OSGsfColor = TOK_SFCOLOR, 00071 OSGsfFloat = TOK_SFFLOAT, 00072 OSGsfImage = TOK_SFIMAGE, 00073 OSGsfInt32 = TOK_SFINT32, 00074 OSGsfNode = TOK_SFNODE, 00075 OSGsfRotation = TOK_SFROTATION, 00076 OSGsfString = TOK_SFSTRING, 00077 OSGsfTime = TOK_SFTIME, 00078 OSGsfVec2f = TOK_SFVEC2F, 00079 OSGsfVec3f = TOK_SFVEC3F, 00080 OSGmfColor = TOK_MFCOLOR, 00081 OSGmfFloat = TOK_MFFLOAT, 00082 OSGmfInt32 = TOK_MFINT32, 00083 OSGmfNode = TOK_MFNODE, 00084 OSGmfRotation = TOK_MFROTATION, 00085 OSGmfString = TOK_MFSTRING, 00086 OSGmfTime = TOK_MFTIME, 00087 OSGmfVec2f = TOK_MFVEC2F, 00088 OSGmfVec3f = TOK_MFVEC3F, 00089 00090 OSGmfColor4f = TOK_MFCOLOR4F, 00091 OSGmfColor4i = TOK_MFCOLOR4I, 00092 OSGmfColor3f = TOK_MFCOLOR3F, 00093 OSGmfMatrix = TOK_MFMATRIX, 00094 OSGmfPnt2f = TOK_MFPNT2F, 00095 OSGmfPnt3f = TOK_MFPNT3F, 00096 OSGmfPnt4f = TOK_MFPNT4F, 00097 OSGmfVec4f = TOK_MFVEC4F, 00098 OSGmfPlane = TOK_MFPLANE, 00099 OSGsfColor4f = TOK_SFCOLOR4F, 00100 OSGsfColor4i = TOK_SFCOLOR4I, 00101 OSGsfColor3f = TOK_SFCOLOR3F, 00102 OSGsfMatrix = TOK_SFMATRIX, 00103 OSGsfPnt2f = TOK_SFPNT2F, 00104 OSGsfPnt3f = TOK_SFPNT3F, 00105 OSGsfPnt4f = TOK_SFPNT4F, 00106 OSGsfVec4f = TOK_SFVEC4F, 00107 OSGsfPlane = TOK_SFPLANE, 00108 OSGsfVolume = TOK_SFVOLUME 00109 };
|
|
|
Definition at line 111 of file OSGScanParseSkel.h. 00112 { 00113 LastOption = 0x0001 00114 };
|
|
|
Definition at line 364 of file OSGLoader.cpp. References initFieldTypeMapper(), and osg::ScanParseSkel::setReferenceHeader(). 00364 : 00365 Inherited(), 00366 _pCurrentFC (NullFC), 00367 _pRootNode (NullFC), 00368 _pCurrentField(NULL), 00369 _fcStack (), 00370 _fStack (), 00371 _fdStack () 00372 { 00373 Self::setReferenceHeader("#OSG V1.0 "); 00374 initFieldTypeMapper(); 00375 }
|
|
|
Definition at line 380 of file OSGLoader.cpp.
|
|
|
|
|
|
Reimplemented from osg::ScanParseSkel. Definition at line 386 of file OSGLoader.cpp. References _defMap, _pCurrentFC, _pCurrentField, _pCurrentFieldDesc, _pRootNode, osg::NullFC, and osg::ScanParseSkel::scanStream(). Referenced by osg::OSGSceneFileType::read(). 00387 { 00388 if(is) 00389 { 00390 _pRootNode = NullFC; 00391 _pCurrentFC = NullFC; 00392 _pCurrentField = NULL; 00393 _pCurrentFieldDesc = NULL; 00394 _defMap.clear(); 00395 00396 Inherited::scanStream(is); 00397 } 00398 }
|
|
||||||||||||
|
Reimplemented from osg::ScanParseSkel. Definition at line 404 of file OSGLoader.cpp. References _defMap, _fcStack, _pCurrentFC, _pRootNode, osg::beginEditCP(), osg::Node::ChildrenFieldMask, osg::Node::CoreFieldMask, osg::GroupBase::create(), osg::Node::create(), osg::FieldContainerFactory::createFieldContainer(), osg::NodePtr::dcast(), osg::AttachmentContainerPtr::dcast(), osg::endEditCP(), osg::NullFC, PINFO, setFieldContainerValue(), osg::setName(), SLOG, and osg::FieldContainerFactory::the(). 00406 { 00407 FieldContainerPtr pNewNode; 00408 00409 if(szNodeTypename == NULL) 00410 return; 00411 00412 PINFO << "Begin node : " << szNodeTypename << " | "; 00413 00414 if(szNodename == NULL) 00415 { 00416 PINFO << "NULL"; 00417 } 00418 else 00419 { 00420 PINFO << szNodename; 00421 } 00422 00423 PINFO << std::endl; 00424 00425 pNewNode = 00426 FieldContainerFactory::the()->createFieldContainer(szNodeTypename); 00427 00428 if(szNodename != NULL && pNewNode != NullFC) 00429 { 00430 AttachmentContainerPtr pAttCon = 00431 AttachmentContainerPtr::dcast(pNewNode); 00432 00433 if(pAttCon != NullFC) 00434 { 00435 setName(pAttCon, szNodename); 00436 } 00437 00438 _defMap.insert(std::make_pair(std::string(szNodename), pNewNode)); 00439 } 00440 00441 // assign nodepointer to current sf|mf field 00442 setFieldContainerValue(pNewNode); 00443 00444 _pCurrentFC = pNewNode; 00445 00446 _fcStack.push(_pCurrentFC); 00447 00448 if(_fcStack.size() == 1) 00449 { 00450 NodePtr pNode; 00451 if(_pCurrentFC->getType().isNode()) 00452 { 00453 pNode = NodePtr::dcast(_pCurrentFC); 00454 } 00455 else if(_pCurrentFC->getType().isNodeCore()) 00456 { 00457 pNode = Node::create(); 00458 pNode->setCore(NodeCorePtr::dcast(_pCurrentFC)); 00459 } 00460 else 00461 { 00462 SLOG << "Fieldcontainer " << szNodeTypename 00463 << "is neither Node nor NodeCore " << std::endl; 00464 } 00465 00466 if(_pRootNode == NullFC) 00467 { 00468 GroupPtr pGroup = Group::create(); 00469 00470 _pRootNode = Node::create(); 00471 00472 beginEditCP(_pRootNode, Node::CoreFieldMask); 00473 { 00474 _pRootNode->setCore(pGroup); 00475 } 00476 endEditCP (_pRootNode, Node::CoreFieldMask); 00477 } 00478 00479 beginEditCP(_pRootNode, Node::ChildrenFieldMask); 00480 { 00481 _pRootNode->addChild(pNode); 00482 } 00483 endEditCP (_pRootNode, Node::ChildrenFieldMask); 00484 } 00485 }
|
|
|
Reimplemented from osg::ScanParseSkel. Definition at line 491 of file OSGLoader.cpp. References _fcStack, _pCurrentFC, osg::GroupBase::create(), osg::NodePtr::dcast(), osg::NodePtr::getCore(), osg::NullFC, and PINFO. 00492 { 00493 PINFO << "End Node" << std::endl; 00494 00495 if(_pCurrentFC != NullFC) 00496 { 00497 if(_pCurrentFC->getType().isNode() == true) 00498 { 00499 NodePtr pNode = NodePtr::dcast(_pCurrentFC); 00500 00501 if(pNode->getCore() == NullFC) 00502 { 00503 GroupPtr pGroup = Group::create(); 00504 00505 pNode->setCore(pGroup); 00506 } 00507 } 00508 } 00509 00510 _fcStack.pop(); 00511 00512 if(_fcStack.size() != 0) 00513 { 00514 _pCurrentFC = _fcStack.top(); 00515 } 00516 else 00517 { 00518 _pCurrentFC = NullFC; 00519 } 00520 }
|
|
|
Reimplemented from osg::ScanParseSkel. Definition at line 522 of file OSGLoader.cpp. References getReference(), osg::NullFC, setFieldContainerValue(), and SLOG. 00523 { 00524 FieldContainerPtr pUseNode; 00525 00526 // try to find a container with the given name attachment 00527 00528 pUseNode = getReference(szName); 00529 00530 if(pUseNode == NullFC) 00531 { 00532 SLOG << "No FieldContainer found with name " << szName << std::endl; 00533 } 00534 else 00535 { 00536 // assign nodepointer to current sf|mf field 00537 setFieldContainerValue(pUseNode); 00538 } 00539 }
|
|
||||||||||||
|
Reimplemented from osg::ScanParseSkel. Definition at line 641 of file OSGLoader.cpp. References _fdStack, _fStack, _pCurrentFC, _pCurrentField, _pCurrentFieldDesc, osg::ChangedOrigin::Abstract, osg::ChangedOrigin::AbstrIgnoreChild, osg::ChangedOrigin::AbstrIgnoreCore, osg::beginEditCP(), osg::FieldDescription::getFieldMask(), osg::NullFC, and PINFO. 00643 { 00644 PINFO << "BeginField " 00645 << szFieldname 00646 << " " 00647 << _pCurrentField 00648 << std::endl; 00649 00650 if(szFieldname == NULL) 00651 return; 00652 00653 _pCurrentField = NULL; 00654 00655 if(_pCurrentFC != NullFC) 00656 { 00657 _pCurrentField = _pCurrentFC->getField(szFieldname); 00658 00659 _pCurrentFieldDesc = 00660 _pCurrentFC->getType().findFieldDescription(szFieldname); 00661 00662 PINFO << "BF : " 00663 << szFieldname << " " 00664 << _pCurrentField << " " 00665 << _pCurrentFieldDesc << std::endl; 00666 00667 if(_pCurrentFieldDesc != NULL) 00668 { 00669 beginEditCP(_pCurrentFC, 00670 _pCurrentFieldDesc->getFieldMask(), 00671 ChangedOrigin::Abstract | 00672 ChangedOrigin::AbstrIgnoreCore | 00673 ChangedOrigin::AbstrIgnoreChild ); 00674 } 00675 } 00676 00677 _fStack.push (_pCurrentField); 00678 _fdStack.push(_pCurrentFieldDesc); 00679 }
|
|
|
|
Reimplemented from osg::ScanParseSkel. Definition at line 557 of file OSGLoader.cpp. References _pCurrentField, PINFO, and osg::Field::pushValueByStr(). 00558 { 00559 PINFO << "\t\tFV : " << szFieldVal << std::endl; 00560 00561 if(_pCurrentField != NULL) 00562 { 00563 _pCurrentField->pushValueByStr(szFieldVal); 00564 } 00565 }
|
|
||||||||||||
|
Reimplemented from osg::ScanParseFieldTypeMapper< ScanParseSkel >. Definition at line 590 of file OSGLoader.cpp. References _pCurrentFC, osg::FieldType::getCardinality(), osg::TypeBase::getCName(), osg::FieldType::getContentType(), osg::Field::getType(), osg::ScanParseFieldTypeMapper< ScanParseSkel >::mapExtIntFieldType(), osg::NullFC, osg::ScanParseSkel::OSGmfNode, osg::ScanParseSkel::OSGsfNode, PINFO, and osg::FieldType::SINGLE_FIELD. 00592 { 00593 Int32 returnValue = Inherited::mapExtIntFieldType(szFieldname, 00594 iFieldTypeId); 00595 00596 if(returnValue < 0 && szFieldname != NULL && _pCurrentFC != NullFC) 00597 { 00598 Field *pField = _pCurrentFC->getField(szFieldname); 00599 00600 if(pField != NULL) 00601 { 00602 const FieldType &oFieldType = pField->getType(); 00603 00604 /* Should be this way 00605 00606 if(oFieldType.getContentType().isDerivedFrom( 00607 FieldDataTraits<FieldContainerPtr>::getType()) == true) 00608 { 00609 } 00610 */ 00611 00612 PINFO << "FieldTypeId invalid, trying to fix. " << std::endl; 00613 PINFO << oFieldType.getContentType().getCName() 00614 << " comparing with " 00615 << FieldDataTraits<FieldContainerPtr>::getType().getCName() 00616 << std::endl; 00617 00618 00619 if(strstr(oFieldType.getContentType().getCName(), 00620 "Ptr" ) != NULL) 00621 { 00622 PINFO << "FieldContainerPtr or derived class, " 00623 << "parsing as Node" 00624 << std::endl; 00625 00626 if(oFieldType.getCardinality() == FieldType::SINGLE_FIELD) 00627 { 00628 returnValue = ScanParseSkel::OSGsfNode; 00629 } 00630 else 00631 { 00632 returnValue = ScanParseSkel::OSGmfNode; 00633 } 00634 } 00635 } 00636 } 00637 00638 return returnValue; 00639 }
|
|
|
Reimplemented from osg::ScanParseSkel. Definition at line 567 of file OSGLoader.cpp. References _pCurrentFC, osg::FieldType::getScanTypeId(), osg::Field::getType(), osg::NullFC, and PINFO. 00568 { 00569 UInt32 returnValue = 0; 00570 Field *pField = NULL; 00571 00572 if(szFieldname == NULL) 00573 return returnValue; 00574 00575 if(_pCurrentFC != NullFC) 00576 { 00577 pField = _pCurrentFC->getField(szFieldname); 00578 00579 PINFO << "GF : " << szFieldname << " " << pField << std::endl; 00580 00581 if(pField != NULL) 00582 { 00583 returnValue = pField->getType().getScanTypeId(); 00584 } 00585 } 00586 00587 return returnValue; 00588 }
|
|
|
Definition at line 541 of file OSGLoader.cpp. References _pRootNode. Referenced by osg::OSGSceneFileType::read(). 00542 { 00543 return _pRootNode; 00544 }
|
|
|
Definition at line 546 of file OSGLoader.cpp. References _pRootNode. 00547 { 00548 std::vector<FieldContainerPtr> fcVec; 00549 00550 for( UInt32 i=0; i<_pRootNode->getNChildren(); ++i ) 00551 { 00552 fcVec.push_back( _pRootNode->getChild(i) ); 00553 } 00554 return fcVec; 00555 }
|
|
|
Definition at line 718 of file OSGLoader.cpp. References _defMap, and osg::NullFC. Referenced by use(). 00719 { 00720 // Find a previously DEF'ed FC by its name and return Ptr to it 00721 00722 NamedFCMap::iterator entry = _defMap.find(std::string(szName)); 00723 00724 if(entry == _defMap.end()) 00725 return NullFC; 00726 00727 return entry->second; // return the stored FCPtr 00728 }
|
|