Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3309 in orxonox.OLD for orxonox/branches/parenting


Ignore:
Timestamp:
Dec 30, 2004, 1:51:59 AM (20 years ago)
Author:
patrick
Message:

orxonox/branches/parenting: added a second worldentity just to test the lists - working but not drawing since there is no model loaded. including second object (importer) results in SEGFAULT

Location:
orxonox/branches/parenting/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/environment.cc

    r3302 r3309  
    2121#include "world_entity.h"
    2222#include "vector.h"
     23#include "importer/object.h"
    2324
    2425using namespace std;
    2526
    2627
    27 //Sorry Bensch
    28 #define LEVEL_LENGTH 500
    2928
    3029Environment::Environment () : WorldEntity()
    3130{
    32 
    33   /*
    34   //Sorry Bensch: x,y = 10
    35   for (int x = 0; x < 50; x++)
    36     {
    37       for (int y = 0; y < 50; y++)
    38         {
    39           mountainTest[x][y] =0;
    40                                                  
    41         }
    42     }
    43   //Sorry Bensch: x,y = 9
    44   for (int x = 1; x < LEVEL_LENGTH; x++)
    45     {
    46       for (int y = 1; y < LEVEL_LENGTH; y++)
    47         {
    48           //mountainTest[x][y] = (float)random() / 900000000;
    49           mountainTest[x][y] = (float)(random() % 4);                                       
    50         }
    51     }
    52   */
     31  //this->model = new Object("reaplow.obj");
    5332}
    5433
    5534
    5635
    57 Environment::~Environment () {}
     36Environment::~Environment ()
     37{
     38  //delete this->model;
     39}
    5840
    5941void Environment::tick (float time) {}
     
    7052  glLoadIdentity();
    7153  float matrix[4][4];
    72 
     54 
    7355  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     56  //rotate
    7457  this->getAbsDir ().matrix (matrix);
     58  glMultMatrixf((float*)matrix);
    7559 
    76 
    77   //glTranslatef(getPlacement()->r.x,getPlacement()->r.y,getPlacement()->r.z);
    78   //getPlacement()->w.matrix (matrix);
    79   glMultMatrixf ((float*)matrix);
    80 
    81   glBegin(GL_TRIANGLES);
    82   glColor3f(1,0,1);
    83   glVertex3f(0,0,0.5);
    84   glVertex3f(-0.5,0,-1);
    85   glVertex3f(0.5,0,-1);
    86  
    87   glVertex3f(0,0,0.5);
    88   glVertex3f(0,0.5,-1);
    89   glVertex3f(0,-0.5,-1);
    90   glEnd();
    91    
    92   glBegin(GL_QUADS);
    93   glColor3f(1,0,1);
    94   glVertex3f(0.5,0.5,-1);
    95   glVertex3f(0.5,-0.5,-1);
    96   glVertex3f(-0.5,-0.5,-1);
    97   glVertex3f(-0.5,0.5,-1);
    98   glEnd();
     60  glMatrixMode(GL_MODELVIEW);
     61  // this->model->draw();
    9962}
    10063
    101 /*
    102 void Environment::paint()
    103 {
    104  
    105   glPushMatrix();
    106   //glScalef(0.5, 0.5, 1.0);
    107   //glTranslatef(xCor, yCor, zCor);
    108   glTranslatef( -16.0, -2.0, 0.0);
    109  
    110   glColor3f(0.0, 1.0, 0.0);
    111  
    112   glBegin(GL_LINES);
    113   for (int x = 0; x < LEVEL_LENGTH; x += 1)
    114     {
    115       for (int y = 0; y < 190; y += 1)
    116         {
    117           glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
    118           glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]);
    119         }
    120     }
    121   glEnd();
    122  
    123  
    124   glBegin(GL_LINES);
    125   for (int y = 0; y < LEVEL_LENGTH; y += 1)
    126     {
    127       for (int x = 0; x < 90; x += 1)
    128         {
    129           glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);
    130           glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]);
    131         }
    132     }
    133   glEnd();
    134  
    135   glPopMatrix();
    136  
    137 }
    138 
    139 void Environment::drawEnvironment()
    140 {
    141 
    142 }
    143 
    144 */
  • orxonox/branches/parenting/src/player.cc

    r3307 r3309  
    1919#include "stdincl.h"
    2020#include "collision.h"
     21#include "importer/object.h"
    2122
    2223using namespace std;
     
    2627{
    2728
    28   this->obj = new Object("reaplow.obj");
     29  this->model = new Object("reaplow.obj");
    2930  /*
    3031  objectList = glGenLists(1);
     
    5657Player::~Player ()
    5758{
    58   delete this->obj;
     59  delete this->model;
    5960}
    6061
     
    104105 
    105106  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    106   printf("Player::draw() - (%f, %f, %f)\n", this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    107107  //rotate
    108108  this->getAbsDir ().matrix (matrix);
     
    110110 
    111111  glMatrixMode(GL_MODELVIEW);
    112   obj->draw();
     112  this->model->draw();
    113113  // glCallList(objectList);
    114114}
  • orxonox/branches/parenting/src/player.h

    r3302 r3309  
    88
    99#include "world_entity.h"
    10 #include "importer/object.h"
     10
     11class Object;
    1112
    1213//! Basic controllable WorldEntity
     
    3839  float acceleration;
    3940  GLuint objectList;
    40   Object* obj;
    4141 
    4242  void move(float time);
  • orxonox/branches/parenting/src/world.cc

    r3308 r3309  
    5151/**
    5252    \brief remove the World from memory
     53   
     54    delete everything explicitly, that isn't contained in the parenting tree!
     55    things contained in the tree are deleted automaticaly
    5356*/
    5457World::~World ()
     
    6063  this->localCamera->destroy();
    6164
     65  this->nullParent->destroy ();
     66
     67  /*
    6268  WorldEntity* entity = entities->enumerate(); 
    6369  while( entity != NULL )
     
    6773    }
    6874  this->entities->destroy();
     75  */
    6976
    7077  /* FIX the parent list has to be cleared - not possible if we got the old list also*/
    71   //this->nullParent->destroy ();
    72 
    73   delete this->entities;
    74   delete this->localCamera;
     78
     79
     80  //delete this->entities;
     81  //delete this->localCamera;
    7582  /* this->localPlayer hasn't to be deleted explicitly, it is
    7683     contained in entities*/
     
    170177           
    171178
    172             Vector* es = new Vector (20, 0, 10);
     179            Vector* es = new Vector (50, 0, 5);
    173180            Quaternion* qs = new Quaternion ();
    174181            WorldEntity* env = new Environment();
     182            env->setName ("env");
    175183            this->spawn(env, es, qs);
    176184
  • orxonox/branches/parenting/src/world_entity.cc

    r3302 r3309  
    3939  this->bDraw = true;
    4040  collisioncluster = NULL;
    41   owner = NULL;
    4241}
    4342
  • orxonox/branches/parenting/src/world_entity.h

    r3302 r3309  
    1111
    1212class CollisionCluster;
     13class Object;
    1314
    1415//! Basic class from which all interactive stuff in the world is derived from
     
    2021  WorldEntity (bool isFree = false);
    2122  virtual ~WorldEntity ();
     23
     24  Object* model;
    2225 
    2326  //PNode* pNode;
     
    4952  bool bCollide;
    5053  bool bDraw;
    51  
    52   WorldEntity* owner;
     54
     55  //PN WorldEntity* owner;
    5356  CollisionCluster* collisioncluster;
    5457  //PN Placement place;
Note: See TracChangeset for help on using the changeset viewer.