Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1883 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 10, 2004, 12:36:58 AM (21 years ago)
Author:
patrick
Message:

orxonox/trunk: added envoronment eg. little mountain - its time to talk about further development…

Location:
orxonox/trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/IDEAS

    r1879 r1883  
    33all: fill in your ideas here!
    44
    5 Spacecraft trasformation
     5- Spacecraft transformations
     6- weather influences: fog, rain, sun, wind
     7- team play: fight with team-mates
     8- RPG style: intelligence, constitution, force/power
    69
  • orxonox/trunk/core/Makefile

    r1879 r1883  
    4040        player.o \
    4141        world.o \
    42         input_output.o
     42        input_output.o \
     43        environment.o
    4344
    4445TARGET = orxonox
  • orxonox/trunk/core/orxonox.cc

    r1879 r1883  
    2626/* class definition header */
    2727#include "orxonox.h"
     28#include "environment.h"
    2829
    2930
     
    7071{
    7172  glutInit(&argc, argv);
    72   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
     73  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
     74  glEnable(GL_DEPTH_TEST);
    7375  glutInitWindowSize(500, 500);
    7476  //glutFullScreen();
     
    9395  glClearColor(0.0, 0.0, 0.0, 0.0);
    9496  world = new World;
     97  (*world).initEnvironement();
    9598  Player* localPlayer = new Player;
    9699  io = new InputOutput(world, localPlayer);
    97100  (*world).addPlayer(localPlayer);
    98   //  (*localPlayer).addIO(io);
    99 
    100   //glutIgnoreKeyRepeat(1);                 /* for win32 */
    101   //glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF);  /* for linux X11 */
     101  Environment *env = new Environment;
     102  (*world).addEnv(env);
     103 
     104
    102105  glutSpecialFunc(specFunc);
    103106  glutSpecialUpFunc(releaseKey);
     
    144147    break;
    145148  case 27:
     149  case 'q':
    146150    quitGame();
    147151    break;
     
    208212void Orxonox::display()
    209213{
    210   glClear(GL_COLOR_BUFFER_BIT);
     214  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    211215
    212216  glColor3f(0.0, 0.5, 0.6);
  • orxonox/trunk/core/player.cc

    r1879 r1883  
    7878
    7979
    80   cout << "x: " << xCor << " y: " << yCor << endl;
     80  //cout << "x: " << xCor << " y: " << yCor << endl;
    8181}
  • orxonox/trunk/core/world.cc

    r1879 r1883  
    3232  lastPlayer = null;
    3333  lastNPC = null;
     34  lastEnv = null;
    3435}
    3536
     
    99100    }
    100101  lastNPC = listMember;
     102}
     103
     104
     105/**
     106   \brief Add environmental object
     107   \param player A reference to the new env object
     108   
     109   Add a new Environment to the world. Env has to be initialised before.
     110*/
     111bool World::addEnv(Environment* env)
     112{
     113  envList* listMember = new envList;
     114  listMember->env = env;
     115  if ( lastEnv != null )
     116    {
     117      listMember->number = lastEnv->number + 1;
     118      listMember->next = lastEnv;
     119    }
     120  else
     121    {
     122      listMember->number = 0;
     123      listMember->next = null;
     124    }
     125  lastEnv = listMember;
    101126}
    102127
     
    137162    }
    138163  /* now draw the rest of the world: environement */
     164  /* second draw all npcs */
     165  envList* tmpEnv = lastEnv;
     166  while( tmpEnv != null )
     167    {
     168      (*tmpEnv->env).drawEnvironment();
     169      tmpEnv = tmpEnv->next;
     170    }
     171
     172  /*
    139173  glColor3f(0.0, 1.0, 0.0);
    140174  glBegin(GL_LINES);
    141   glVertex3f(0.0, -10.0, 0.0);
    142   glVertex3f(0.0, 200.0, 0.0);
    143 
    144   glVertex3f(5.0, -10.0, 0.0);
    145   glVertex3f(5.0, 200.0, 0.0);
    146 
    147   glVertex3f(-5.0, -10.0, 0.0);
    148   glVertex3f(-5.0, 200.0, 0.0);
    149 
    150   glVertex3f(10.0, -10.0, 0.0);
    151   glVertex3f(10.0, 200.0, 0.0);
    152 
    153   glVertex3f(-10.0, -10.0, 0.0);
    154   glVertex3f(-10.0, 200.0, 0.0);
    155 
    156   glVertex3f(15.0, -10.0, 0.0);
    157   glVertex3f(15.0, 200.0, 0.0);
    158 
    159   glVertex3f(-15.0, -10.0, 0.0);
    160   glVertex3f(-15.0, 200.0, 0.0);
    161 
    162   glVertex3f(20.0, -10.0, 0.0);
    163   glVertex3f(20.0, 200.0, 0.0);
    164 
    165   glVertex3f(-20.0, -10.0, 0.0);
    166   glVertex3f(-20.0, 200.0, 0.0);
    167 
    168   glVertex3f(25.0, -10.0, 0.0);
    169   glVertex3f(25.0, 200.0, 0.0);
    170 
    171   glVertex3f(-25.0, -10.0, 0.0);
    172   glVertex3f(-25.0, 200.0, 0.0);
     175  for (int x = 0; x <= 35; x += 5)
     176    {
     177      glVertex3f((float)x, -10.0, 0.0);
     178      glVertex3f((float)x, 200.0, 0.0);
     179
     180      glVertex3f(-(float)x, -10.0, 0.0);
     181      glVertex3f(-(float)x, 200.0, 0.0);
     182    }
     183  for (int x = -10; x<= 200; x += 5)
     184    {
     185      glVertex3f(-50.0, (float)x, 0.0);
     186      glVertex3f(50.0, (float)x, 0.0);
     187    }
    173188  glEnd();
    174 
    175 
     189  */
     190 
     191 
     192  glColor3f(0.0, 1.0, 0.0);
     193 
     194  glBegin(GL_LINES);
     195  for (int x = 0; x < 60; x += 2)
     196    {
     197      for (int y = 0; y < 60; y += 2)
     198        {
     199          glVertex3f((float)(x - 30), (float)(y - 30), surface[x][y]);
     200          glVertex3f((float)(x - 30), (float)(y - 28), surface[x][y+2]);
     201        }
     202    }
     203  glEnd();
     204 
     205 
     206  glBegin(GL_LINES);
     207  for (int y = 0; y < 60; y += 2)
     208    {
     209      for (int x = 0; x < 60; x += 2)
     210        {
     211          glVertex3f((float)(x - 30), (float)(y - 30), surface[x][y]);
     212          glVertex3f((float)(x - 28), (float)(y - 30), surface[x+2][y]);
     213        }
     214    }
     215  glEnd();
     216 
     217}
     218
     219
     220void World::initEnvironement()
     221{
     222
     223 for (int x = 0; x < 60; x += 2)
     224    {
     225      for (int y = 0; y < 60; y += 2)
     226        {
     227          surface[x][y] = 0;
     228        }
     229    }
    176230}
    177231
     
    217271    }
    218272
     273
     274  /* test addEnv */
     275  cout << "addEnv test..." << endl;
     276  envList* en = lastEnv;
     277  while ( en != null )
     278    {
     279      cout << "env " << en->number << " was found" << endl;
     280      en = en->next;
     281    }
     282
    219283  /* test drawWorld() */
    220   cout << "drawWorld()..." << endl;
    221   drawWorld();
    222 
    223   cout << "World::testThaTest() finished" << endl;
    224 }
     284}
  • orxonox/trunk/core/world.h

    r1872 r1883  
    55#define WORLD_H
    66
     7#include <stdlib.h>
     8
    79#include "npc.h"
    810#include "player.h"
     11#include "environment.h"
    912#include "stdincl.h"
    1013
     
    3639  npcList* lastNPC;
    3740
     41  /* a list of all environmental objects */
     42  struct envList {
     43    envList* next;
     44    Environment* env;
     45    int number;
     46  };
     47  envList* lastEnv;
     48
    3849  bool addPlayer(Player* player);
    3950  bool removePlayer(Player* player);
     
    4354  bool removeNPC(NPC* npc);
    4455
     56  bool addEnv(Environment* env);
    4557
    4658  void drawWorld(void);
     59  void initEnvironement(void);
    4760  void updateWorld(void);
    4861  void testThaTest(void);
     62
     63 private:
     64  float surface[120][120];
    4965
    5066
Note: See TracChangeset for help on using the changeset viewer.