📄 scenecomponents.h
字号:
/*********************************************************************************** In the name of Almighty ** ** SceneComponents.h : Robocup Soccer Simulator Developement Team: Zigorat ** ** Date: 07/08/2007 ** Author: Mahdi Hamdarsi ** Research Coordinator: Amin Mohammadi ** Comments: Representors of scene nodes & joints ** ***********************************************************************************//*! \file SceneComponents.h<pre><b>File:</b> SceneComponents.h<b>Project:</b> Robocup Soccer Simulator Developement Team: Zigorat<b>Authors:</b> Mahdi Hamdarsi, Amin Mohammadi<b>Created:</b> 12/02/2001<b>Last Revision:</b> $ID$<b>Contents:</b> Representors of scene nodes & joints<hr size=2><h2><b>Changes</b></h2><b>Date</b> <b>Author</b> <b>Comment</b>07/08/2007 Mahdi Hamdarsi Initial version created</pre>*/#ifndef _SCENE_COMPONENTS_#define _SCENE_COMPONENTS_#include <iostream>#include <string>#include <deque>using namespace std;#include "GraphicEngine.h"#include "SharedData.h"const string NODE_TRANSFORM = "Transform";const string NODE_CCYLINDER = "CCylinder";const string NODE_BOX = "Box";const string NODE_AGENTASPECT = "AgentAspect";const string NODE_SPACE = "Space";const string NODE_TOUCH = "TouchPerceptor";const string NODE_BOXCOLLIDER = "BoxCollider";const string NODE_FIXED = "FixedJoint";const string NODE_HINGE = "HingeJoint";const string NODE_UNIVERSAL = "UniversalJoint";const string NODE_HINGE2 = "Hinge2Joint";const string CMD_ROTATATION = "(setLocalRotation";const string CMD_POSITION = "(setLocalPos";const string CMD_SCENE = "(importScene";const string CMD_PARAM = "(setParams";const string CMD_EXTENT = "(setExtents";const string CMD_MATERIAL = "(setMaterial";const string CMD_ATTACH = "(attach";const string CMD_ANCHOR = "(setAnchor";const string CMD_MOTOR = "(setMaxMotorForce";const string CMD_NAME = "(setName";const string PERCEPT_HINGE = "HingePerceptor";const string PERCEPT_HINGE2 = "Hinge2Perceptor";const string PERCEPT_UNIVERSAL = "UniversalJointPerceptor";const string EFFECTOR_HINGE = "HingeEffector";const string EFFECTOR_HINGE2 = "Hinge2Effector";const string EFFECTOR_UNIVERSAL = "UniversalJointEffector";/*******************************************************************************//*************************** Forward declerations ****************************//*******************************************************************************/class TGenericData; /*!, Forward decleration of TGenericData */typedef TGenericData * PGenericData; /*!< Introducing PGenericData :) */class TSceneNode; /*!< Forward decleration of TSceneNode to be used in TNodeList */typedef deque<TSceneNode*> TNodeList; /*!< A deque of TSceneNodes as a list */class TSceneJoint; /*!< Forward decleration of TSceneNode to be used in TJointList */typedef deque<TSceneJoint*> TJointList; /*!< A deque of TSceneJoints as a list *//*******************************************************************************//******************************* TGenericData ********************************//*******************************************************************************//*! TGenericData is a class that enables to have a data with a variable data type, so that a data which is saved, can be accessed as different types */class TGenericData{ protected: int m_DataType; /*!< Current type of the data stored in storage */ string m_DataName; /*!< Name of the data stored */ string m_DataValue; /*!< Value of the data */ public: TGenericData ( ); TGenericData ( const double & value ); TGenericData ( const string & string ); TGenericData ( const char * string ); virtual ~ TGenericData ( ); int getDataType ( ) const; string getName ( ) const; void setName ( const string & name ); string getAsString ( ) const; double getAsDouble ( ) const; string getValue ( ) const; void setValue ( const string & value ); void setValue ( const double & value ); TGenericData & operator = ( const TGenericData & data ); TGenericData operator + ( const TGenericData & data ); TGenericData & operator += ( const TGenericData & data ); TGenericData operator - ( const TGenericData & data ); TGenericData & operator -= ( const TGenericData & data ); TGenericData operator * ( const TGenericData & data ); TGenericData & operator *= ( const TGenericData & data ); TGenericData operator / ( const TGenericData & data ); TGenericData & operator /= ( const TGenericData & data ); friend ostream& operator << ( ostream &os, const TGenericData & data ); friend ostream& operator << ( ostream &os, const TGenericData * data ); static double getNumberFromString( const string & str );};/*******************************************************************************//********************************* TSceneNode ********************************//*******************************************************************************//*! Class TSceneNode is a component node of the robot model which holds its information, like for the thigh a box with proper length, height, width, material, etc. */class TSceneNode : public TOpenGLObject{ protected: string m_Name; /*!< Name of the node */ string m_NodeName; /*!< Name of the node itself */ TShape m_Shape; /*!< Shape of the node */ double m_Length; /*!< Length of the node */ double m_Width; /*!< Width of the node */ double m_Height; /*!< Height of the node */ double m_Radius; /*!< Radius of the node */ double m_Mass; /*!< Mass of the node */ TMaterial m_Material; /*!< Material of the node */ TNodeList m_Children; /*!< Children of this node */ TJointList m_Joints; /*!< Joints of the nodes */ TSceneNode* m_Parrent; /*!< Parrent of this node */ unsigned m_ID; /*!< ID of this node */ static unsigned m_GlobalReference;/*!< Reference count of nodes*/ mutable bool m_Saved; /*!< Is node saved */ /// Parsing methods string parseName ( string & str ); VecPosition parseLocalRotation ( string & str ); VecPosition parseNodePosition ( string & str ); TMaterial parseMaterial ( string & str, unsigned & index ); bool parseScene ( string & str ); bool parseBoxExtents ( string & str ); bool parseCylinderParams ( string & str ); bool parseBoxColliderNode ( string & str ); bool parseTouchPerceptor ( string & str ); bool parseInformation ( string & str, unsigned & index, int & pran, TNodeList & nodes, TJointList & joints ); bool parseAgentAspectNode ( string str, TSceneNode * parrent, TNodeList & nodes, TJointList & joints ); bool parseSpaceNode ( string str, TSceneNode * parrent, TNodeList & nodes,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -