#include <OSGVRMLWriteAction.h>

Public Types | |
| enum | TraversalMode { OSGCollectFC = 0x0001, OSGWrite = 0x0002 } |
| enum | WriterOption { OSGNoOptions = 0x0000, OSGNoIndent = 0x0001, OSGNoNormals = 0x0002, OSGPixelTextures = 0x0004 } |
| enum | ResultE { Continue, Skip, Quit } |
| typedef ArgsCollector< Action * > | FunctorArgs |
| typedef TypedFunctor2Base < ResultE, CPtrRefCallArg < CNodePtr >, FunctorArgs > | Functor |
Public Member Functions | |
| virtual | ~VRMLWriteAction (void) |
| Destructor. | |
| MaterialPtr | getMaterial (void) const |
| Constructor. | |
| 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 | |
| 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) |
| 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) |
| void | updateProgress (void) |
| 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 |
| UInt32 | _nodeCount |
| UInt32 | _currentNodeCount |
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.
typedef Action osg::VRMLWriteAction::Inherited [private] |
Definition at line 213 of file OSGVRMLWriteAction.h.
typedef ArgsCollector<Action *> osg::Action::FunctorArgs [inherited] |
Definition at line 95 of file OSGAction.h.
typedef TypedFunctor2Base<ResultE, CPtrRefCallArg<CNodePtr>, FunctorArgs > osg::Action::Functor [inherited] |
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 OSGPixelTextures = 0x0004 00101 };
enum osg::Action::ResultE [inherited] |
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 };
| VRMLWriteAction::~VRMLWriteAction | ( | void | ) | [virtual] |
| VRMLWriteAction::VRMLWriteAction | ( | void | ) | [private] |
Definition at line 2023 of file OSGVRMLWriteAction.cpp.
References _defaultEnterFunctors, _defaultLeaveFunctors, osg::Action::_enterFunctors, and osg::Action::_leaveFunctors.
Referenced by create().
02023 : 02024 Inherited ( ), 02025 _material (NullFC ), 02026 _uiIndent (0 ), 02027 _pFile (NULL ), 02028 _eTraversalMode (OSGCollectFC), 02029 _currentUse (false ), 02030 _uiOptions (OSGNoOptions), 02031 _vFCInfos ( ), 02032 _writtenFCs ( ), 02033 _nodeCount (0 ), 02034 _currentNodeCount(0 ) 02035 { 02036 if(_defaultEnterFunctors) 02037 _enterFunctors = *_defaultEnterFunctors; 02038 02039 if(_defaultLeaveFunctors) 02040 _leaveFunctors = *_defaultLeaveFunctors; 02041 }
| VRMLWriteAction::VRMLWriteAction | ( | const VRMLWriteAction & | source | ) | [private] |
Definition at line 2047 of file OSGVRMLWriteAction.cpp.
References _defaultEnterFunctors, _defaultLeaveFunctors, osg::Action::_enterFunctors, and osg::Action::_leaveFunctors.
02047 : 02048 Inherited (source ), 02049 _material (source._material ), 02050 _uiIndent (source._uiIndent ), 02051 _pFile (NULL ), 02052 _eTraversalMode (source._eTraversalMode ), 02053 _currentUse (source._currentUse ), 02054 _uiOptions (source._uiOptions ), 02055 _vFCInfos (source._vFCInfos ), 02056 _writtenFCs (source._writtenFCs ), 02057 _nodeCount (source._nodeCount ), 02058 _currentNodeCount(source._currentNodeCount) 02059 { 02060 if(_defaultEnterFunctors) 02061 _enterFunctors = *_defaultEnterFunctors; 02062 02063 if(_defaultLeaveFunctors) 02064 _leaveFunctors = *_defaultLeaveFunctors; 02065 }
| static const char* osg::VRMLWriteAction::getClassname | ( | void | ) | [inline, static] |
| VRMLWriteAction * VRMLWriteAction::create | ( | void | ) | [static] |
Reimplemented from osg::Action.
Definition at line 2070 of file OSGVRMLWriteAction.cpp.
References _prototype, and VRMLWriteAction().
Referenced by osg::VRMLSceneFileType::write().
02071 { 02072 VRMLWriteAction * act; 02073 02074 if(_prototype) 02075 act = new VRMLWriteAction(*_prototype); 02076 else 02077 act = new VRMLWriteAction(); 02078 02079 return act; 02080 }
| void VRMLWriteAction::setPrototype | ( | VRMLWriteAction * | proto | ) | [static] |
Definition at line 297 of file OSGVRMLWriteAction.cpp.
References _prototype.
00298 { 00299 _prototype = proto; 00300 }
| VRMLWriteAction * VRMLWriteAction::getPrototype | ( | void | ) | [static] |
Reimplemented from osg::Action.
Definition at line 302 of file OSGVRMLWriteAction.cpp.
References _prototype.
00303 { 00304 return _prototype; 00305 }
| static void osg::VRMLWriteAction::registerEnterDefault | ( | const FieldContainerType & | type, | |
| const Functor & | func | |||
| ) | [static] |
Referenced by initializeAction().
| static void osg::VRMLWriteAction::registerLeaveDefault | ( | const FieldContainerType & | type, | |
| const Functor & | func | |||
| ) | [static] |
Referenced by initializeAction().
| MaterialPtr osg::VRMLWriteAction::getMaterial | ( | void | ) | const [inline] |
Destructor
Definition at line 105 of file OSGVRMLWriteAction.inl.
References _material.
Referenced by writeMaterial().
00106 { 00107 return _material; 00108 }
| void VRMLWriteAction::setMaterial | ( | MaterialPtr | material | ) |
Definition at line 2094 of file OSGVRMLWriteAction.cpp.
References _material.
Referenced by write(), writeMatGroupEnter(), and writeMatGroupLeave().
02095 { 02096 _material = material; 02097 }
| FILE * osg::VRMLWriteAction::getFilePtr | ( | void | ) | const [inline] |
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 }
| VRMLWriteAction::TraversalMode osg::VRMLWriteAction::getMode | ( | void | ) | const [inline] |
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 }
| bool VRMLWriteAction::open | ( | const Char8 * | szFilename | ) |
Definition at line 2099 of file OSGVRMLWriteAction.cpp.
References _pFile.
Referenced by osg::VRMLSceneFileType::write().
02100 { 02101 if(szFilename != NULL) 02102 { 02103 _pFile = fopen(szFilename, "w"); 02104 02105 if(_pFile != NULL) 02106 { 02107 fprintf(_pFile, "#VRML V2.0 utf8 \n"); 02108 } 02109 } 02110 02111 return _pFile != NULL; 02112 }
| void VRMLWriteAction::close | ( | void | ) |
Definition at line 2114 of file OSGVRMLWriteAction.cpp.
References _pFile.
Referenced by osg::VRMLSceneFileType::write().
| void VRMLWriteAction::addOptions | ( | UInt32 | uiOptions | ) |
Definition at line 2122 of file OSGVRMLWriteAction.cpp.
References _uiOptions.
Referenced by osg::VRMLSceneFileType::write().
02123 { 02124 _uiOptions |= uiOptions; 02125 }
| void VRMLWriteAction::subOptions | ( | UInt32 | uiOptions | ) |
Definition at line 2127 of file OSGVRMLWriteAction.cpp.
References _uiOptions.
Referenced by osg::VRMLSceneFileType::write().
02128 { 02129 _uiOptions &= ~uiOptions; 02130 }
| UInt32 VRMLWriteAction::getOptions | ( | void | ) |
Definition at line 2132 of file OSGVRMLWriteAction.cpp.
References _uiOptions.
Referenced by writeIndex(), writeMaterial(), and writeNormals().
02133 { 02134 return _uiOptions; 02135 }
| Action::ResultE VRMLWriteAction::write | ( | NodePtr | node | ) | [virtual] |
Definition at line 2137 of file OSGVRMLWriteAction.cpp.
References _currentNodeCount, _eTraversalMode, _nodeCount, _vFCInfos, _writtenFCs, osg::Action::apply(), osg::VRMLWriteAction::FCInfo::clear(), osg::Action::Continue, osg::NullFC, OSGCollectFC, OSGWrite, setMaterial(), osg::SceneFileHandler::the(), osg::FieldContainerFactory::the(), osg::SceneFileHandler::updateReadProgress(), and osg::SceneFileHandler::updateWriteProgress().
Referenced by osg::VRMLSceneFileType::write().
02138 { 02139 Action::ResultE returnValue = Action::Continue; 02140 02141 _eTraversalMode = OSGCollectFC; 02142 02143 std::for_each(_vFCInfos.begin(), 02144 _vFCInfos.end(), 02145 std::mem_fun_ref(&FCInfo::clear)); 02146 02147 _vFCInfos.resize( 02148 FieldContainerFactory::the()->getFieldContainerStore()->size()); 02149 02150 _writtenFCs.clear(); 02151 02152 setMaterial(NullFC); 02153 02154 SceneFileHandler::the().updateWriteProgress(0); 02155 _nodeCount = 0; 02156 _currentNodeCount = 0; 02157 02158 returnValue = Inherited::apply(node); 02159 02160 if(returnValue == Action::Continue) 02161 { 02162 _eTraversalMode = OSGWrite; 02163 returnValue = Inherited::apply(node); 02164 } 02165 02166 SceneFileHandler::the().updateReadProgress(100); 02167 02168 return returnValue; 02169 }
| bool VRMLWriteAction::operator< | ( | const VRMLWriteAction & | other | ) | const |
| bool VRMLWriteAction::operator== | ( | const VRMLWriteAction & | other | ) | const |
| bool VRMLWriteAction::operator!= | ( | const VRMLWriteAction & | other | ) | const |
| std::vector< VRMLWriteAction::Functor > * VRMLWriteAction::getDefaultEnterFunctors | ( | void | ) | [protected, virtual] |
Reimplemented from osg::Action.
Definition at line 2231 of file OSGVRMLWriteAction.cpp.
References _defaultEnterFunctors.
02232 { 02233 return _defaultEnterFunctors; 02234 }
| std::vector< VRMLWriteAction::Functor > * VRMLWriteAction::getDefaultLeaveFunctors | ( | void | ) | [protected, virtual] |
Reimplemented from osg::Action.
Definition at line 2237 of file OSGVRMLWriteAction.cpp.
References _defaultLeaveFunctors.
02238 { 02239 return _defaultLeaveFunctors; 02240 }
| Action::ResultE VRMLWriteAction::apply | ( | std::vector< NodePtr >::iterator | begin, | |
| std::vector< NodePtr >::iterator | end | |||
| ) | [protected, virtual] |
Reimplemented from osg::Action.
Definition at line 2242 of file OSGVRMLWriteAction.cpp.
References osg::Action::apply().
02244 { 02245 return Inherited::apply(begin, end); 02246 }
| Action::ResultE VRMLWriteAction::apply | ( | NodePtr | node | ) | [protected, virtual] |
Reimplemented from osg::Action.
Definition at line 2248 of file OSGVRMLWriteAction.cpp.
References osg::Action::apply().
02249 { 02250 return Inherited::apply(node); 02251 }
| Action::ResultE VRMLWriteAction::writeGroupEnter | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 316 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, osg::VRMLWriteAction::FCInfo::setWritten(), and updateProgress().
Referenced by initializeAction().
00318 { 00319 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00320 00321 NodePtr pNode(pGroup); 00322 00323 if(pWriter == NULL) 00324 { 00325 return Action::Quit; 00326 } 00327 00328 FDEBUG(("Write Group Enter 0x%04x\n", pWriter->getMode())); 00329 00330 if(pWriter->getMode() == VRMLWriteAction::OSGCollectFC) 00331 { 00332 pWriter->addNodeUse(pGroup); 00333 } 00334 else 00335 { 00336 FILE *pFile = pWriter->getFilePtr(); 00337 00338 if(pFile == NULL) 00339 { 00340 return Action::Quit; 00341 } 00342 00343 pWriter->updateProgress(); 00344 00345 NodeCorePtr pCore = pNode->getCore(); 00346 00347 FCInfo *pInfo = pWriter->getInfo(pGroup); 00348 FCInfo *pCoreInfo = pWriter->getInfo(pCore ); 00349 00350 if(pInfo == NULL || pCoreInfo == NULL) 00351 { 00352 FWARNING(("Info missing %p %p\n", pInfo, pCoreInfo)); 00353 return Action::Quit; 00354 } 00355 00356 if(pCoreInfo->getUse() > 0 && 00357 pCoreInfo->getWritten() == true) 00358 { 00359 pWriter->printIndent(); 00360 fprintf(pFile, "Group # osg shared %s\n", pCoreInfo->getName()); 00361 00362 // pWriter->setCurrentUse(true); 00363 } 00364 else if((pCoreInfo->getName() != NULL) && 00365 (pCoreInfo->getName()[0] != '\0')) 00366 { 00367 pWriter->printIndent(); 00368 fprintf(pFile, "DEF %s Group\n", pCoreInfo->getName()); 00369 00370 pCoreInfo->setWritten(); 00371 } 00372 else if((pInfo->getName() != NULL) && 00373 (pInfo->getName()[0] != '\0')) 00374 { 00375 pWriter->printIndent(); 00376 fprintf(pFile, "DEF %s Group\n", pInfo->getName()); 00377 00378 pInfo->setWritten(); 00379 } 00380 else 00381 { 00382 pWriter->printIndent(); 00383 fprintf(pFile, "Group\n"); 00384 } 00385 00386 pWriter->printIndent(); 00387 fprintf(pFile, "{\n"); 00388 00389 if(pNode->getNChildren() != 0) 00390 { 00391 pWriter->incIndent(4); 00392 00393 pWriter->printIndent(); 00394 fprintf(pFile, "children [\n"); 00395 00396 pWriter->incIndent(4); 00397 } 00398 } 00399 00400 return Action::Continue; 00401 }
| Action::ResultE VRMLWriteAction::writeGroupLeave | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 403 of file OSGVRMLWriteAction.cpp.
References osg::Action::Continue, decIndent(), FDEBUG, getFilePtr(), getMode(), isCurrentUse(), OSGCollectFC, printIndent(), osg::Action::Quit, and setCurrentUse().
Referenced by initializeAction().
00405 { 00406 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00407 00408 NodePtr pNode(pGroup); 00409 00410 if(pWriter == NULL) 00411 { 00412 return Action::Quit; 00413 } 00414 00415 FDEBUG(("Write Group Leave 0x%04x\n", pWriter->getMode())); 00416 00417 if(pWriter->getMode() != VRMLWriteAction::OSGCollectFC) 00418 { 00419 FILE *pFile = pWriter->getFilePtr(); 00420 00421 if(pFile == NULL) 00422 { 00423 return Action::Quit; 00424 } 00425 00426 if(pWriter->isCurrentUse() == false) 00427 { 00428 if(pNode->getNChildren() != 0) 00429 { 00430 pWriter->decIndent(4); 00431 00432 pWriter->printIndent(); 00433 fprintf(pFile, "]\n"); 00434 00435 pWriter->decIndent(4); 00436 } 00437 00438 pWriter->printIndent(); 00439 fprintf(pFile, "}\n"); 00440 } 00441 00442 pWriter->setCurrentUse(false); 00443 } 00444 00445 return Action::Continue; 00446 }
| Action::ResultE VRMLWriteAction::writeMatGroupEnter | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 1754 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().
01756 { 01757 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 01758 01759 MaterialGroupPtr pMatGroup = 01760 MaterialGroupPtr::dcast(pGroup.getNode()->getCore()); 01761 01762 if(pWriter == NULL || pMatGroup == NullFC) 01763 { 01764 return Action::Quit; 01765 } 01766 01767 FDEBUG(("Write MatGroup Enter 0x%04x\n", pWriter->getMode())); 01768 01769 pWriter->setMaterial(pMatGroup->getMaterial()); 01770 01771 return Action::Continue; 01772 }
| Action::ResultE VRMLWriteAction::writeMatGroupLeave | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 1774 of file OSGVRMLWriteAction.cpp.
References osg::Action::Continue, FDEBUG, getMode(), osg::NullFC, osg::Action::Quit, and setMaterial().
Referenced by initializeAction().
01776 { 01777 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 01778 01779 01780 if(pWriter == NULL) 01781 { 01782 return Action::Quit; 01783 } 01784 01785 FDEBUG(("Write MatGroup Leave 0x%04x\n", pWriter->getMode())); 01786 01787 pWriter->setMaterial(NullFC); 01788 01789 return Action::Continue; 01790 }
| Action::ResultE VRMLWriteAction::writeComponentTransformEnter | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 448 of file OSGVRMLWriteAction.cpp.
References addNodeUse(), osg::Action::Continue, osg::AttachmentContainerPtr::dcast(), FDEBUG, osg::Node::getCore(), getFilePtr(), getInfo(), getMode(), osg::VRMLWriteAction::FCInfo::getName(), osg::CNodePtr::getNode(), osg::VRMLWriteAction::FCInfo::getWritten(), incIndent(), OSGCollectFC, printIndent(), osg::Action::Quit, osg::VRMLWriteAction::FCInfo::setWritten(), and updateProgress().
Referenced by initializeAction().
00450 { 00451 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00452 00453 ComponentTransformPtr pTrans = 00454 ComponentTransformPtr::dcast(pGroup.getNode()->getCore()); 00455 00456 Real32 rQX; 00457 Real32 rQY; 00458 Real32 rQZ; 00459 Real32 rQW; 00460 00461 if(pWriter == NULL) 00462 { 00463 return Action::Quit; 00464 } 00465 00466 FDEBUG(("Write ComponentTransform Enter 0x%04x\n", pWriter->getMode())); 00467 00468 if(pWriter->getMode() == VRMLWriteAction::OSGCollectFC) 00469 { 00470 pWriter->addNodeUse(pGroup); 00471 } 00472 else 00473 { 00474 FILE *pFile = pWriter->getFilePtr(); 00475 00476 if(pFile == NULL) 00477 { 00478 return Action::Quit; 00479 } 00480 00481 pWriter->updateProgress(); 00482 00483 FCInfo *pInfo = pWriter->getInfo(pGroup); 00484 00485 if(pInfo == NULL) 00486 { 00487 return Action::Quit; 00488 } 00489 00490 if((pInfo->getName() != NULL ) && 00491 (pInfo->getWritten() == false) && 00492 (pInfo->getName()[0] != '\0')) 00493 { 00494 pWriter->printIndent(); 00495 fprintf(pFile, "DEF %s Transform\n", pInfo->getName()); 00496 00497 pInfo->setWritten(); 00498 } 00499 else 00500 { 00501 pWriter->printIndent(); 00502 fprintf(pFile, "Transform\n"); 00503 } 00504 00505 pWriter->printIndent(); 00506 fprintf(pFile, "{\n"); 00507 00508 pWriter->incIndent(4); 00509 00510 pWriter->printIndent(); 00511 fprintf(pFile, "center %f %f %f\n", 00512 pTrans->getCenter()[0], 00513 pTrans->getCenter()[1], 00514 pTrans->getCenter()[2]); 00515 00516 pTrans->getRotation().getValueAsAxisRad(rQX, rQY, rQZ, rQW); 00517 00518 pWriter->printIndent(); 00519 fprintf(pFile, "rotation %f %f %f %f\n", 00520 rQX, rQY, rQZ, rQW); 00521 00522 pWriter->printIndent(); 00523 fprintf(pFile, "scale %f %f %f\n", 00524 pTrans->getScale()[0], 00525 pTrans->getScale()[1], 00526 pTrans->getScale()[2]); 00527 00528 pTrans->getScaleOrientation().getValueAsAxisRad(rQX, rQY, rQZ, rQW); 00529 00530 pWriter->printIndent(); 00531 fprintf(pFile, "scaleOrientation %f %f %f %f\n", 00532 rQX, rQY, rQZ, rQW); 00533 00534 pWriter->printIndent(); 00535 fprintf(pFile, "translation %f %f %f\n", 00536 pTrans->getTranslation()[0], 00537 pTrans->getTranslation()[1], 00538 pTrans->getTranslation()[2]); 00539 00540 pWriter->printIndent(); 00541 fprintf(pFile, "children [\n"); 00542 00543 pWriter->incIndent(4); 00544 } 00545 00546 return Action::Continue; 00547 }
| Action::ResultE VRMLWriteAction::writeComponentTransformLeave | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 549 of file OSGVRMLWriteAction.cpp.
References osg::Action::Continue, decIndent(), FDEBUG, getFilePtr(), getMode(), OSGCollectFC, printIndent(), and osg::Action::Quit.
Referenced by initializeAction().
00551 { 00552 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00553 00554 if(pWriter == NULL) 00555 { 00556 return Action::Quit; 00557 } 00558 00559 FDEBUG(("Write ComponentTransform Leave 0x%04x\n", pWriter->getMode())); 00560 00561 if(pWriter->getMode() != VRMLWriteAction::OSGCollectFC) 00562 { 00563 FILE *pFile = pWriter->getFilePtr(); 00564 00565 if(pFile == NULL) 00566 { 00567 return Action::Quit; 00568 } 00569 00570 pWriter->decIndent(4); 00571 00572 pWriter->printIndent(); 00573 fprintf(pFile, "]\n"); 00574 00575 pWriter->decIndent(4); 00576 00577 pWriter->printIndent(); 00578 fprintf(pFile, "}\n"); 00579 } 00580 00581 return Action::Continue; 00582 }
| Action::ResultE VRMLWriteAction::writeTransformEnter | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 584 of file OSGVRMLWriteAction.cpp.
References addNodeUse(), osg::Action::Continue, osg::AttachmentContainerPtr::dcast(), FDEBUG, osg::Node::getCore(), getFilePtr(), getInfo(), getMode(), osg::VRMLWriteAction::FCInfo::getName(), osg::CNodePtr::getNode(), osg::TransformationMatrix< ValueTypeT >::getTransform(), osg::QuaternionBase< ValueTypeT >::getValueAsAxisRad(), osg::VRMLWriteAction::FCInfo::getWritten(), incIndent(), OSGCollectFC, printIndent(), osg::Action::Quit, osg::VRMLWriteAction::FCInfo::setWritten(), and updateProgress().
Referenced by initializeAction().
00586 { 00587 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00588 00589 TransformPtr pTrans = TransformPtr::dcast(pGroup.getNode()->getCore()); 00590 00591 Real32 rQX; 00592 Real32 rQY; 00593 Real32 rQZ; 00594 Real32 rQW; 00595 00596 if(pWriter == NULL) 00597 { 00598 return Action::Quit; 00599 } 00600 00601 FDEBUG(("Write Transform Enter 0x%04x\n", pWriter->getMode())); 00602 00603 if(pWriter->getMode() == VRMLWriteAction::OSGCollectFC) 00604 { 00605 pWriter->addNodeUse(pGroup); 00606 } 00607 else 00608 { 00609 FILE *pFile = pWriter->getFilePtr(); 00610 00611 if(pFile == NULL) 00612 { 00613 return Action::Quit; 00614 } 00615 00616 pWriter->updateProgress(); 00617 00618 FCInfo *pInfo = pWriter->getInfo(pGroup); 00619 00620 if(pInfo == NULL) 00621 { 00622 return Action::Quit; 00623 } 00624 00625 if((pInfo->getName() != NULL ) && 00626 (pInfo->getWritten() == false) && 00627 (pInfo->getName()[0] != '\0')) 00628 { 00629 pWriter->printIndent(); 00630 fprintf(pFile, "DEF %s Transform\n", pInfo->getName()); 00631 00632 pInfo->setWritten(); 00633 } 00634 else 00635 { 00636 pWriter->printIndent(); 00637 fprintf(pFile, "Transform\n"); 00638 } 00639 00640 pWriter->printIndent(); 00641 fprintf(pFile, "{\n"); 00642 00643 pWriter->incIndent(4); 00644 00645 // decompose matrix. 00646 Matrix m = pTrans->getSFMatrix()->getValue(); 00647 Vec3f translation, scale, center; 00648 Quaternion rotation, scaleOrientation; 00649 m.getTransform(translation, rotation, scale, scaleOrientation); 00650 00651 pWriter->printIndent(); 00652 fprintf(pFile, "center %f %f %f\n", 00653 center[0], 00654 center[1], 00655 center[2]); 00656 00657 rotation.getValueAsAxisRad(rQX, rQY, rQZ, rQW); 00658 00659 pWriter->printIndent(); 00660 fprintf(pFile, "rotation %f %f %f %f\n", 00661 rQX, rQY, rQZ, rQW); 00662 00663 pWriter->printIndent(); 00664 fprintf(pFile, "scale %f %f %f\n", 00665 scale[0], 00666 scale[1], 00667 scale[2]); 00668 00669 scaleOrientation.getValueAsAxisRad(rQX, rQY, rQZ, rQW); 00670 00671 pWriter->printIndent(); 00672 fprintf(pFile, "scaleOrientation %f %f %f %f\n", 00673 rQX, rQY, rQZ, rQW); 00674 00675 pWriter->printIndent(); 00676 fprintf(pFile, "translation %f %f %f\n", 00677 translation[0], 00678 translation[1], 00679 translation[2]); 00680 00681 pWriter->printIndent(); 00682 fprintf(pFile, "children [\n"); 00683 00684 pWriter->incIndent(4); 00685 } 00686 00687 return Action::Continue; 00688 }
| Action::ResultE VRMLWriteAction::writeTransformLeave | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 690 of file OSGVRMLWriteAction.cpp.
References osg::Action::Continue, decIndent(), FDEBUG, getFilePtr(), getMode(), OSGCollectFC, printIndent(), and osg::Action::Quit.
Referenced by initializeAction().
00692 { 00693 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 00694 00695 if(pWriter == NULL) 00696 { 00697 return Action::Quit; 00698 } 00699 00700 FDEBUG(("Write Transform Leave 0x%04x\n", pWriter->getMode())); 00701 00702 if(pWriter->getMode() != VRMLWriteAction::OSGCollectFC) 00703 { 00704 FILE *pFile = pWriter->getFilePtr(); 00705 00706 if(pFile == NULL) 00707 { 00708 return Action::Quit; 00709 } 00710 00711 pWriter->decIndent(4); 00712 00713 pWriter->printIndent(); 00714 fprintf(pFile, "]\n"); 00715 00716 pWriter->decIndent(4); 00717 00718 pWriter->printIndent(); 00719 fprintf(pFile, "}\n"); 00720 } 00721 00722 return Action::Continue; 00723 }
| void VRMLWriteAction::writePoints | ( | GeometryPtr | pGeo, | |
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 725 of file OSGVRMLWriteAction.cpp.
References decIndent(), incIndent(), osg::NullFC, p, and printIndent().
Referenced by writeFaceSet(), and writeLineSet().
00728 { 00729 if(pGeo == NullFC) 00730 return; 00731 00732 GeoPositionsPtr pPos = pGeo->getPositions(); 00733 00734 if(pPos == NullFC) 00735 return; 00736 00737 pWriter->printIndent(); 00738 fprintf(pFile, "coord Coordinate\n"); 00739 00740 pWriter->printIndent(); 00741 fprintf(pFile, "{\n"); 00742 pWriter->incIndent(4); 00743 00744 pWriter->printIndent(); 00745 fprintf(pFile, "point [\n"); 00746 pWriter->incIndent(4); 00747 00748 for(UInt32 i = 0; i < pPos->getSize(); i++) 00749 { 00750 pWriter->printIndent(); 00751 00752 Pnt3f p; 00753 pPos->getValue(p,i); 00754 00755 fprintf(pFile, "%f %f %f", p[0], p[1], p[2]); 00756 00757 if(i == pPos->getSize() - 1) 00758 { 00759 fprintf(pFile, "\n"); 00760 } 00761 else 00762 { 00763 fprintf(pFile, ", \n"); 00764 } 00765 } 00766 00767 pWriter->decIndent(4); 00768 pWriter->printIndent(); 00769 fprintf(pFile, "]\n"); 00770 00771 pWriter->decIndent(4); 00772 pWriter->printIndent(); 00773 fprintf(pFile, "}\n"); 00774 00775 }
| void VRMLWriteAction::writeNormals | ( | GeometryPtr | pGeo, | |
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 777 of file OSGVRMLWriteAction.cpp.
References decIndent(), getOptions(), incIndent(), osg::NullFC, OSGNoNormals, and printIndent().
Referenced by writeFaceSet().
00780 { 00781 if(0 != (pWriter->getOptions() & VRMLWriteAction::OSGNoNormals)) 00782 return; 00783 00784 if(pGeo == NullFC) 00785 return; 00786 00787 GeoNormalsPtr pNorm = pGeo->getNormals(); 00788 00789 if(pNorm == NullFC) 00790 return; 00791 00792 pWriter->printIndent(); 00793 fprintf(pFile, "normal Normal\n"); 00794 00795 pWriter->printIndent(); 00796 fprintf(pFile, "{\n"); 00797 pWriter->incIndent(4); 00798 00799 pWriter->printIndent(); 00800 fprintf(pFile, "vector [\n"); 00801 pWriter->incIndent(4); 00802 00803 for(UInt32 i = 0; i < pNorm->getSize(); i++) 00804 { 00805 pWriter->printIndent(); 00806 00807 Vec3f n; 00808 pNorm->getValue(n,i); 00809 00810 fprintf(pFile, "%f %f %f", n[0], n[1], n[2]); 00811 00812 if(i == pNorm->getSize() - 1) 00813 { 00814 fprintf(pFile, "\n"); 00815 } 00816 else 00817 { 00818 fprintf(pFile, ", \n"); 00819 } 00820 } 00821 00822 pWriter->decIndent(4); 00823 pWriter->printIndent(); 00824 fprintf(pFile, "]\n"); 00825 00826 pWriter->decIndent(4); 00827 pWriter->printIndent(); 00828 fprintf(pFile, "}\n"); 00829 }
| void VRMLWriteAction::writeColors | ( | GeometryPtr | pGeo, | |
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 831 of file OSGVRMLWriteAction.cpp.
References decIndent(), incIndent(), osg::NullFC, and printIndent().
Referenced by writeFaceSet(), and writeLineSet().
00834 { 00835 if(pGeo == NullFC) 00836 return; 00837 00838 GeoColorsPtr pCol = pGeo->getColors(); 00839 00840 if(pCol == NullFC) 00841 return; 00842 00843 pWriter->printIndent(); 00844 fprintf(pFile, "color Color\n"); 00845 00846 pWriter->printIndent(); 00847 fprintf(pFile, "{\n"); 00848 pWriter->incIndent(4); 00849 00850 pWriter->printIndent(); 00851 fprintf(pFile, "color [\n"); 00852 pWriter->incIndent(4); 00853 00854 for(UInt32 i = 0; i < pCol->getSize(); i++) 00855 { 00856 pWriter->printIndent(); 00857 00858 Color3f c; 00859 pCol->getValue(c,i); 00860 00861 fprintf(pFile, "%f %f %f", c[0], c[1], c[2]); 00862 00863 if(i == pCol->getSize() - 1) 00864 { 00865 fprintf(pFile, "\n"); 00866 } 00867 else 00868 { 00869 fprintf(pFile, ", \n"); 00870 } 00871 } 00872 00873 pWriter->decIndent(4); 00874 pWriter->printIndent(); 00875 fprintf(pFile, "]\n"); 00876 00877 pWriter->decIndent(4); 00878 pWriter->printIndent(); 00879 fprintf(pFile, "}\n"); 00880 }
| void VRMLWriteAction::writeTexCoords | ( | GeometryPtr | pGeo, | |
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 882 of file OSGVRMLWriteAction.cpp.
References decIndent(), incIndent(), osg::NullFC, and printIndent().
Referenced by writeFaceSet().
00885 { 00886 if(pGeo == NullFC) 00887 return; 00888 00889 GeoTexCoordsPtr pTex = pGeo->getTexCoords(); 00890 00891 if(pTex == NullFC) 00892 return; 00893 00894 pWriter->printIndent(); 00895 fprintf(pFile, "texCoord TextureCoordinate\n"); 00896 00897 pWriter->printIndent(); 00898 fprintf(pFile, "{\n"); 00899 pWriter->incIndent(4); 00900 00901 pWriter->printIndent(); 00902 fprintf(pFile, "point [\n"); 00903 pWriter->incIndent(4); 00904 00905 for(UInt32 i = 0; i < pTex->getSize(); i++) 00906 { 00907 pWriter->printIndent(); 00908 00909 Vec2f t; 00910 pTex->getValue(t,i); 00911 00912 fprintf(pFile, "%f %f", t[0], t[1]); 00913 00914 if(i == pTex->getSize() - 1) 00915 { 00916 fprintf(pFile, "\n"); 00917 } 00918 else 00919 { 00920 fprintf(pFile, ", \n"); 00921 } 00922 } 00923 00924 pWriter->decIndent(4); 00925 pWriter->printIndent(); 00926 fprintf(pFile, "]\n"); 00927 00928 pWriter->decIndent(4); 00929 pWriter->printIndent(); 00930 fprintf(pFile, "}\n"); 00931 }
| void VRMLWriteAction::writeIndex | ( | GeometryPtr | pGeo, | |
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 933 of file OSGVRMLWriteAction.cpp.
References decIndent(), osg::TriangleIterator::getColorIndex(), osg::TriangleIterator::getNormalIndex(), getOptions(), osg::TriangleIterator::getPositionIndex(), osg::TriangleIterator::getTexCoordsIndex(), incIndent(), osg::NullFC, OSGNoNormals, and printIndent().
Referenced by writeFaceSet().
00936 { 00937 if(pGeo == NullFC) 00938 return; 00939 00940 GeoIndicesPtr pIndex = pGeo->getIndices(); 00941 GeoPTypesPtr pTypes = pGeo->getTypes(); 00942 GeoPLengthsPtr pLength = pGeo->getLengths(); 00943 00944 if((pIndex == NullFC) || 00945 (pTypes == NullFC) || 00946 (pLength == NullFC)) 00947 { 00948 return; 00949 } 00950 00951 if(pIndex->size() == 0 || 00952 pTypes->size() == 0 || 00953 pLength->size() == 0) 00954 { 00955 return; 00956 } 00957 00958 pWriter->printIndent(); 00959 fprintf(pFile, "coordIndex [\n"); 00960 pWriter->incIndent(4); 00961 00962 TriangleIterator it; 00963 00964 for(it = pGeo->beginTriangles(); it != pGeo->endTriangles(); ++it) 00965 { 00966 pWriter->printIndent(); 00967 00968 for(UInt32 i = 0; i < 3; ++i) 00969 { 00970 fprintf(pFile, "%d, ", it.getPositionIndex(i)); 00971 } 00972 /* 00973 fprintf(pFile, "%d,%d,%d,", it.getPositionIndex(0), 00974 it.getPositionIndex(1), 00975 it.getPositionIndex(2)); 00976 if(it.getPositionIndex(3) != -1) 00977 fprintf(pFile, "%d,", it.getPositionIndex(3)); 00978 */ 00979 00980 fprintf(pFile, "-1,\n"); 00981 } 00982 00983 pWriter->decIndent(4); 00984 pWriter->printIndent(); 00985 fprintf(pFile, "]\n"); 00986 00987 if(pGeo->getNormals() != NullFC && 00988 pGeo->getNormals()->getSize() > 0 && 00989 0 == (pWriter->getOptions() & VRMLWriteAction::OSGNoNormals)) 00990 { 00991 pWriter->printIndent(); 00992 fprintf(pFile, "normalIndex [\n"); 00993 pWriter->incIndent(4); 00994 00995 TriangleIterator it; 00996 00997 for(it = pGeo->beginTriangles(); it != pGeo->endTriangles(); ++it) 00998 { 00999 pWriter->printIndent(); 01000 01001 for(UInt32 i = 0; i < 3; ++i) 01002 { 01003 fprintf(pFile, "%d, ", it.getNormalIndex(i)); 01004 } 01005 01006 /* 01007 fprintf(pFile, "%d,%d,%d,", it.getNormalIndex(0), 01008 it.getNormalIndex(1), 01009 it.getNormalIndex(2)); 01010 if(it.getNormalIndex(3) != -1) 01011 fprintf(pFile, "%d,", it.getNormalIndex(3)); 01012 */ 01013 01014 fprintf(pFile, "-1,\n"); 01015 } 01016 01017 pWriter->decIndent(4); 01018 pWriter->printIndent(); 01019 fprintf(pFile, "]\n"); 01020 } 01021 01022 if(pGeo->getColors() != NullFC && pGeo->getColors()->getSize() > 0) 01023 { 01024 pWriter->printIndent(); 01025 fprintf(pFile, "colorIndex [\n"); 01026 pWriter->incIndent(4); 01027 01028 TriangleIterator it; 01029 01030 for(it = pGeo->beginTriangles(); it != pGeo->endTriangles(); ++it) 01031 { 01032 pWriter->printIndent(); 01033 01034 for(UInt32 i = 0; i < 3; ++i) 01035 { 01036 fprintf(pFile, " %d,", it.getColorIndex(i)); 01037 } 01038 /* 01039 fprintf(pFile, "%d,%d,%d,", it.getColorIndex(0), 01040 it.getColorIndex(1), 01041 it.getColorIndex(2)); 01042 if(it.getColorIndex(3) != -1) 01043 fprintf(pFile, "%d,", it.getColorIndex(3)); 01044 */ 01045 01046 fprintf(pFile, "-1,\n"); 01047 } 01048 01049 pWriter->decIndent(4); 01050 pWriter->printIndent(); 01051 fprintf(pFile, "]\n"); 01052 } 01053 01054 if(pGeo->getTexCoords() != NullFC && pGeo->getTexCoords()->getSize() > 0) 01055 { 01056 pWriter->printIndent(); 01057 fprintf(pFile, "texCoordIndex [\n"); 01058 pWriter->incIndent(4); 01059 01060 TriangleIterator it; 01061 01062 for(it = pGeo->beginTriangles(); it != pGeo->endTriangles(); ++it) 01063 { 01064 pWriter->printIndent(); 01065 01066 for(UInt32 i = 0; i < 3; ++i) 01067 { 01068 fprintf(pFile, "%d,", it.getTexCoordsIndex(i)); 01069 } 01070 /* 01071 fprintf(pFile, "%d,%d,%d,", it.getTexCoordsIndex(0), 01072 it.getTexCoordsIndex(1), 01073 it.getTexCoordsIndex(2)); 01074 if(it.getTexCoordsIndex(3) != -1) 01075 fprintf(pFile, "%d,", it.getTexCoordsIndex(3)); 01076 */ 01077 01078 fprintf(pFile, "-1,\n"); 01079 } 01080 01081 pWriter->decIndent(4); 01082 pWriter->printIndent(); 01083 fprintf(pFile, "]\n"); 01084 } 01085 }
| void VRMLWriteAction::writeLineIndex | ( | GeometryPtr | pGeo, | |
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 1087 of file OSGVRMLWriteAction.cpp.
References decIndent(), osg::PrimitiveIterator::getColorIndex(), osg::PrimitiveIterator::getLength(), osg::PrimitiveIterator::getPositionIndex(), osg::PrimitiveIterator::getType(), incIndent(), osg::NullFC, and printIndent().
Referenced by writeLineSet().
01090 { 01091 if(pGeo == NullFC) 01092 return; 01093 01094 GeoPTypesPtr pTypes = pGeo->getTypes(); 01095 GeoPLengthsPtr pLength = pGeo->getLengths(); 01096 01097 if((pTypes == NullFC) || 01098 (pLength == NullFC)) 01099 { 01100 return; 01101 } 01102 01103 if(pTypes->size() == 0 || 01104 pLength->size() == 0) 01105 { 01106 return; 01107 } 01108 01109 pWriter->printIndent(); 01110 fprintf(pFile, "coordIndex [\n"); 01111 pWriter->incIndent(4); 01112 01113 PrimitiveIterator it; 01114 UInt32 i; 01115 01116 for(it = pGeo->beginPrimitives(); it != pGeo->endPrimitives(); ++it) 01117 { 01118 if(it.getType() == GL_LINES) 01119 { 01120 for(i = 0; i < it.getLength(); i += 2) 01121 { 01122 pWriter->printIndent(); 01123 01124 fprintf(pFile, "%d, %d, -1,\n", 01125 it.getPositionIndex(i), 01126 it.getPositionIndex(i + 1)); 01127 } 01128 } 01129 else if(it.getType() == GL_LINE_STRIP) 01130 { 01131 pWriter->printIndent(); 01132 01133 for(i = 0; i < it.getLength(); ++i) 01134 { 01135 fprintf(pFile, "%d, ", it.getPositionIndex(i)); 01136 } 01137 01138 fprintf(pFile, "-1,\n"); 01139 } 01140 else if(it.getType() == GL_LINE_LOOP) 01141 { 01142 pWriter->printIndent(); 01143 01144 for(i = 0; i < it.getLength(); ++i) 01145 { 01146 fprintf(pFile, "%d, ", it.getPositionIndex(i)); 01147 } 01148 01149 fprintf(pFile, "%d, -1, \n", it.getPositionIndex(i - 1)); 01150 } 01151 } 01152 01153 pWriter->decIndent(4); 01154 pWriter->printIndent(); 01155 fprintf(pFile, "]\n"); 01156 01157 01158 if(pGeo->getColors() != NullFC && pGeo->getColors()->getSize() > 0) 01159 { 01160 pWriter->printIndent(); 01161 fprintf(pFile, "colorIndex [\n"); 01162 pWriter->incIndent(4); 01163 01164 PrimitiveIterator it; 01165 UInt32 i; 01166 01167 for(it = pGeo->beginPrimitives(); it != pGeo->endPrimitives(); ++it) 01168 { 01169 if(it.getType() == GL_LINES) 01170 { 01171 for(i = 0; i < it.getLength(); i += 2) 01172 { 01173 pWriter->printIndent(); 01174 01175 fprintf(pFile, "%d, %d, -1,\n", 01176 it.getColorIndex(i), 01177 it.getColorIndex(i + 1)); 01178 } 01179 } 01180 else if(it.getType() == GL_LINE_STRIP) 01181 { 01182 pWriter->printIndent(); 01183 01184 for(i = 0; i < it.getLength(); ++i) 01185 { 01186 fprintf(pFile, "%d, ", it.getColorIndex(i)); 01187 } 01188 01189 fprintf(pFile, "-1,\n"); 01190 } 01191 else if(it.getType() == GL_LINE_LOOP) 01192 { 01193 pWriter->printIndent(); 01194 01195 for(i = 0; i < it.getLength(); ++i) 01196 { 01197 fprintf(pFile, "%d, ", it.getColorIndex(i)); 01198 } 01199 01200 fprintf(pFile, "%d, -1, \n", it.getColorIndex(i - 1)); 01201 } 01202 } 01203 01204 pWriter->decIndent(4); 01205 pWriter->printIndent(); 01206 fprintf(pFile, "]\n"); 01207 } 01208 }
| void VRMLWriteAction::writeMaterial | ( | GeometryPtr | pGeo, | |
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 1210 of file OSGVRMLWriteAction.cpp.
References osg::AttachmentPtr::dcast(), decIndent(), osg::Eps, osg::getDefaultMaterial(), getIndex(), getMaterial(), getOptions(), osg::TextureChunk::getStaticClassId(), osg::MaterialChunk::getStaticClassId(), incIndent(), isWritten(), osg::NullFC, osg::Image::OSG_LA_PF, osg::Image::OSG_RGB_PF, osg::Image::OSG_RGBA_PF, osg::osgabs(), OSGPixelTextures, printIndent(), setWritten(), and osg::subRefCP().
Referenced by writeFaceSet(), and writeLineSet().
01213 { 01214 if(pGeo == NullFC) 01215 return; 01216 01217 MaterialPtr pMat; 01218 01219 pMat = pWriter->getMaterial(); 01220 01221 if(pMat == NullFC) 01222 pMat = pGeo->getMaterial(); 01223 01224 if(pMat == NullFC) 01225 pMat = OSG::getDefaultMaterial(); 01226 01227 if(pWriter->isWritten(pMat)) 01228 { 01229 pWriter->printIndent(); 01230 fprintf(pFile, "appearance USE App_%u\n", pWriter->getIndex(pMat)); 01231 return; 01232 } 01233 01234 StatePtr st = pMat->makeState(); 01235 01236 StateChunkPtr sChunk = 01237 st->getChunk(MaterialChunk::getStaticClassId()); 01238 01239 if(sChunk == NullFC) 01240 return; 01241 01242 MaterialChunkPtr mChunk = MaterialChunkPtr::dcast(sChunk); 01243 01244 if(mChunk == NullFC) 01245 return; 01246 01247 pWriter->printIndent(); 01248 fprintf(pFile, "appearance DEF App_%u Appearance\n", pWriter->setWritten(pMat)); 01249 01250 pWriter->printIndent(); 01251 fprintf(pFile, "{\n"); 01252 01253 pWriter->incIndent(4); 01254 01255 pWriter->printIndent(); 01256 fprintf(pFile, "material Material\n"); 01257 01258 pWriter->printIndent(); 01259 fprintf(pFile, "{\n"); 01260 01261 pWriter->incIndent(4); 01262 01263 Real32 rAmbient = 0.f; 01264 01265 if(osgabs(mChunk->getDiffuse()[0]) > Eps) 01266 { 01267 rAmbient = mChunk->getAmbient()[0] / mChunk->getDiffuse()[0]; 01268 } 01269 else if(osgabs(mChunk->getDiffuse()[1]) > Eps) 01270 { 01271 rAmbient = mChunk->getAmbient()[1] / mChunk->getDiffuse()[1]; 01272 } 01273 else if(osgabs(mChunk->getDiffuse()[2]) > Eps) 01274 { 01275 rAmbient = mChunk->getAmbient()[2] / mChunk->getDiffuse()[2]; 01276 } 01277 01278 01279 pWriter->printIndent(); 01280 fprintf(pFile, "ambientIntensity %f\n", rAmbient); 01281 01282 pWriter->printIndent(); 01283 fprintf(pFile, "diffuseColor %f %f %f\n", 01284 mChunk->getDiffuse()[0], 01285 mChunk->getDiffuse()[1], 01286 mChunk->getDiffuse()[2]); 01287 01288 pWriter->printIndent(); 01289 if(!mChunk->getLit()) 01290 { 01291 fprintf(pFile, "emissiveColor 1.0 1.0 1.0\n"); 01292 } 01293 else 01294 { 01295 fprintf(pFile, "emissiveColor %f %f %f\n", 01296 mChunk->getEmission()[0], 01297 mChunk->getEmission()[1], 01298 mChunk->getEmission()[2]); 01299 } 01300 01301 pWriter->printIndent(); 01302 fprintf(pFile, "shininess %f\n", 01303 mChunk->getShininess() / 128.); 01304 01305 pWriter->printIndent(); 01306 fprintf(pFile, "specularColor %f %f %f\n", 01307 mChunk->getSpecular()[0], 01308 mChunk->getSpecular()[1], 01309 mChunk->getSpecular()[2]); 01310 01311 pWriter->printIndent(); 01312 fprintf(pFile, "transparency %f\n", 01313 1.f-mChunk->getDiffuse()[3]); 01314 01315 pWriter->decIndent(4); 01316 01317 pWriter->printIndent(); 01318 fprintf(pFile, "}\n"); 01319 01320 sChunk = st->getChunk(TextureChunk::getStaticClassId()); 01321 01322 TextureChunkPtr pTChunk = TextureChunkPtr::dcast(sChunk); 01323 01324 if(pTChunk != NullFC) 01325 { 01326 if(pWriter->isWritten(pTChunk)) 01327 { 01328 pWriter->printIndent(); 01329 fprintf(pFile, "texture USE Tex_%u\n", pWriter->getIndex(pTChunk)); 01330 subRefCP(st); 01331 } 01332 else 01333 { 01334 ImagePtr pImage = pTChunk->getImage(); 01335 01336 if(pImage != NullFC) 01337 { 01338 if(pWriter->getOptions() & 01339 VRMLWriteAction::OSGPixelTextures) 01340 { 01341 pWriter->printIndent(); 01342 fprintf(pFile, "texture DEF Tex_%u PixelTexture\n", 01343 pWriter->setWritten(pTChunk) ); 01344 01345 pWriter->printIndent(); 01346 fprintf(pFile, "{\n"); 01347 01348 pWriter->incIndent(4); 01349 01350 UInt32 pixelformat = pImage->getPixelFormat(); 01351 UInt32 pixelsize = 1; 01352 if ( pixelformat == Image::OSG_RGB_PF) 01353 pixelsize = 3; 01354 else if ( pixelformat == Image::OSG_RGBA_PF) 01355 pixelsize = 4; 01356 else if ( pixelformat == Image::OSG_LA_PF ) 01357 pixelsize = 2; 01358 01359 pWriter->printIndent(); 01360 fprintf(pFile, "image %d %d %u ", 01361 pImage->getWidth(), pImage->getHeight(), pixelsize); 01362 01363 const UInt8 *data = pImage->getData(); 01364 for (Int32 x=0; x<pImage->getHeight(); ++x) 01365 { 01366 for (Int32 y=0; y<pImage->getWidth(); ++y) 01367 { 01368 UInt32 pos = (x * pImage->getWidth() + y) * pixelsize; 01369 fprintf(pFile, "0x"); 01370 for (UInt32 i=0;i<pixelsize;i++) 01371 { 01372 fprintf(pFile, "%02X", (pImage->getData())[pos+i] ); 01373 } 01374 fprintf(pFile, " "); 01375 } 01376 fprintf(pFile, "\n"); 01377 } 01378 01379 if(pTChunk->getWrapS() != GL_REPEAT) 01380 { 01381 pWriter->printIndent(); 01382 fprintf(pFile, "repeatS FALSE\n"); 01383 } 01384 01385 if(pTChunk->getWrapT() != GL_REPEAT) 01386 { 01387 pWriter->printIndent(); 01388 fprintf(pFile, "repeatT FALSE\n"); 01389 } 01390 01391 pWriter->decIndent(4); 01392 01393 pWriter->printIndent(); 01394 fprintf(pFile, "}\n"); 01395 } 01396 else 01397 { 01398 const std::string *pFilename = 01399 pImage->findAttachmentField("fileName"); 01400 std::string filename; 01401 if(pFilename == NULL) 01402 filename = pImage->getName(); 01403 else 01404 filename = *pFilename; 01405 01406 if(!filename.empty()) 01407 { 01408 01409 pWriter->printIndent(); 01410 fprintf(pFile, "texture DEF Tex_%u ImageTexture\n", 01411 pWriter->setWritten(pTChunk) ); 01412 01413 pWriter->printIndent(); 01414 fprintf(pFile, "{\n"); 01415 01416 pWriter->incIndent(4); 01417 01418 pWriter->printIndent(); 01419 fprintf(pFile, "url \"%s\"\n", 01420 filename.c_str()); 01421 01422 if(pTChunk->getWrapS() != GL_REPEAT) 01423 { 01424 pWriter->printIndent(); 01425 fprintf(pFile, "repeatS FALSE\n"); 01426 } 01427 01428 if(pTChunk->getWrapT() != GL_REPEAT) 01429 { 01430 pWriter->printIndent(); 01431 fprintf(pFile, "repeatT FALSE\n"); 01432 } 01433 01434 pWriter->decIndent(4); 01435 01436 pWriter->printIndent(); 01437 fprintf(pFile, "}\n"); 01438 } 01439 } 01440 } 01441 } 01442 } 01443 /* 01444 sChunk = st->getChunk(TextureTransformChunk::getStaticClassId()); 01445 01446 TextureTransformChunkPtr pTTChunk = TextureTransformChunkPtr::dcast(sChunk); 01447 01448 if(pTTChunk != NullFC) 01449 { 01450 } 01451 */ 01452 01453 pWriter->decIndent(4); 01454 01455 pWriter->printIndent(); 01456 fprintf(pFile, "}\n"); 01457 01458 subRefCP(st); 01459 }
| bool VRMLWriteAction::writeGeoCommon | ( | NodePtr | pNode, | |
| GeometryPtr | pGeo, | |||
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter, | |||
| const Char8 * | setTypename | |||
| ) | [static, private] |
Definition at line 1461 of file OSGVRMLWriteAction.cpp.
References FWARNING, getInfo(), osg::VRMLWriteAction::FCInfo::getName(), osg::VRMLWriteAction::FCInfo::getUse(), osg::VRMLWriteAction::FCInfo::getWritten(), incIndent(), printIndent(), setCurrentUse(), and osg::VRMLWriteAction::FCInfo::setWritten().
Referenced by writeFaceSet(), writeLineSet(), and writePointSet().
01466 { 01467 FCInfo *pInfo = pWriter->getInfo(pNode); 01468 FCInfo *pCoreInfo = pWriter->getInfo(pGeo); 01469 01470 if(pInfo == NULL || pCoreInfo == NULL || setTypename == NULL) 01471 { 01472 FWARNING(("Info missing %p %p\n", pInfo, pCoreInfo)); 01473 return false; 01474 } 01475 01476 if(pCoreInfo->getUse() > 0 && 01477 pCoreInfo->getWritten() == true) 01478 { 01479 pWriter->printIndent(); 01480 fprintf(pFile, "geometry USE %s\n", pCoreInfo->getName()); 01481 pWriter->setCurrentUse(true); 01482 } 01483 else 01484 { 01485 if((pCoreInfo->getName() != NULL) && 01486 (pCoreInfo->getName()[0] != '\0')) 01487 { 01488 pWriter->printIndent(); 01489 fprintf(pFile, "geometry DEF %s %s\n", 01490 pCoreInfo->getName(), 01491 setTypename); 01492 01493 pCoreInfo->setWritten(); 01494 } 01495 else if((pInfo->getName() != NULL) && 01496 (pInfo->getName()[0] != '\0')) 01497 { 01498 pWriter->printIndent(); 01499 fprintf(pFile, 01500 "geometry DEF %s %s\n", 01501 pInfo->getName(), 01502 setTypename); 01503 01504 pInfo->setWritten(); 01505 } 01506 else 01507 { 01508 pWriter->printIndent(); 01509 fprintf(pFile, "geometry %s\n", setTypename); 01510 01511 } 01512 01513 pWriter->printIndent(); 01514 fprintf(pFile, "{\n"); 01515 01516 pWriter->incIndent(4); 01517 } 01518 01519 return true; 01520 #if 0 01521 01522 // pWriter->printIndent(); 01523 // !!! fprintf(pFile, "colorPerVertex %s\n", 01524 // !!! pGeo->getColorPerVertex() ? "TRUE" : "FALSE"); 01525 01526 // pWriter->printIndent(); 01527 // !!! fprintf(pFile, "normalPerVertex %s\n", 01528 // !!! pGeo->getNormalPerVertex() ? "TRUE" : "FALSE"); 01529 #endif 01530 }
| void VRMLWriteAction::writePointSet | ( | NodePtr | pNode, | |
| GeometryPtr | pGeo, | |||
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter | |||
| ) | [static, private] |
Definition at line 1532 of file OSGVRMLWriteAction.cpp.
References decIndent(), FWARNING, isCurrentUse(), printIndent(), setCurrentUse(), and writeGeoCommon().
Referenced by writeGeoEnter().
01536 { 01537 FWARNING(("point set not supported\n")); 01538 01539 if(writeGeoCommon(pNode, pGeo, pFile, pWriter, "PointSet") == true) 01540 { 01541 01542 if(pWriter->isCurrentUse() == false) 01543 { 01544 pWriter->decIndent(4); 01545 01546 pWriter->printIndent(); 01547 fprintf(pFile, "}\n"); 01548 } 01549 01550 pWriter->setCurrentUse(false); 01551 } 01552 }
| void VRMLWriteAction::writeLineSet | ( | NodePtr | pNode, | |
| GeometryPtr | pGeo, | |||
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter, | |||
| bool | bSinglePrimitiveGeo | |||
| ) | [static, private] |
Definition at line 1554 of file OSGVRMLWriteAction.cpp.
References decIndent(), isCurrentUse(), printIndent(), setCurrentUse(), writeColors(), writeGeoCommon(), writeLineIndex(), writeMaterial(), and writePoints().
Referenced by writeGeoEnter().
01559 { 01560 if(writeGeoCommon(pNode, pGeo, pFile, pWriter, "IndexedLineSet") == true) 01561 { 01562 01563 if(pWriter->isCurrentUse() == false) 01564 { 01565 writePoints (pGeo, pFile, pWriter); 01566 writeColors (pGeo, pFile, pWriter); 01567 01568 writeLineIndex(pGeo, pFile, pWriter); 01569 01570 pWriter->decIndent(4); 01571 01572 pWriter->printIndent(); 01573 fprintf(pFile, "}\n"); 01574 01575 writeMaterial(pGeo, pFile, pWriter); 01576 } 01577 01578 pWriter->setCurrentUse(false); 01579 } 01580 }
| void VRMLWriteAction::writeFaceSet | ( | NodePtr | pNode, | |
| GeometryPtr | pGeo, | |||
| FILE * | pFile, | |||
| VRMLWriteAction * | pWriter, | |||
| bool | bSinglePrimitiveGeo | |||
| ) | [static, private] |
Definition at line 1582 of file OSGVRMLWriteAction.cpp.
References decIndent(), isCurrentUse(), printIndent(), setCurrentUse(), writeColors(), writeGeoCommon(), writeIndex(), writeMaterial(), writeNormals(), writePoints(), and writeTexCoords().
Referenced by writeGeoEnter().
01587 { 01588 if(writeGeoCommon(pNode, pGeo, pFile, pWriter, "IndexedFaceSet") == true) 01589 { 01590 if(pWriter->isCurrentUse() == false) 01591 { 01592 pWriter->printIndent(); 01593 fprintf(pFile, "solid FALSE\n"); 01594 01595 writePoints (pGeo, pFile, pWriter); 01596 writeNormals (pGeo, pFile, pWriter); 01597 writeColors (pGeo, pFile, pWriter); 01598 writeTexCoords(pGeo, pFile, pWriter); 01599 01600 writeIndex (pGeo, pFile, pWriter); 01601 01602 pWriter->decIndent(4); 01603 01604 pWriter->printIndent(); 01605 fprintf(pFile, "}\n"); 01606 01607 writeMaterial(pGeo, pFile, pWriter); 01608 } 01609 01610 pWriter->setCurrentUse(false); 01611 } 01612 }
| Action::ResultE VRMLWriteAction::writeGeoEnter | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 1615 of file OSGVRMLWriteAction.cpp.
References addContainerUse(), addNodeUse(), osg::Action::Continue, osg::AttachmentContainerPtr::dcast(), FDEBUG, FINFO, FWARNING, osg::NodePtr::getCore(), getFilePtr(), getMode(), osg::PrimitiveIterator::getType(), incIndent(), osg::NullFC, OSGCollectFC, printIndent(), osg::Action::Quit, updateProgress(), writeFaceSet(), writeLineSet(), and writePointSet().
Referenced by initializeAction().
01617 { 01618 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 01619 01620 NodePtr pNode(pGroup); 01621 GeometryPtr pGeo = GeometryPtr::dcast(pNode->getCore()); 01622 01623 if(pWriter == NULL || pGeo == NullFC) 01624 { 01625 return Action::Quit; 01626 } 01627 01628 FDEBUG(("Write Geo Enter 0x%04x\n", pWriter->getMode())); 01629 01630 if(pWriter->getMode() == VRMLWriteAction::OSGCollectFC) 01631 { 01632 pWriter->addNodeUse(pGroup); 01633 01634 pWriter->addContainerUse(pGeo->getPositions()); 01635 pWriter->addContainerUse(pGeo->getNormals ()); 01636 pWriter->addContainerUse(pGeo->getColors ()); 01637 pWriter->addContainerUse(pGeo->getTexCoords()); 01638 } 01639 else 01640 { 01641 FILE *pFile = pWriter->getFilePtr(); 01642 01643 if(pFile == NULL) 01644 { 01645 return Action::Quit; 01646 } 01647 01648 pWriter->updateProgress(); 01649 01650 pWriter->printIndent(); 01651 fprintf(pFile, "Shape\n"); 01652 pWriter->printIndent(); 01653 fprintf(pFile, "{\n"); 01654 01655 pWriter->incIndent(4); 01656 01657 PrimitiveIterator pIt = pGeo->beginPrimitives(); 01658 PrimitiveIterator pEnd = pGeo->endPrimitives(); 01659 01660 UInt32 uiPointCount = 0; 01661 UInt32 uiLineCount = 0; 01662 UInt32 uiFaceCount = 0; 01663 01664 while(pIt != pEnd) 01665 { 01666 if(pIt.getType() == GL_LINES || 01667 pIt.getType() == GL_LINE_STRIP || 01668 pIt.getType() == GL_LINE_LOOP ) 01669 { 01670 ++uiLineCount; 01671 } 01672 else if(pIt.getType() == GL_POINTS) 01673 { 01674 ++uiPointCount; 01675 } 01676 else 01677 { 01678 ++uiFaceCount; 01679 } 01680 01681 ++pIt; 01682 } 01683 01684 FINFO(( "Geo Stat : %d %d %d\n", 01685 uiPointCount, 01686 uiLineCount, 01687 uiFaceCount)); 01688 01689 if(uiPointCount != 0) 01690 { 01691 if((uiLineCount != 0) || (uiFaceCount != 0)) 01692 { 01693 FWARNING(("ERROR writer does not support mixed primitives" 01694 "including points\n")); 01695 } 01696 else 01697 { 01698 writePointSet(pNode, pGeo, pFile, pWriter); 01699 } 01700 } 01701 01702 if(uiLineCount != 0) 01703 { 01704 writeLineSet(pNode, 01705 pGeo, 01706 pFile, 01707 pWriter, 01708 ((uiPointCount == 0) && (uiFaceCount == 0))); 01709 } 01710 01711 if(uiFaceCount != 0) 01712 { 01713 writeFaceSet(pNode, 01714 pGeo, 01715 pFile, 01716 pWriter, 01717 ((uiPointCount == 0) && (uiLineCount == 0))); 01718 } 01719 } 01720 01721 return Action::Continue; 01722 }
| Action::ResultE VRMLWriteAction::writeGeoLeave | ( | CNodePtr & | pGroup, | |
| Action * | pAction | |||
| ) | [static, private] |
Definition at line 1724 of file OSGVRMLWriteAction.cpp.
References osg::Action::Continue, decIndent(), FDEBUG, getFilePtr(), getMode(), OSGCollectFC, printIndent(), and osg::Action::Quit.
Referenced by initializeAction().
01726 { 01727 VRMLWriteAction *pWriter = dynamic_cast<VRMLWriteAction *>(pAction); 01728 01729 if(pWriter == NULL) 01730 { 01731 return Action::Quit; 01732 } 01733 01734 FDEBUG(("Write Geo Leave 0x%04x\n", pWriter->getMode())); 01735 01736 if(pWriter->getMode() != VRMLWriteAction::OSGCollectFC) 01737 { 01738 FILE *pFile = pWriter->getFilePtr(); 01739 01740 if(pFile == NULL) 01741 { 01742 return Action::Quit; 01743 } 01744 01745 pWriter->decIndent(4); 01746 01747 pWriter->printIndent(); 01748 fprintf(pFile, "}\n"); 01749 } 01750 01751 return Action::Continue; 01752 }
| bool VRMLWriteAction::initializeAction | ( | void | ) | [static, private] |
Definition at line 1793 of file OSGVRMLWriteAction.cpp.
References FINFO, osg::MaterialGroupBase::getClassType(), osg::GeometryBase::getClassType(), osg::TransformBase::getClassType(), osg::ComponentTransformBase::getClassType(), osg::GroupBase::getClassType(), osg::osgTypedFunctionFunctor2CPtrRef(), registerEnterDefault(), registerLeaveDefault(), writeComponentTransformEnter(), writeComponentTransformLeave(), writeGeoEnter(), writeGeoLeave(), writeGroupEnter(), writeGroupLeave(), writeMatGroupEnter(), writeMatGroupLeave(), writeTransformEnter(), and writeTransformLeave().
Referenced by osg::VRMLWriteAction::ActionInitializer::ActionInitializer().
01794 { 01795 FINFO(( "Init VRMLWriter\n" )); 01796 01797 VRMLWriteAction::registerEnterDefault( 01798 Group::getClassType(), 01799 osgTypedFunctionFunctor2CPtrRef< 01800 Action::ResultE, 01801 CNodePtr , 01802 Action *>(VRMLWriteAction::writeGroupEnter)); 01803 01804 VRMLWriteAction::registerEnterDefault( 01805 ComponentTransform::getClassType(), 01806 osgTypedFunctionFunctor2CPtrRef< 01807 Action::ResultE, 01808 CNodePtr , 01809 Action *>(VRMLWriteAction::writeComponentTransformEnter)); 01810 01811 VRMLWriteAction::registerEnterDefault( 01812 Transform::getClassType(), 01813 osgTypedFunctionFunctor2CPtrRef< 01814 Action::ResultE, 01815 CNodePtr , 01816 Action *>(VRMLWriteAction::writeTransformEnter)); 01817 01818 VRMLWriteAction::registerEnterDefault( 01819 Geometry::getClassType(), 01820 osgTypedFunctionFunctor2CPtrRef< 01821 Action::ResultE, 01822 CNodePtr , 01823 Action *>(VRMLWriteAction::writeGeoEnter)); 01824 01825 VRMLWriteAction::registerEnterDefault( 01826 MaterialGroup::getClassType(), 01827 osgTypedFunctionFunctor2CPtrRef< 01828 Action::ResultE, 01829 CNodePtr , 01830 Action *>(VRMLWriteAction::writeMatGroupEnter)); 01831 01832 01833 01834 VRMLWriteAction::registerLeaveDefault( 01835 Group::getClassType(), 01836 osgTypedFunctionFunctor2CPtrRef< 01837 Action::ResultE, 01838 CNodePtr , 01839 Action *>(&VRMLWriteAction::writeGroupLeave)); 01840 01841 VRMLWriteAction::registerLeaveDefault( 01842 ComponentTransform::getClassType(), 01843 osgTypedFunctionFunctor2CPtrRef< 01844 Action::ResultE, 01845 CNodePtr , 01846 Action *>(&VRMLWriteAction::writeComponentTransformLeave)); 01847 01848 VRMLWriteAction::registerLeaveDefault( 01849 Transform::getClassType(), 01850 osgTypedFunctionFunctor2CPtrRef< 01851 Action::ResultE, 01852 CNodePtr , 01853 Action *>(&VRMLWriteAction::writeTransformLeave)); 01854 01855 VRMLWriteAction::registerLeaveDefault( 01856 Geometry::getClassType(), 01857 osgTypedFunctionFunctor2CPtrRef< 01858 Action::ResultE, 01859 CNodePtr , 01860 Action *>(&VRMLWriteAction::writeGeoLeave)); 01861 01862 VRMLWriteAction::registerLeaveDefault( 01863 MaterialGroup::getClassType(), 01864 osgTypedFunctionFunctor2CPtrRef< 01865 Action::ResultE, 01866 CNodePtr , 01867 Action *>(&VRMLWriteAction::writeMatGroupLeave)); 01868 01869 return true; 01870 }
| bool VRMLWriteAction::terminateAction | ( | void | ) | [static, private] |
Definition at line 1872 of file OSGVRMLWriteAction.cpp.
References FINFO.
Referenced by osg::VRMLWriteAction::ActionInitializer::ActionInitializer().
01873 { 01874 FINFO(( "Terminate VRMLWriter\n" )); 01875 01876 return true; 01877 }
| VRMLWriteAction& osg::VRMLWriteAction::operator= | ( | const VRMLWriteAction & | source | ) | [private] |
| void VRMLWriteAction::incIndent | ( | UInt32 | uiDelta | ) | [private] |
Definition at line 1880 of file OSGVRMLWriteAction.cpp.
References _uiIndent, _uiOptions, and OSGNoIndent.
Referenced by writeColors(), writeComponentTransformEnter(), writeGeoCommon(), writeGeoEnter(), writeGroupEnter(), writeIndex(), writeLineIndex(), writeMaterial(), writeNormals(), writePoints(), writeTexCoords(), and writeTransformEnter().
01881 { 01882 if(0 == (_uiOptions & OSGNoIndent)) 01883 { 01884 _uiIndent += uiDelta; 01885 } 01886 }
| void VRMLWriteAction::decIndent | ( | UInt32 | uiDelta | ) | [private] |
Definition at line 1888 of file OSGVRMLWriteAction.cpp.
References _uiIndent, _uiOptions, and OSGNoIndent.
Referenced by writeColors(), writeComponentTransformLeave(), writeFaceSet(), writeGeoLeave(), writeGroupLeave(), writeIndex(), writeLineIndex(), writeLineSet(), writeMaterial(), writeNormals(), writePoints(), writePointSet(), writeTexCoords(), and writeTransformLeave().
01889 { 01890 if(0 == (_uiOptions & OSGNoIndent)) 01891 { 01892 _uiIndent -= uiDelta; 01893 } 01894 }
| void VRMLWriteAction::printIndent | ( | void | ) | [private] |
Definition at line 1896 of file OSGVRMLWriteAction.cpp.
References _pFile, and _uiIndent.
Referenced by writeColors(), writeComponentTransformEnter(), writeComponentTransformLeave(), writeFaceSet(), writeGeoCommon(), writeGeoEnter(), writeGeoLeave(), writeGroupEnter(), writeGroupLeave(), writeIndex(), writeLineIndex(), writeLineSet(), writeMaterial(), writeNormals(), writePoints(), writePointSet(), writeTexCoords(), writeTransformEnter(), and writeTransformLeave().
01897 { 01898 if(_pFile != NULL) 01899 { 01900 for(UInt32 i = 0; i < _uiIndent/8; i++) 01901 { 01902 fprintf(_pFile, "\t"); 01903 } 01904 for(UInt32 i = 0; i < _uiIndent%8; i++) 01905 { 01906 fprintf(_pFile, " "); 01907 } 01908 } 01909 }
| void VRMLWriteAction::setCurrentUse | ( | bool | bVal | ) | [private] |
Definition at line 1911 of file OSGVRMLWriteAction.cpp.
References _currentUse.
Referenced by writeFaceSet(), writeGeoCommon(), writeGroupLeave(), writeLineSet(), and writePointSet().
01912 { 01913 _currentUse = bVal; 01914 }
| bool VRMLWriteAction::isCurrentUse | ( | void | ) | [private] |
Definition at line 1916 of file OSGVRMLWriteAction.cpp.
References _currentUse.
Referenced by writeFaceSet(), writeGroupLeave(), writeLineSet(), and writePointSet().
01917 { 01918 return _currentUse; 01919 }
| void VRMLWriteAction::addNodeUse | ( | CNodePtr & | pNode | ) | [private] |
Definition at line 1921 of file OSGVRMLWriteAction.cpp.
References _nodeCount, _vFCInfos, osg::VRMLWriteAction::FCInfo::buildName(), osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::SimpleAttachment< AttachmentDescT >::getClassType(), osg::NodePtr::getCore(), osg::FieldContainerPtrBase::getFieldContainerId(), osg::FieldContainerType::getGroupId(), osg::VRMLWriteAction::FCInfo::getUse(), osg::VRMLWriteAction::FCInfo::incUse(), osg::NullFC, and osg::VRMLWriteAction::FCInfo::setName().
Referenced by writeComponentTransformEnter(), writeGeoEnter(), writeGroupEnter(), and writeTransformEnter().
01922 { 01923 if(pCNode == NullFC) 01924 return; 01925 01926 NodePtr pNode(pCNode); 01927 NodeCorePtr pCore = pNode->getCore(); 01928 01929 if((pNode.getFieldContainerId() >= _vFCInfos.size()) || 01930 (pCore.getFieldContainerId() >= _vFCInfos.size())) 01931 { 01932 return; 01933 } 01934 01935 FCInfo *pInfoNode = &(_vFCInfos[pNode.getFieldContainerId()]); 01936 FCInfo *pInfoCore = &(_vFCInfos[pCore.getFieldContainerId()]); 01937 01938 NamePtr pNodename = 01939 NamePtr::dcast(pNode->findAttachment( 01940 Name::getClassType().getGroupId())); 01941 01942 NamePtr pCorename = 01943 NamePtr::dcast(pCore->findAttachment( 01944 Name::getClassType().getGroupId())); 01945 01946 pInfoNode->incUse(); 01947 pInfoCore->incUse(); 01948 01949 if(pNodename != NullFC) 01950 { 01951 pInfoNode->setName(pNodename->getFieldPtr()->getValue().c_str()); 01952 } 01953 01954 if(pCorename != NullFC) 01955 { 01956 pInfoCore->setName(pCorename->getFieldPtr()->getValue().c_str()); 01957 } 01958 01959 if(pInfoCore->getUse() > 1) 01960 { 01961 if(pCorename != NullFC) 01962 { 01963 pInfoCore->buildName(pCore->getTypeName(), 01964 pCore. getFieldContainerId()); 01965 } 01966 } 01967 01968 ++_nodeCount; 01969 }
| void VRMLWriteAction::addContainerUse | ( | FieldContainerPtr & | pContainer | ) | [private] |
Definition at line 1971 of file OSGVRMLWriteAction.cpp.
References _vFCInfos, osg::VRMLWriteAction::FCInfo::buildName(), osg::FieldContainerPtrBase::getFieldContainerId(), osg::VRMLWriteAction::FCInfo::getUse(), osg::VRMLWriteAction::FCInfo::incUse(), and osg::NullFC.
Referenced by writeGeoEnter().
01972 { 01973 if(pContainer == NullFC) 01974 return; 01975 01976 if(pContainer.getFieldContainerId() >= _vFCInfos.size()) 01977 { 01978 return; 01979 } 01980 01981 FCInfo *pInfo = &(_vFCInfos[pContainer.getFieldContainerId()]); 01982 01983 pInfo->incUse(); 01984 01985 if(pInfo->getUse() > 1) 01986 { 01987 pInfo->buildName(pContainer->getTypeName(), 01988 pContainer. getFieldContainerId()); 01989 } 01990 }
| VRMLWriteAction::FCInfo * VRMLWriteAction::getInfo | ( | FieldContainerPtr & | pContainer | ) | [private] |
Definition at line 1992 of file OSGVRMLWriteAction.cpp.
References _vFCInfos, osg::FieldContainerPtrBase::getFieldContainerId(), and osg::NullFC.
Referenced by writeComponentTransformEnter(), writeGeoCommon(), writeGroupEnter(), and writeTransformEnter().
01994 { 01995 if(pContainer == NullFC) 01996 return NULL; 01997 01998 if(pContainer.getFieldContainerId() >= _vFCInfos.size()) 01999 return NULL; 02000 02001 return &(_vFCInfos[pContainer.getFieldContainerId()]); 02002 }
| void VRMLWriteAction::updateProgress | ( | void | ) | [private] |
Definition at line 2004 of file OSGVRMLWriteAction.cpp.
References _currentNodeCount, _nodeCount, osg::SceneFileHandler::the(), and osg::SceneFileHandler::updateWriteProgress().
Referenced by writeComponentTransformEnter(), writeGeoEnter(), writeGroupEnter(), and writeTransformEnter().
02005 { 02006 if(_nodeCount > 0) 02007 SceneFileHandler::the().updateWriteProgress((_currentNodeCount++ * 100) / _nodeCount); 02008 }
| bool osg::VRMLWriteAction::isWritten | ( | FieldContainerPtr & | fc | ) | [inline, private] |
Definition at line 123 of file OSGVRMLWriteAction.inl.
References _writtenFCs.
Referenced by writeMaterial().
00124 { 00125 return std::find(_writtenFCs.begin(), _writtenFCs.end(), fc) != 00126 _writtenFCs.end(); 00127 }
| UInt32 osg::VRMLWriteAction::getIndex | ( | FieldContainerPtr & | fc | ) | [inline, private] |
Definition at line 130 of file OSGVRMLWriteAction.inl.
References _writtenFCs.
Referenced by writeMaterial().
00131 { 00132 std::vector<FieldContainerPtr>::iterator it; 00133 00134 it = std::find(_writtenFCs.begin(), _writtenFCs.end(), fc); 00135 00136 return it - _writtenFCs.begin(); 00137 }
| UInt32 osg::VRMLWriteAction::setWritten | ( | FieldContainerPtr & | fc | ) | [inline, private] |
Definition at line 140 of file OSGVRMLWriteAction.inl.
References _writtenFCs.
Referenced by writeMaterial().
00141 { 00142 _writtenFCs.push_back(fc); 00143 00144 return _writtenFCs.size() - 1; 00145 }
| void Action::setPrototype | ( | Action * | proto | ) | [static, inherited] |
Definition at line 119 of file OSGAction.cpp.
References osg::Action::_prototype.
00120 { 00121 _prototype = proto; 00122 }
| void Action::registerEnterDefault | ( | const FieldContainerType & | type, | |
| const Functor & | func | |||
| ) | [static, inherited] |
Reimplemented in osg::DrawAction, osg::IntersectAction, and osg::RenderAction.
Definition at line 83 of file OSGAction.cpp.
References osg::Action::_defaultEnterFunction(), osg::Action::_defaultEnterFunctors, osg::TypeBase::getId(), and osg::osgTypedFunctionFunctor2CPtrRef().
00085 { 00086 if ( ! _defaultEnterFunctors ) 00087 _defaultEnterFunctors = new std::vector<Action::Functor>; 00088 00089 while(type.getId() >= _defaultEnterFunctors->size()) 00090 { 00091 _defaultEnterFunctors->push_back( 00092 osgTypedFunctionFunctor2CPtrRef< 00093 ResultE, 00094 CNodePtr, 00095 Action * >(&Action::_defaultEnterFunction)); 00096 } 00097 00098 (*_defaultEnterFunctors)[ type.getId() ] = func; 00099 }
| void Action::registerLeaveDefault | ( | const FieldContainerType & | type, | |
| const Functor & | func | |||
| ) | [static, inherited] |
Reimplemented in osg::DrawAction, osg::IntersectAction, and osg::RenderAction.
Definition at line 101 of file OSGAction.cpp.
References osg::Action::_defaultLeaveFunction(), osg::Action::_defaultLeaveFunctors, osg::TypeBase::getId(), and osg::osgTypedFunctionFunctor2CPtrRef().
00103 { 00104 if ( ! _defaultLeaveFunctors ) 00105 _defaultLeaveFunctors = new std::vector<Action::Functor>; 00106 00107 while(type.getId() >= _defaultLeaveFunctors->size()) 00108 { 00109 _defaultLeaveFunctors->push_back( 00110 osgTypedFunctionFunctor2CPtrRef< 00111 ResultE, 00112 CNodePtr, 00113 Action * >(&Action::_defaultLeaveFunction)); 00114 } 00115 00116 (*_defaultLeaveFunctors)[ type.getId() ] = func; 00117 }
| void Action::registerEnterFunction | ( | const FieldContainerType & | type, | |
| const Functor & | func | |||
| ) | [inherited] |
Definition at line 201 of file OSGAction.cpp.
References osg::Action::_defaultEnterFunction(), osg::Action::_enterFunctors, osg::TypeBase::getId(), and osg::osgTypedFunctionFunctor2CPtrRef().
00203 { 00204 while ( type.getId() >= _enterFunctors.size() ) 00205 { 00206 _enterFunctors.push_back( 00207 osgTypedFunctionFunctor2CPtrRef< 00208 ResultE, 00209 CNodePtr, 00210 Action * >(&Action::_defaultEnterFunction)); 00211 } 00212 00213 _enterFunctors[ type.getId() ] = func; 00214 }
| void Action::registerLeaveFunction | ( | const FieldContainerType & | type, | |
| const Functor & | func | |||
| ) | [inherited] |
Definition at line 216 of file OSGAction.cpp.
References osg::Action::_defaultLeaveFunction(), osg::Action::_leaveFunctors, osg::TypeBase::getId(), and osg::osgTypedFunctionFunctor2CPtrRef().
00218 { 00219 while ( type.getId() >= _leaveFunctors.size() ) 00220 { 00221 _leaveFunctors.push_back( 00222 osgTypedFunctionFunctor2CPtrRef< 00223 ResultE, 00224 CNodePtr, 00225 Action * >(&Action::_defaultLeaveFunction)); 00226 } 00227 00228 _leaveFunctors[ type.getId() ] = func; 00229 }
| NodePtr osg::Action::getActNode | ( | void | ) | [inline, inherited] |
Definition at line 55 of file OSGAction.inl.
References osg::Action::_actNode.
Referenced by osg::ClipPlaneChunk::activate(), osg::ClipPlaneChunk::changeFrom(), osg::ProxyGroup::draw(), osg::DVRVolume::draw(), osg::DistanceLOD::draw(), osg::ScreenGroup::drawEnter(), osg::MaterialGroup::drawEnter(), osg::Light::drawEnter(), osg::InverseTransform::drawEnter(), osg::Billboard::drawEnter(), osg::MaterialGroup::drawLeave(), osg::Slices::drawPrimitives(), osg::Particles::drawPrimitives(), osg::RenderAction::dropFunctor(), osg::RenderAction::dropGeometry(), osg::DVRIsoShader::getCoveredScreenRect(), osg::Slicer::getSlicingDirection(), osg::Group::intersect(), osg::Geometry::intersect(), osg::DVRVolume::intersect(), osg::RenderAction::pushVisibility(), osg::MaterialGroup::renderEnter(), osg::MaterialGroup::renderLeave(), and osg::Slicer::rotateToLocal().
00056 { 00057 return _actNode; 00058 }
| UInt32 osg::Action::getNNodes | ( | void | ) | const [inline, inherited] |
Definition at line 92 of file OSGAction.inl.
References osg::Action::_actList, and osg::Action::_actNode.
Referenced by osg::Switch::draw(), osg::DistanceLOD::draw(), osg::Switch::intersect(), and osg::DrawActionBase::selectVisibles().
00093 { 00094 if ( ! _actList ) 00095 { 00096 return _actNode->getNChildren(); 00097 } 00098 else 00099 { 00100 return (*_actList).size(); 00101 } 00102 }
| const NodePtr osg::Action::getNode | ( | int | index | ) | [inline, inherited] |
Definition at line 67 of file OSGAction.inl.
References osg::Action::_actList, and osg::Action::_actNode.
Referenced by osg::Switch::draw(), osg::DistanceLOD::draw(), osg::Switch::intersect(), and osg::DrawActionBase::selectVisibles().
00068 { 00069 if ( ! _actList ) 00070 { 00071 return _actNode->getChild( index ); 00072 } 00073 else 00074 { 00075 return (*_actList)[ index ]; 00076 } 00077 }
| void osg::Action::addNode | ( | NodePtr | node | ) | [inline, inherited] |
Definition at line 80 of file OSGAction.inl.
References osg::Action::_newList.
Referenced by osg::Switch::draw(), osg::ProxyGroup::draw(), osg::DistanceLOD::draw(), osg::Switch::intersect(), and osg::DrawActionBase::selectVisibles().
00081 { 00082 _newList.push_back( node ); 00083 }
| void osg::Action::useNodeList | ( | void | ) | [inline, inherited] |
Definition at line 86 of file OSGAction.inl.
References osg::Action::_useNewList.
Referenced by osg::Switch::draw(), osg::ProxyGroup::draw(), osg::DistanceLOD::draw(), osg::RenderAction::pushVisibility(), and osg::DrawActionBase::selectVisibles().
00087 { 00088 _useNewList = true; 00089 }
| UInt32 osg::Action::getTravMask | ( | void | ) | const [inline, inherited] |
Definition at line 106 of file OSGAction.inl.
References osg::Action::_travMask.
Referenced by osg::Action::recurse().
00107 { 00108 return _travMask; 00109 }
| void osg::Action::setTravMask | ( | UInt32 | val | ) | [inline, inherited] |
Definition at line 112 of file OSGAction.inl.
References osg::Action::_travMask.
Referenced by osg::Viewport::draw(), osg::Viewport::render(), and osg::FBOViewport::render().
00113 { 00114 _travMask = val; 00115 }
| bool Action::operator< | ( | const Action & | other | ) | [inherited] |
| bool Action::operator== | ( | const Action & | other | ) | [inherited] |
| bool Action::operator!= | ( | const Action & | other | ) | [inherited] |
| Action::ResultE osg::Action::callEnter | ( | NodePtr | node | ) | [inline, protected, inherited] |
Definition at line 124 of file OSGAction.inl.
References osg::Action::_defaultEnterFunction(), osg::Action::_enterFunctors, osg::NodePtr::getCore(), osg::Action::getDefaultEnterFunctors(), osg::TypeBase::getId(), and osg::NodeCore::getType().
Referenced by osg::Action::recurse().
00125 { 00126 ResultE result; 00127 00128 UInt32 uiFunctorIndex = node->getCore()->getType().getId(); 00129 CNodePtr cnode(node); 00130 00131 if ( uiFunctorIndex < _enterFunctors.size() ) 00132 result = _enterFunctors[uiFunctorIndex].call(cnode,this); 00133 else if ( getDefaultEnterFunctors() && 00134 uiFunctorIndex < getDefaultEnterFunctors()->size() ) 00135 { 00136 // field container registered method after this action was instantiated 00137 // copy the new functors from default vector 00138 std::vector<Functor> *defaultEnter = getDefaultEnterFunctors(); 00139 00140 while ( defaultEnter->size() > _enterFunctors.size() ) 00141 { 00142 _enterFunctors.push_back( (*defaultEnter)[_enterFunctors.size()] ); 00143 } 00144 result = _enterFunctors[uiFunctorIndex].call(cnode,this); 00145 } 00146 else // unknown field container 00147 result = _defaultEnterFunction(cnode,this); 00148 00149 return result; 00150 }
| Action::ResultE osg::Action::callLeave | ( | NodePtr | node | ) | [inline, protected, inherited] |
Definition at line 153 of file OSGAction.inl.
References osg::Action::_defaultLeaveFunction(), osg::Action::_leaveFunctors, osg::NodePtr::getCore(), osg::Action::getDefaultLeaveFunctors(), osg::TypeBase::getId(), and osg::NodeCore::getType().
Referenced by osg::Action::recurse().
00154 { 00155 ResultE result; 00156 00157 UInt32 uiFunctorIndex = node->getCore()->getType().getId(); 00158 CNodePtr cnode(node); 00159 00160 if ( uiFunctorIndex < _leaveFunctors.size() ) 00161 result = _leaveFunctors[uiFunctorIndex].call(cnode,this); 00162 else if ( getDefaultLeaveFunctors() && 00163 uiFunctorIndex < getDefaultLeaveFunctors()->size() ) 00164 { 00165 // field container registered method after this action was instantiated 00166 // copy the new functors from default vector 00167 std::vector<Functor> *defaultLeave = getDefaultLeaveFunctors(); 00168 00169 while ( defaultLeave->size() > _leaveFunctors.size() ) 00170 { 00171 _leaveFunctors.push_back( (*defaultLeave)[_leaveFunctors.size()] ); 00172 } 00173 result = _leaveFunctors[uiFunctorIndex].call(cnode,this); 00174 } 00175 else // unknown field container 00176 result = _defaultLeaveFunction(cnode,this); 00177 00178 return result; 00179 }
| Action::ResultE Action::start | ( | void | ) | [protected, virtual, inherited] |
Reimplemented in osg::DrawActionBase, osg::DrawAction, osg::IntersectAction, and osg::RenderAction.
Definition at line 423 of file OSGAction.cpp.
References osg::Action::Continue.
Referenced by osg::Action::callStart().
00424 { 00425 return Continue; 00426 }
| Action::ResultE Action::stop | ( | ResultE | res | ) | [protected, virtual, inherited] |
Reimplemented in osg::DrawActionBase, and osg::RenderAction.
Definition at line 428 of file OSGAction.cpp.
Referenced by osg::Action::callStop().
| Action::ResultE Action::recurse | ( | NodePtr | node | ) | [protected, inherited] |
Definition at line 288 of file OSGAction.cpp.
References osg::Action::_actList, osg::Action::_actNode, osg::Action::_newList, osg::Action::_useNewList, osg::Action::callEnter(), osg::Action::callLeave(), osg::Action::callNewList(), osg::Action::Continue, osg::NodePtr::getCore(), osg::Action::getTravMask(), osg::NullFC, osg::Action::Quit, osg::Action::Skip, and SWARNING.
Referenced by osg::Action::apply(), and osg::Action::callNewList().
00289 { 00290 if ( node == NullFC ) 00291 return Continue; 00292 00293 if((node->getTravMask() & getTravMask()) == 0) 00294 return Continue; 00295 00296 if(node->getOcclusionMask() & 1) 00297 return Continue; 00298 00299 NodeCorePtr core = node->getCore(); 00300 00301 if ( core == NullFC ) 00302 { 00303 SWARNING << "recurse: core is Null, don't know what to do!" 00304 << std::endl; 00305 return Quit; 00306 } 00307 00308 Action::ResultE result; 00309 00310 _actList = NULL; 00311 _actNode = node; 00312 _newList.clear(); 00313 _useNewList = false; 00314 00315 result = callEnter( node ); 00316 00317 if ( result != Continue ) 00318 { 00319 if ( result == Skip ) 00320 return Continue; 00321 00322 return result; 00323 } 00324 00325 if ( ! _newList.empty() ) 00326 { 00327 result = callNewList(); 00328 } 00329 else if ( ! _useNewList ) // new list is empty, but not used? 00330 { 00331 std::vector<NodePtr>::iterator it; 00332 00333 for ( it = node->getMFChildren()->begin(); it != node->getMFChildren()->end(); it ++ ) 00334 { 00335 result = recurse( *it ); 00336 00337 if ( result != Continue ) 00338 break; 00339 } 00340 } 00341 00342 _actNode = node; 00343 if ( result == Continue ) 00344 result = callLeave( node ); 00345 else 00346 callLeave( node ); 00347 00348 if ( result == Skip ) 00349 return Continue; 00350 00351 return result; 00352 }
| Action::ResultE Action::callNewList | ( | void | ) | [protected, inherited] |
Definition at line 355 of file OSGAction.cpp.
References osg::Action::_actList, osg::Action::_newList, osg::Action::Continue, and osg::Action::recurse().
Referenced by osg::Action::callStart(), osg::Action::callStop(), and osg::Action::recurse().
00356 { 00357 Action::ResultE result = Continue; 00358 00359 // need to make a copy, because the one in the action is cleared 00360 00361 std::vector<NodePtr> nodeList; 00362 nodeList.swap(_newList); 00363 00364 std::vector<NodePtr>::iterator it; 00365 00366 _actList = &nodeList; 00367 00368 for(it = nodeList.begin(); it != nodeList.end(); ++it) 00369 { 00370 result = recurse(*it); 00371 00372 if(result != Continue) 00373 break; 00374 } 00375 00376 return result; 00377 }
| Action::ResultE Action::_defaultEnterFunction | ( | CNodePtr & | node, | |
| Action * | action | |||
| ) | [static, protected, inherited] |
Definition at line 501 of file OSGAction.cpp.
References osg::Action::Continue.
Referenced by osg::Action::callEnter(), osg::RenderAction::registerEnterDefault(), osg::IntersectAction::registerEnterDefault(), osg::DrawAction::registerEnterDefault(), osg::Action::registerEnterDefault(), and osg::Action::registerEnterFunction().
00503 { 00504 return Continue; 00505 }
| Action::ResultE Action::_defaultLeaveFunction | ( | CNodePtr & | node, | |
| Action * | action | |||
| ) | [static, protected, inherited] |
Definition at line 507 of file OSGAction.cpp.
References osg::Action::Continue.
Referenced by osg::Action::callLeave(), osg::RenderAction::registerLeaveDefault(), osg::IntersectAction::registerLeaveDefault(), osg::DrawAction::registerLeaveDefault(), osg::Action::registerLeaveDefault(), and osg::Action::registerLeaveFunction().
00509 { 00510 return Continue; 00511 }
| void osg::Action::setActNode | ( | NodePtr | node | ) | [inline, protected, inherited] |
Definition at line 61 of file OSGAction.inl.
References osg::Action::_actNode.
Referenced by osg::RenderAction::draw().
00062 { 00063 _actNode = node; 00064 }
friend struct ActionInitializer [friend] |
Definition at line 258 of file OSGVRMLWriteAction.h.
char VRMLWriteAction::cvsid = "@(#)$Id: $" [static, private] |
VRMLWriteAction * VRMLWriteAction::_prototype = NULL [static, private] |
Reimplemented from osg::Action.
Definition at line 271 of file OSGVRMLWriteAction.h.
Referenced by create(), getPrototype(), and setPrototype().
std::vector< Action::Functor > * VRMLWriteAction::_defaultEnterFunctors [static, private] |
Reimplemented from osg::Action.
Definition at line 274 of file OSGVRMLWriteAction.h.
Referenced by getDefaultEnterFunctors(), and VRMLWriteAction().
std::vector< Action::Functor > * VRMLWriteAction::_defaultLeaveFunctors [static, private] |
Reimplemented from osg::Action.
Definition at line 275 of file OSGVRMLWriteAction.h.
Referenced by getDefaultLeaveFunctors(), and VRMLWriteAction().
VRMLWriteAction::ActionInitializer VRMLWriteAction::_actionInitializer [static, private] |
Definition at line 277 of file OSGVRMLWriteAction.h.
MaterialPtr osg::VRMLWriteAction::_material [private] |
Definition at line 364 of file OSGVRMLWriteAction.h.
Referenced by getMaterial(), and setMaterial().
UInt32 osg::VRMLWriteAction::_uiIndent [private] |
Definition at line 366 of file OSGVRMLWriteAction.h.
Referenced by decIndent(), incIndent(), and printIndent().
FILE* osg::VRMLWriteAction::_pFile [private] |
Definition at line 367 of file OSGVRMLWriteAction.h.
Referenced by close(), getFilePtr(), open(), and printIndent().
bool osg::VRMLWriteAction::_currentUse [private] |
Definition at line 370 of file OSGVRMLWriteAction.h.
Referenced by isCurrentUse(), and setCurrentUse().
UInt32 osg::VRMLWriteAction::_uiOptions [private] |
Definition at line 371 of file OSGVRMLWriteAction.h.
Referenced by addOptions(), decIndent(), getOptions(), incIndent(), and subOptions().
std::vector<FCInfo> osg::VRMLWriteAction::_vFCInfos [private] |
Definition at line 373 of file OSGVRMLWriteAction.h.
Referenced by addContainerUse(), addNodeUse(), getInfo(), and write().
std::vector<FieldContainerPtr> osg::VRMLWriteAction::_writtenFCs [private] |
Definition at line 378 of file OSGVRMLWriteAction.h.
Referenced by getIndex(), isWritten(), setWritten(), and write().
UInt32 osg::VRMLWriteAction::_nodeCount [private] |
Definition at line 380 of file OSGVRMLWriteAction.h.
Referenced by addNodeUse(), updateProgress(), and write().
std::vector<Functor> osg::Action::_enterFunctors [protected, inherited] |
Definition at line 257 of file OSGAction.h.
Referenced by osg::Action::Action(), osg::Action::callEnter(), osg::DrawAction::DrawAction(), osg::IntersectAction::IntersectAction(), osg::Action::registerEnterFunction(), osg::RenderAction::RenderAction(), and VRMLWriteAction().
std::vector<Functor> osg::Action::_leaveFunctors [protected, inherited] |
Definition at line 258 of file OSGAction.h.
Referenced by osg::Action::Action(), osg::Action::callLeave(), osg::DrawAction::DrawAction(), osg::IntersectAction::IntersectAction(), osg::Action::registerLeaveFunction(), osg::RenderAction::RenderAction(), and VRMLWriteAction().
1.5.5