📄 scenecomponents.h
字号:
TJointList & joints ); bool parseCylinderNode ( string str, TSceneNode * parrent, TNodeList & nodes, TJointList & joints ); bool parseBoxNode ( string & str, TSceneNode * parrent, TNodeList & nodes, TJointList & joints ); bool parseTransformNode ( string str, TSceneNode * parrent, TNodeList & nodes, TJointList & joints ); /// Methods that deal with saving the node void saveInformation ( ostream & os, string strGap ) const; public: TSceneNode ( ); ~ TSceneNode ( ); virtual bool update ( ); virtual bool render ( ); virtual bool setPosition ( const VecPosition & pos ); unsigned getID ( ) const; void resize ( ); void rePosition ( TSceneNode * caller_node = NULL ); string getName ( ) const; void setName ( string name ); string getNodeName ( ) const; void setNodeName ( string name ); TShape getShape ( ) const; void setShape ( TShape shape ); double getLength ( ) const; void setLength ( double length ); double getWidth ( ) const; void setWidth ( double width ); double getHeight ( ) const; void setHeight ( double height ); double getRadius ( ) const; void setRadius ( double radius ); double getMass ( ) const; void setMass ( double mass ); TMaterial getMaterial ( ) const; void setMaterial ( TMaterial material ); bool isSaved ( ) const; void setNotSaved ( ); void addJoint ( TSceneJoint * joint ); bool removeJoint ( TSceneJoint * joint ); bool initialized ( ) const; static VecPosition parsePositions ( string & str, unsigned & index ); bool parseAndLoad ( string str, TSceneNode * parrent, TNodeList & nodes, TJointList & joints ); void queryNodes ( TNodeList & nodes ); void queryJoints ( TJointList & joints ); TSceneNode * getParrent ( ) const; void setParrent ( TSceneNode * parrent ); void addChild ( TSceneNode * child ); void clearChildren ( TNodeList & nodes ); void removeChild ( TNodeList & list, TSceneNode * child ); void eraseChild ( TSceneNode * child ); void saveToStream ( ostream & os, string strGap ) const; friend ostream & operator << ( ostream &os, const TSceneNode & data ); friend ostream & operator << ( ostream &os, const TSceneNode * data ); ostream & show ( ostream & os = cout ) const;};/*******************************************************************************//******************************** TSceneJoint ********************************//*******************************************************************************//*! TJoint is a representation of a joint of a robot */class TSceneJoint : public TOpenGLSphere{ protected: TJoint m_Joint; /*!< This is the type of the joint*/ VecPosition m_Axis[2]; /*!< This is the axises of the motors */ VecPosition m_Anchor; /*!< This is the anchor the joint */ double m_MaxMotorForce[2]; /*!< These are the maximum motor force*/ string m_EffectorName; /*!< This is the effector name of the motor */ string m_PercetorName; /*!< This is the perceptor name of the motor */ VecPosition m_PosRelParrent; /*!< Position relative to the parrent */ VecPosition m_PosRelChild; /*!< Position relative to the child */ TSceneNode* m_Parrent; /*!< Parrent of the joint */ TSceneNode* m_Child; /*!< Child of the joint */ int m_Number; /*!< Number of the joint */ mutable bool m_Saved; /*!< Is this joint saved before */ bool m_Renderable; /*!< Can the joint be rendered */ bool isEffector ( string & str ) const; bool parseEffector ( string & str ); bool isPerceptor ( string & str ) const; bool parsePerceptor ( string & str ); bool parseAttach ( string & str, TSceneNode * parrent, TNodeList & nodes ); bool parseAnchor ( string & str ); bool parseAxis ( string & str ); bool parseMotorForce ( string & str ); void assignNumber ( TJointList & joints ); void saveInformation ( ostream & os, string strGap, TSceneNode* thisNode ); public: TSceneJoint ( ); virtual ~ TSceneJoint ( ); virtual bool update ( ); virtual bool render ( ); bool parseAndLoad( string & str, TSceneNode * parrent, TNodeList & nodes, TJointList & joints ); TJoint getType ( ) const; void setType ( TJoint type ); VecPosition getAxis ( int number = 1 ) const; void setAxis ( VecPosition axis, int number = 1 ); VecPosition getAnchor ( ) const; void setAnchor ( VecPosition anchor ); double getMaxMotorForce( int number = 1 ) const; void setMaxMotorForce( double max_force, int number = 1 ); string getEffectorName( ) const; void setEffectorName( string name ); string getPerceptorName( ) const; void setPerceptorName( string name ); VecPosition getPosRelParrent( ) const; void setPosRelParrent( VecPosition pos ); VecPosition getPosRelChild( ) const; void setPosRelChild( VecPosition pos ); TSceneNode *getParrent ( ) const; void setParrent ( TSceneNode * parrent ); TSceneNode *getChild ( ) const; void setChild ( TSceneNode * child ); bool isRenderable( ) const; void setRenderable( bool renderable ); int getNumber ( ) const; void setNumber ( int num ); bool isSaved ( ) const; void setNotSaved ( ); void calculateRelativePositions( ); bool initialized ( ) const; void saveToStream( ostream & os, string strGap, const TSceneNode* thisNode ) const; friend ostream& operator << ( ostream &os, const TSceneJoint & joint ); friend ostream& operator << ( ostream &os, const TSceneJoint * joint ); ostream & show ( ostream & os = cout ) const;};#endif // _SCENE_COMPONENTS_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -