Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2115 in orxonox.OLD


Ignore:
Timestamp:
Jul 13, 2004, 10:49:20 AM (20 years ago)
Author:
chris
Message:

orxonox/branches/chris: Managed to apply all that rotating and translating so that you now actually see the debug player following the track. You can even steer the spaceship via the keys now… unfortunately the coordinate transformations are still a mess. Even though mapping from Locations to Placements seems to work in general, applying the finetuned position and rotation still messes up the whole damn thing…

Location:
orxonox/branches/chris/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/src/camera.cc

    r2112 r2115  
    8787                // TO DO: implement options for frustum generation
    8888        glFrustum( -1.0,1.0,-1.0,1.0,1.5,250.0);
    89         glRotatef(h,1,0,0);
    90         glRotatef(h/2,0,1,0);
    91         glRotatef(h/4,0,0,1);
    92         h += 3;
    93 //      glRotatef(90,0,0,1);
     89//Vector up(0,0,1);
     90//Vector dir(1,0,0);
     91//Quaternion q(dir,up);
     92//float matrix[4][4];
     93//q.conjugate().matrix (matrix);
     94//glMultMatrixf ((float*)matrix);
     95//glTranslatef (10,0,-5);
     96//
     97//dir = Vector(-1,-1,0);
     98//q = Quaternion( dir, up);
     99//glMatrixMode (GL_MODELVIEW);
     100//glLoadIdentity ();
     101//q.matrix (matrix);
     102//glMultMatrixf ((float*)matrix);
     103//glTranslatef (2,2,0);
     104//
     105//glBegin(GL_TRIANGLES);
     106//glColor3f(1,0,0);
     107//glVertex3f(0,0,0.5);
     108//glColor3f(0,1,0);
     109//glVertex3f(-0.5,0,-1);
     110//glColor3f(0,0,1);
     111//glVertex3f(0.5,0,-1);
     112//glEnd();     
     113
    94114        // rotation
    95115  float matrix[4][4];
  • orxonox/branches/chris/src/camera.h

    r2112 r2115  
    2626        void update_desired_place ();
    2727       
    28         float h;
    29        
    3028 public:
    3129  Camera ();
  • orxonox/branches/chris/src/command_node.cc

    r2105 r2115  
    194194void CommandNode::relay (Command* cmd)
    195195{
    196 perror("CommandNode|relay()");
     196printf("CommandNode|relay()\n");
    197197        List<WorldEntity>* plist = bound;
    198198       
     
    204204        while( (plist = plist->get_next()) != NULL)
    205205        {
    206                 (plist->get_object())->command (cmd);
     206                plist->get_object()->command (cmd);
    207207        }
    208208}
  • orxonox/branches/chris/src/orxonox.cc

    r2112 r2115  
    253253                return true;
    254254        }
     255        return false;
    255256}
    256257
  • orxonox/branches/chris/src/player.cc

    r2112 r2115  
    6161void Player::command (Command* cmd)
    6262{
     63        printf("Player|recieved command [%s]\n", cmd->cmd);
    6364        if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp;
    6465        else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp;
     
    7172{
    7273        glMatrixMode(GL_MODELVIEW);
     74        glLoadIdentity();
    7375        float matrix[4][4];
    74   get_placement()->w.matrix (matrix);
    75   glLoadMatrixf ((float*)matrix);
    7676
    7777        glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z);
     78  get_placement()->w.matrix (matrix);
     79  glMultMatrixf ((float*)matrix);
    7880       
    7981        glBegin(GL_TRIANGLES);
    8082        glColor3f(1,0,0);
    81         glVertex3f(0,0,0);
     83        glVertex3f(0,0,0.5);
    8284        glColor3f(0,1,0);
    83         glVertex3f(-1,-0.5,0);
     85        glVertex3f(-0.5,0,-1);
    8486        glColor3f(0,0,1);
    85         glVertex3f(-1,+0.5,0);
     87        glVertex3f(0.5,0,-1);
    8688        glEnd();
    8789       
     
    123125       
    124126        velocity = velocity + (accel * time);
     127        printf("Player|velocity %f/%f/%f\n", velocity.x, velocity.y, velocity.z);
    125128}
    126129
  • orxonox/branches/chris/src/track.cc

    r2112 r2115  
    5050       
    5151        camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
    52         camplc->w = Quaternion((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r), Vector(0,0,1));
     52        camplc->w = Quaternion(Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r)), Vector(0,0,1));
    5353       
    5454}
     
    6969        Quaternion dir(trace.a, Vector(0,0,1));
    7070       
    71         plc->r = trace.r + (trace.a * ((loc->dist) / l)) + dir.apply(loc->pos);
     71        plc->r = trace.r + (trace.a * ((loc->dist) / l)) + /*dir.apply*/(loc->pos);
    7272        plc->w = dir * loc->rot;
    7373       
  • orxonox/branches/chris/src/world.cc

    r2112 r2115  
    9494        glLoadIdentity();
    9595        glBegin(GL_LINES);
    96         glColor3f(1,0,0);
    97 /*      for( float x = -128.0; x < 128.0; x += 5.0)
    98         {
    99                 for( float y = -128.0; y < 128.0; y += 5.0)
    100                 {
     96        for( float x = -128.0; x < 128.0; x += 25.0)
     97        {
     98                for( float y = -128.0; y < 128.0; y += 25.0)
     99                {
     100                        glColor3f(1,0,0);
    101101                        glVertex3f(x,y,-128.0);
     102                        glVertex3f(x,y,0.0);
     103                        glColor3f(0.5,0,0);
     104                        glVertex3f(x,y,0.0);
    102105                        glVertex3f(x,y,128.0);
    103106                }
    104107        }
    105         glColor3f(0,1,0);
    106         for( float y = -128.0; y < 128.0; y += 5.0)
    107         {
    108                 for( float z = -128.0; z < 128.0; z += 5.0)
    109                 {
     108        for( float y = -128.0; y < 128.0; y += 25.0)
     109        {
     110                for( float z = -128.0; z < 128.0; z += 25.0)
     111                {
     112                        glColor3f(0,1,0);
    110113                        glVertex3f(-128.0,y,z);
     114                        glVertex3f(0.0,y,z);
     115                        glColor3f(0,0.5,0);
     116                        glVertex3f(0.0,y,z);
    111117                        glVertex3f(128.0,y,z);
    112118                }
    113119        }
    114         glColor3f(0,0,1);
    115         for( float x = -128.0; x < 128.0; x += 5.0)
    116         {
    117                 for( float z = -128.0; z < 128.0; z += 5.0)
    118                 {
     120        for( float x = -128.0; x < 128.0; x += 25.0)
     121        {
     122                for( float z = -128.0; z < 128.0; z += 25.0)
     123                {
     124                        glColor3f(0,0,1);
    119125                        glVertex3f(x,-128.0,z);
     126                        glVertex3f(x,0.0,z);
     127                        glColor3f(0,0,0.5);
     128                        glVertex3f(x,0.0,z);
    120129                        glVertex3f(x,128.0,z);
    121130                }
    122         }*/
     131        }
    123132        //draw track
    124133        glColor3f(0,1,1);
Note: See TracChangeset for help on using the changeset viewer.