Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3727 in orxonox.OLD


Ignore:
Timestamp:
Apr 5, 2005, 7:44:05 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: added a third debug level, made SimpleAnimation singleton and restructured it to be more opengl command style

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/game_loader.cc

    r3629 r3727  
    101101
    102102        World* world1 = new World(DEBUG_WORLD_1);
    103         world1->setNextStoryID(WORLD_ID_GAMEEND);
     103        world1->setNextStoryID(WORLD_ID_2);
    104104        debugCampaign->addEntity(world1, WORLD_ID_1);
     105
     106        World* world2 = new World(DEBUG_WORLD_2);
     107        world2->setNextStoryID(WORLD_ID_GAMEEND);
     108        debugCampaign->addEntity(world2, WORLD_ID_2);
    105109
    106110        this->currentCampaign = debugCampaign;
  • orxonox/trunk/src/simple_animation.cc

    r3726 r3727  
    2626
    2727
     28SimpleAnimation* SimpleAnimation::singletonRef = 0;
     29/**
     30   \brief gets the singleton instance
     31   \returns singleton instance
     32*/
     33SimpleAnimation* SimpleAnimation::getInstance()
     34{
     35  if( singletonRef == NULL)
     36    singletonRef = new SimpleAnimation();
     37  return singletonRef;
     38}
     39
    2840/**
    2941   \brief standard constructor
    3042*/
    31 SimpleAnimation::SimpleAnimation (PNode* parent)
     43SimpleAnimation::SimpleAnimation ()
    3244{
    3345   this->setClassName ("SimpleAnimation");
     
    3547   this->localTime = 0;
    3648   this->bRunning = false;
    37    this->parent = parent;
    3849   this->currentFrame = NULL;
    3950   this->lastFrame = NULL;
     
    6172
    6273
     74/**
     75   \brief this determines the start of an Animator Describtion
     76
     77   this can then be followed by different commands like addKeyFrame(..) etc. and
     78   will be closed with AnimatiorEnd()
     79*/
     80void SimpleAnimation::AnimatorBegin()
     81{
     82  this->bDescriptive = true;
     83}
     84
     85
     86/**
     87   \brief this determines the end of an Animator Describtion
     88
     89   this can then be followed by different commands like addKeyFrame(..) etc. and
     90   will be closed with AnimatiorEnd()
     91*/
     92void SimpleAnimation::AnimatorEnd()
     93{
     94  this->workingObject = NULL;
     95  this->bDescriptive = false;
     96}
     97
     98
     99/**
     100   \brief select an object to work on by using this function
     101   \param object wo work on
     102*/
     103void SimpleAnimation::selectObject(WorldEntity* entity)
     104{
     105  this->workingObject = entity;
     106}
     107
     108
    63109
    64110/**
     
    70116void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
    71117{
     118  if( !this->bDescriptive)
     119    {
     120      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     121      return;
     122    }
    72123  KeyFrame* frame = new KeyFrame;
    73124  frame->position = point;
     
    75126  frame->time = time;
    76127  frame->mode = DEFAULT_ANIMATION_MODE;
     128  frame->object = this->workingObject;
    77129  this->frames->add(frame);
    78130}
     
    88140void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
    89141{
     142  if( !this->bDescriptive)
     143    {
     144      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     145      return;
     146    }
    90147  KeyFrame* frame = new KeyFrame;
    91148  frame->position = point;
     
    93150  frame->time = time;
    94151  frame->mode = mode;
     152  frame->object = this->workingObject;
    95153  this->frames->add(frame);
    96154}
     
    102160void SimpleAnimation::addKeyFrame(KeyFrame* frame)
    103161{
    104   if( frame != NULL)
    105     this->frames->add(frame);
     162  if( !this->bDescriptive)
     163    {
     164      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     165      return;
     166    }
     167  frame->object = this->workingObject;
     168  this->frames->add(frame);
    106169}
    107170
  • orxonox/trunk/src/simple_animation.h

    r3726 r3727  
    4343 
    4444 public:
    45   SimpleAnimation(PNode* parent);
    46   virtual ~SimpleAnimation();
     45  static SimpleAnimation* getInstance();
    4746
     47  void AnimatorBegin();
     48  void AnimatorEnd();
     49  void selectObject(WorldEntity* entity);
    4850  void addKeyFrame(Vector* point, Quaternion* orientation, float time);
    4951  void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
    5052  void addKeyFrame(KeyFrame* frame);
    5153  void reset();
     54
    5255
    5356  void start();
     
    6063
    6164 private:
     65  SimpleAnimation();
     66  virtual ~SimpleAnimation();
     67
     68  static SimpleAnimation* singletonRef;
    6269  bool bRunning;                   //<! is set, when the animation is running
    6370  tList<KeyFrame>* frames;         //<! where keyframes are stored in
     
    6976 
    7077  Vector* tmpVect;                 //<! this is the temporary vector save place -
    71 
     78  WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
     79  bool bDescriptive;               //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands
    7280};
    7381
  • orxonox/trunk/src/story_entities/world.cc

    r3710 r3727  
    390390
    391391            lightMan->getLight(0)->setParent(trackManager->getTrackNode());
     392            break;
     393          }
     394        case DEBUG_WORLD_2:
     395          {
     396            lightMan->setPosition(-5.0, 10.0, -40.0);
     397            this->nullParent = NullParent::getInstance ();
     398            this->nullParent->setName ("NullParent");
     399
     400            // !\todo old track-system has to be removed
     401
     402            //create helper for player
     403            //HelperParent* hp = new HelperParent ();
     404            /* the player has to be added to this helper */
     405
     406            // create a player
     407            this->localPlayer = new Player ();
     408            this->localPlayer->setName ("player");
     409            this->spawn (this->localPlayer);
     410            /*monitor progress*/
     411            //this->glmis->step();         
     412            this->glmis->step();
     413
     414            // bind input
     415            Orxonox *orx = Orxonox::getInstance ();
     416            orx->getLocalInput()->bind (this->localPlayer);
     417           
     418            // bind camera
     419            this->localCamera = new Camera();
     420            this->localCamera->setName ("camera");
     421            this->localCamera->lookAt(this->localPlayer);
     422            this->localCamera->setParent(this->localPlayer);
     423           
     424            /*monitor progress*/
     425            this->glmis->step();
     426
     427            // Create SkySphere
     428            this->skySphere = new Skysphere("../data/pictures/sky-replace.jpg");
     429            this->skySphere->setName("SkySphere");
     430            this->localCamera->addChild(this->skySphere);
     431            this->skySphere->setMode(PNODE_MOVEMENT);
     432
     433            /*monitor progress*/
     434            this->glmis->step();
     435
     436           
     437            WorldEntity* env = new Environment();
     438            env->setName ("env");
     439            this->spawn(env);
     440
     441           
     442            /*
     443            Vector* es = new Vector (10, 5, 0);
     444            Quaternion* qs = new Quaternion ();
     445            WorldEntity* pr = new Primitive(P_CYLINDER);
     446            pr->setName("primitive");
     447            this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT);
     448            */
     449
     450            /*monitor progress*/
     451            this->glmis->step();
     452
     453            //      trackManager->setBindSlave(env);
     454            PNode* tn = trackManager->getTrackNode();
     455            tn->addChild(this->localPlayer);
     456
     457            //localCamera->setParent(TrackNode::getInstance());
     458            tn->addChild(this->localCamera);
     459            //      localCamera->lookAt(tn);
     460            this->localPlayer->setMode(PNODE_ALL);
     461            //Vector* cameraOffset = new Vector (0, 5, -10);
     462            trackManager->condition(2, LEFTRIGHT, this->localPlayer);
     463            this->glmis->step();
     464
    392465            break;
    393466          }
  • orxonox/trunk/src/story_entities/world.h

    r3646 r3727  
    2424class Terrain;
    2525class GarbageCollector;
     26class SimpleAnimation;
    2627
    2728//! The game world Interface
     
    8889  void init(char* name, int worldID);
    8990
    90   Uint32 lastFrame;             //!< last time of frame
    91   Uint32 dt;                    //!< time needed to calculate this frame
    92   double gameTime;              //!< this is where the game time is saved
    93   bool bQuitOrxonox;            //!< quit this application
    94   bool bQuitCurrentGame;        //!< quit only the current game and return to menu
    95   bool bPause;                  //!< pause mode
     91  Uint32 lastFrame;                   //!< last time of frame
     92  Uint32 dt;                          //!< time needed to calculate this frame
     93  double gameTime;                    //!< this is where the game time is saved
     94  bool bQuitOrxonox;                  //!< quit this application
     95  bool bQuitCurrentGame;              //!< quit only the current game and return to menu
     96  bool bPause;                        //!< pause mode
    9697
    97   FontSet* testFont;            //!< A test Font. \todo fix this, so it is for real.
    98   GLMenuImageScreen* glmis;     //!< The Level-Loader Display
     98  FontSet* testFont;                  //!< A test Font. \todo fix this, so it is for real.
     99  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
    99100
    100   char* worldName;              //!< The name of this World
    101   int debugWorldNr;             //!< The Debug Nr. needed, if something goes wrong
     101  char* worldName;                    //!< The name of this World
     102  int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
    102103
    103   PNode* nullParent;            //!< The zero-point, that everything has as its parent.
    104   TrackManager* trackManager;   //!< The reference of the TrackManager that handles the course through the Level.
    105   Camera* localCamera;          //!< The current Camera
    106   Skysphere* skySphere;         //!< The Environmental Heaven of orxonox \todo insert this to environment insted
    107   LightManager* lightMan;       //!< The Lights of the Level
    108   Terrain* terrain;             //!< The Terrain of the World.
     104  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
     105  TrackManager* trackManager;         //!< The reference of the TrackManager that handles the course through the Level.
     106  Camera* localCamera;                //!< The current Camera
     107  Skysphere* skySphere;               //!< The Environmental Heaven of orxonox \todo insert this to environment insted
     108  LightManager* lightMan;             //!< The Lights of the Level
     109  Terrain* terrain;                   //!< The Terrain of the World.
    109110
    110   GLuint objectList;            //!< temporary: \todo this will be ereased soon
    111   tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
    112   WorldEntity* localPlayer;     //!< The Player, you fly through the level.
     111  GLuint objectList;                  //!< temporary: \todo this will be ereased soon
     112  tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
     113  WorldEntity* localPlayer;           //!< The Player, you fly through the level.
    113114
    114115  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
     116
     117  SimpleAnimation* simpleAnimation;   //!< reference to the SimpleAnimation object
    115118 
    116119  /* function for main-loop */
Note: See TracChangeset for help on using the changeset viewer.