Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6361 in orxonox.OLD for branches


Ignore:
Timestamp:
Dec 30, 2005, 11:25:05 PM (19 years ago)
Author:
patrick
Message:

network: cleaned up some stuff in the camera class

Location:
branches/network/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/story_entities/game_world.cc

    r6358 r6361  
    144144{
    145145  this->setClassID(CL_GAME_WORLD, "GameWorld");
    146 
    147146  this->setName(name);
     147
    148148  this->gameTime = 0.0f;
    149149  this->setSpeed(1.0);
  • branches/network/src/story_entities/multi_player_world.cc

    r6358 r6361  
    2525
    2626
    27 
    28 
    29 SHELL_COMMAND(speed, MultiPlayerWorld, setSpeed);
    30 SHELL_COMMAND(togglePNodeVisibility, MultiPlayerWorld, togglePNodeVisibility);
    31 SHELL_COMMAND(toggleBVVisibility, MultiPlayerWorld, toggleBVVisibility);
    32 
    3327using namespace std;
    3428
    3529//! This creates a Factory to fabricate a MultiPlayerWorld
    36 CREATE_FACTORY(MultiPlayerWorld, CL_WORLD);
     30CREATE_FACTORY(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD);
     31
    3732
    3833MultiPlayerWorld::MultiPlayerWorld(const TiXmlElement* root)
     
    4439}
    4540
     41
    4642/**
    4743 *  remove the MultiPlayerWorld from memory
     
    5248MultiPlayerWorld::~MultiPlayerWorld ()
    5349{
    54   delete this->shell;
    5550  PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n");
     51}
    5652
    57   delete this->localPlayer;
    58 
    59   // delete all the initialized Engines.
    60   FastFactory::flushAll(true);
    61   delete LightManager::getInstance();
    62   delete ParticleEngine::getInstance();
    63   delete AnimationPlayer::getInstance();
    64   delete PhysicsEngine::getInstance();
    65 
    66   // external engines initialized by the orxonox-class get deleted
    67   SoundEngine::getInstance()->flushAllBuffers();
    68   SoundEngine::getInstance()->flushAllSources();
    69 
    70   if (State::getObjectManager() == &this->objectManager)
    71     State::setObjectManager(NULL);
    72   // erease everything that is left.
    73   delete PNode::getNullParent();
    74 
    75   //secondary cleanup of PNodes;
    76   const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
    77   if (nodeList != NULL)
    78     while (!nodeList->empty())
    79       delete nodeList->front();
    80 
    81   Shader::suspendShader();
    82 
    83   // unload the resources !!
    84   ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
    85 }
    8653
    8754/**
     
    9865void MultiPlayerWorld::constuctorInit(const char* name, int worldID)
    9966{
    100   this->setClassID(CL_WORLD, "MultiPlayerWorld");
    101   PRINTF(0)("START\n");
     67  this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld");
     68  this->setName(name);
    10269
    103   this->setName(name);
    10470  this->gameTime = 0.0f;
    10571  this->setSpeed(1.0);
     
    149115
    150116  /* the the single player specific stuff here */
    151 
    152   /* some static world entities */
    153   for(int i = 0; i < 100; i++)
    154   {
    155     WorldEntity* tmp = new NPCTest1();
    156     char npcChar[10];
    157     sprintf (npcChar, "NPC_%d", i);
    158     tmp->setName(npcChar);
    159     tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
    160     this->spawn(tmp);
    161   }
    162117}
    163118
  • branches/network/src/story_entities/multi_player_world.h

    r6359 r6361  
    1212class TiXmlElement;
    1313
     14
    1415//! The multiplayer game world
    1516/**
    16    this class initializes everything that should be displayed inside of the current level.
    17    it is the main driving factor during gameplay.
    18 */
     17 *  this class initializes everything that should be displayed inside of the current level.
     18 *  it is the main driving factor during gameplay.
     19 */
    1920class MultiPlayerWorld : public GameWorld {
    2021
     
    2829  ErrorMessage load ();
    2930  ErrorMessage postLoad();
     31
     32  private:
     33    void constuctorInit(const char* name, int worldID);
     34
    3035};
    3136
  • branches/network/src/world_entities/camera.cc

    r6222 r6361  
    1111   ### File Specific:
    1212   main-programmer: Christian Meyer
    13    co-programmer: ...
     13   co-programmer: Benjamin Grauer
    1414*/
    1515#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     
    1717#include "camera.h"
    1818
    19 #include "world.h"
    20 #include "world_entity.h"
    21 #include "vector.h"
    22 #include "event.h"
    23 #include "event_handler.h"
    2419
    2520using namespace std;
    2621
    27 ////////////
    28 // CAMERA //
    29 ////////////
    3022
    3123/**
     
    5850*/
    5951Camera::~Camera()
    60 {
    61 }
     52{}
    6253
    6354/**
     
    115106  currentMode = mode;
    116107  switch (mode)
    117     {
     108  {
    118109    default:
    119110    case VIEW_NORMAL:
    120111      this->toFovy = 60.0;
    121 /*      this->setParentSoft("TrackNode");
    122       this->target->setParentSoft("TrackNode"); */
     112      /*      this->setParentSoft("TrackNode");
     113            this->target->setParentSoft("TrackNode"); */
    123114      this->setRelCoorSoft(-10, 5, 0);
    124115      this->target->setRelCoorSoft(0,0,0);
    125116      break;
    126117    case VIEW_BEHIND:
    127 //      this->toFovy = 120.0;
    128 //      this->setRelCoorSoft(Vector(3.5, 0, 0));
    129   //    this->target->setRelCoorSoft(Vector(10,0,0));
    130 
    131 //       if (!strcmp(this->target->getParent()->getName(), "Player"))
    132 //         this->target->setParentSoft("TrackNode");
    133 //       else
    134 //         this->target->setParentSoft("Player");
    135 //       this->getParent()->debugNode(0);
    136 
    137 //      this->setParent("main-Turret");
    138 //      this->setParentMode(PNODE_ALL);
    139 //      this->target->setParentSoft("Player");
     118      //      this->toFovy = 120.0;
     119      //      this->setRelCoorSoft(Vector(3.5, 0, 0));
     120      //    this->target->setRelCoorSoft(Vector(10,0,0));
     121
     122      //       if (!strcmp(this->target->getParent()->getName(), "Player"))
     123      //         this->target->setParentSoft("TrackNode");
     124      //       else
     125      //         this->target->setParentSoft("Player");
     126      //       this->getParent()->debugNode(0);
     127
     128      //      this->setParent("main-Turret");
     129      //      this->setParentMode(PNODE_ALL);
     130      //      this->target->setParentSoft("Player");
    140131
    141132      break;
    142133    case VIEW_FRONT:
    143134      this->toFovy = 120.0;
    144 /*       this->setParentSoft("Player");
    145        this->target->setParentSoft("Player");*/
    146        this->setRelCoorSoft(4, 0, 0, 5);
    147        this->target->setRelCoorSoft(Vector(10,0,0), 5);
    148 //      this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));
     135      /*       this->setParentSoft("Player");
     136             this->target->setParentSoft("Player");*/
     137      this->setRelCoorSoft(4, 0, 0, 5);
     138      this->target->setRelCoorSoft(Vector(10,0,0), 5);
     139      //      this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));
    149140      break;
    150141    case VIEW_LEFT:
    151142      this->toFovy = 90;
    152 /*      this->setParentSoft("TrackNode");
    153       this->target->setParentSoft("TrackNode");*/
     143      /*      this->setParentSoft("TrackNode");
     144            this->target->setParentSoft("TrackNode");*/
    154145      this->setRelCoorSoft(0, 1, -10, .5);
    155146      this->target->setRelCoorSoft(0,0,0);
     
    157148    case VIEW_RIGHT:
    158149      this->toFovy = 90;
    159 /*      this->setParentSoft("TrackNode");
    160       this->target->setParentSoft("TrackNode");*/
     150      /*      this->setParentSoft("TrackNode");
     151            this->target->setParentSoft("TrackNode");*/
    161152      this->setRelCoorSoft(Vector(0, 1, 10));
    162153      this->target->setRelCoorSoft(0,0,0);
     
    164155    case VIEW_TOP:
    165156      this->toFovy= 120;
    166 /*      this->setParentSoft("TrackNode");
    167       this->target->setParentSoft("TrackNode");*/
     157      /*      this->setParentSoft("TrackNode");
     158            this->target->setParentSoft("TrackNode");*/
    168159      this->setRelCoorSoft(Vector(30, 50, 0));
    169160      this->target->setRelCoorSoft(35,0,0);
    170     }
     161  }
    171162}
    172163
     
    216207  // switching back to Modeling Matrix
    217208  glMatrixMode (GL_MODELVIEW);
    218 //  this->target->getParent()->getParent()->debugDraw(0, 2, Vector(1,0,0));
     209  //  this->target->getParent()->getParent()->debugDraw(0, 2, Vector(1,0,0));
    219210}
    220211
     
    226217{
    227218  if( event.type == KeyMapper::PEV_VIEW0)
    228     {
    229       this->setViewMode(VIEW_NORMAL);
    230     }
     219  {
     220    this->setViewMode(VIEW_NORMAL);
     221  }
    231222  else if( event.type == KeyMapper::PEV_VIEW1)
    232     {
    233       this->setViewMode(VIEW_BEHIND);
    234     }
     223  {
     224    this->setViewMode(VIEW_BEHIND);
     225  }
    235226  else if( event.type == KeyMapper::PEV_VIEW2)
    236     {
    237       this->setViewMode(VIEW_FRONT);
    238     }
     227  {
     228    this->setViewMode(VIEW_FRONT);
     229  }
    239230  else if( event.type == KeyMapper::PEV_VIEW3)
    240     {
    241       this->setViewMode(VIEW_LEFT);
    242     }
     231  {
     232    this->setViewMode(VIEW_LEFT);
     233  }
    243234  else if( event.type == KeyMapper::PEV_VIEW4)
    244     {
    245       this->setViewMode(VIEW_RIGHT);
    246     }
     235  {
     236    this->setViewMode(VIEW_RIGHT);
     237  }
    247238  else if( event.type == KeyMapper::PEV_VIEW5)
    248     {
    249       this->setViewMode(VIEW_TOP);
    250     }
     239  {
     240    this->setViewMode(VIEW_TOP);
     241  }
    251242}
    252243
     
    260251{
    261252  this->setClassID(CL_CAMERA_TARGET, "CameraTarget");
    262 //  this->setParentMode(PNODE_MOVEMENT);
    263 }
    264 
     253  //  this->setParentMode(PNODE_MOVEMENT);
     254}
     255
Note: See TracChangeset for help on using the changeset viewer.