VR-Forces 4.0.4 Class Documentation
include/vrvOsg/DtArticulatedModelParser.h
Go to the documentation of this file.
00001 /****************************************************************************** 
00002 ** Copyright (c) 2007 MAK Technologies, Inc. 
00003 ** All rights reserved. 
00004 ******************************************************************************/ 
00005 /****************************************************************************** 
00006 ** $RCSfile: DtArticulatedModelParser.h,v $ $Revision: 1.11 $ $State: Exp $ 
00007 ******************************************************************************/ 
00008  
00012  
00013 #pragma once
00014 #include <vrvOsg/vrvOsg.h>
00015 #include <vrvOsg/DtModelParser.h>
00016 #include <vrvCore/DtModelSemanticsMapper.h>
00017 #include <osgSim/MultiSwitch>
00018 #include <stack>
00019 
00020 namespace osg
00021 {
00022    class Group;
00023    class Sequence;
00024 }
00025 
00026 namespace osgSim
00027 {
00028    class DOFTransform;
00029 }
00030 
00031 namespace makVrv 
00032 { 
00033    class DtOsgArticulatedModel;
00034 
00037    class DT_DLL_VRVOSG DtArticulatedModelParser : public DtModelParser
00038    { 
00039    public:
00040 
00042       DtArticulatedModelParser(DtModel& model);
00043 
00045       virtual ~DtArticulatedModelParser();
00046 
00049       static std::string parserFormat();
00050 
00052 
00053 
00054       virtual void apply(osg::Group& group);
00055       virtual void apply(osg::Sequence& sequence);
00056       virtual void apply(osgSim::MultiSwitch& multiswitch);
00057       virtual void apply(osgSim::DOFTransform& transform);
00058       virtual void apply(osg::Transform& transform);
00060 
00061    protected:
00062 
00067       virtual bool parseSwitchDeclaration( const std::string& desc, 
00068          osgSim::MultiSwitch& multiswitch );
00069 
00072       const DtModelSemanticsMapper::States::Id* createCustomStateId( 
00073          const std::string& stateName, DtModelSemanticsMapper& mapper);
00074 
00079       virtual bool parseStateDeclaration( const std::string& desc, 
00080          osg::Group& group );
00081 
00086       virtual bool parsePartDeclaration(const std::string& desc,
00087          osgSim::DOFTransform& transform);
00088 
00093       virtual bool parseAnimationDeclaration(const std::string& desc,
00094          osg::Sequence& sequence);
00095 
00097       std::vector<int> parseValueList(const std::string& valueList);
00098      
00101       void pushStateId(int idNumber, osgSim::MultiSwitch*  lastStateId);
00102 
00105       void popStateId();
00106 
00108       osgSim::MultiSwitch* lastStateId() const;
00109 
00111       int lastStateIdNumber() const;
00112 
00113    protected:
00114            
00115       std::string mySwitchTag;
00116       std::string myStateTag;
00117       std::string myPartTag;
00118       std::string myAnimationTag;
00119       std::string mySkipTag;
00120       std::string myNoSkipTag;
00121 
00122       DtOsgArticulatedModel* myArticulatedModelCast;
00123       std::stack<osg::ref_ptr<osgSim::MultiSwitch> > myStateIds;
00124       std::stack<int> myStateIdNumbers;
00125    }; 
00126 
00129    class DT_DLL_VRVOSG DtArticulatedModelParserCreator : public PrModelParserCreator
00130    {
00131    public:
00132 
00135       static void registerCreator(DtDe& de);
00136       
00138       DtArticulatedModelParserCreator();
00139 
00141       virtual ~DtArticulatedModelParserCreator();
00142 
00144       virtual DtModelParser* create(DtModel& model);
00145    };
00146   
00147 } 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)