Changeset 2242 in orxonox.OLD for orxonox/branches/dave
- Timestamp:
- Jul 25, 2004, 10:00:08 PM (20 years ago)
- Location:
- orxonox/branches/dave/core
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/dave/core/environment.cc
r1994 r2242 18 18 19 19 #include "environment.h" 20 #include <ostream> 20 21 #include <iostream> 21 22 … … 25 26 //Sorry Bensch 26 27 #define LEVEL_LENGTH 500 28 dVector V1V2,V1V3,Kreuz; 29 dVector V1,V2,V3; 27 30 28 31 Environment::Environment () 29 32 { 30 33 31 34 //Sorry Bensch: x,y = 10 32 35 for (int x = 0; x < 50; x++) 33 36 { … … 43 46 for (int y = 1; y < LEVEL_LENGTH; y++) 44 47 { 45 46 mountainTest[x][y] = (float)(random() % 4);48 //mountainTest[x][y] = (float)random() / 900000000; 49 mountainTest[x][y] = (float)(random() % 2); 47 50 } 51 48 52 } 49 53 } … … 59 63 glPushMatrix(); 60 64 glEnable(GL_DEPTH_TEST); 65 glEnable(GL_LIGHTING); 66 61 67 //glScalef(0.5, 0.5, 1.0); 62 68 //glTranslatef(xCor, yCor, zCor); 63 glTranslatef( - 100.0, -50.0, 0.0);69 glTranslatef( -25.0, -10.0, 0.0); 64 70 65 glColor4f(0.0, 0.3, 0.4,1.0); 71 glColor3f(0.6, 0.6, 0.4); 72 glNormal3d(0,0,1); 73 glBegin(GL_TRIANGLES); 66 74 67 glBegin(GL_LINES); 68 for (int x = 0; x < LEVEL_LENGTH; x += 1) 69 { 70 for (int y = 0; y < 190; y += 1) 71 { 72 glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); 73 glVertex3f((float)(2*x), (float)(2*(y+1)), mountainTest[x][y+1]); 74 } 75 } 75 for (int x=0;x<60;x+=1) 76 { 77 for(int y=-30+DataTank::yOffset;y<40+DataTank::yOffset;y+=1) 78 { 79 if((int)DataTank::yOffset%2==1) 80 { 81 V1.x=x;V1.y=y;V1.z=mountainTest[x][y]; 82 V2.x=x;V2.y=y+1;V2.z=mountainTest[x][y+1]; 83 V3.x=x+1;V3.y=y;V3.z=mountainTest[x+1][y]; 84 glNormal3d(-(Environment::CalcNormale(&V1,&V2,&V3)).x,-(Environment::CalcNormale(&V1,&V2,&V3)).y,-(Environment::CalcNormale(&V1,&V2,&V3).z)); 85 86 glVertex3f((float)(x),(float)(y),mountainTest[x][y]); 87 glVertex3f((float)(x),(float)(y+1),mountainTest[x][y+1]); 88 glVertex3f((float)(x+1),(float)(y),mountainTest[x+1][y]); 89 90 V1.x=x;V1.y=y+1;V1.z=mountainTest[x][y+1]; 91 V2.x=x+1;V2.y=y+1;V2.z=mountainTest[x+1][y+1]; 92 V3.x=x+1;V3.y=y;V3.z=mountainTest[x+1][y]; 93 glNormal3d(-(Environment::CalcNormale(&V1,&V2,&V3)).x,-(Environment::CalcNormale(&V1,&V2,&V3)).y,-(Environment::CalcNormale(&V1,&V2,&V3).z)); 94 95 glVertex3f((float)(x),(float)(y+1),mountainTest[x][y+1]); 96 glVertex3f((float)(x+1),(float)(y+1),mountainTest[x+1][y+1]); 97 glVertex3f((float)(x+1),(float)(y),mountainTest[x+1][y]); 98 } 99 else 100 { 101 V1.x=x;V1.y=y+1;V1.z=mountainTest[x][y+1]; 102 V2.x=x;V2.y=y+2;V2.z=mountainTest[x][y+2]; 103 V3.x=x+1;V3.y=y+1;V3.z=mountainTest[x+1][y+1]; 104 glNormal3d(-(Environment::CalcNormale(&V1,&V2,&V3).x),-(Environment::CalcNormale(&V1,&V2,&V3).y),-(Environment::CalcNormale(&V1,&V2,&V3).z)); 105 106 glVertex3f((float)(x),(float)(y+1),mountainTest[x][y+1]); 107 glVertex3f((float)(x),(float)(y+2),mountainTest[x][y+2]); 108 glVertex3f((float)(x+1),(float)(y+1),mountainTest[x+1][y+1]); 109 110 111 V1.x=x;V1.y=y+2;V1.z=mountainTest[x][y+2]; 112 V2.x=x+1;V2.y=y+2;V2.z=mountainTest[x+1][y+2]; 113 V3.x=x+1;V3.y=y+1;V3.z=mountainTest[x+1][y+1]; 114 115 glNormal3d(-(Environment::CalcNormale(&V1,&V2,&V3).x),-(Environment::CalcNormale(&V1,&V2,&V3).y),-(Environment::CalcNormale(&V1,&V2,&V3).z)); 116 117 glVertex3f((float)(x),(float)(y+2),mountainTest[x][y+2]); 118 glVertex3f((float)(x+1),(float)(y+2),mountainTest[x+1][y+2]); 119 glVertex3f((float)(x+1),(float)(y+1),mountainTest[x+1][y+1]); 120 }} 121 122 123 } 76 124 glEnd(); 125 /*glBegin(GL_LINES); 126 for(int y=0+DataTank::yOffset/2;y<25+DataTank::yOffset/2;y+=1) 127 { 128 for(int x=0;x<25;x+=1) 129 { 130 glVertex3f((float)(2*x),(float)(2*y),mountainTest[x][y]); 131 glVertex3f((float)(2*(x+1)),(float)(2*y),mountainTest[x+1][y]); 132 } 133 } 77 134 78 79 glBegin(GL_LINES);80 for (int y = 0; y < LEVEL_LENGTH; y += 1)81 {82 for (int x = 0; x < 90; x += 1)83 {84 glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]);85 glVertex3f((float)(2*(x+1)), (float)(2*y), mountainTest[x+1][y]);86 }87 }88 135 glEnd(); 89 136 */ 90 137 glPopMatrix(); 91 138 } 92 139 140 141 142 dVector Environment::CalcNormale(dVector *V1, dVector *V2, dVector *V3){ 143 GLdouble Betrag; 144 V1V2.x = V2->x - V1->x; 145 V1V2.y = V2->y -V1->y; 146 V1V2.z = V2->z -V1->z; 147 V1V3.x = V3->x -V1->x; 148 V1V3.y = V3->y -V1->y; 149 V1V3.z = V3->z -V1->z; 150 151 Kreuz.x =+((V1V2.y * V1V3.z) -(V1V2.z * V1V3.y)); 152 Kreuz.y =-((V1V2.x *V1V3.z) -(V1V2.z * V1V3.x)); 153 Kreuz.z =+((V1V2.x * V1V3.y) - (V1V2.y * V1V3.x)); 154 155 Betrag =sqrt(pow(Kreuz.x, 2) + pow(Kreuz.y,2) +pow(Kreuz.z,2)); 156 return Kreuz; 157 } 158 159 160 161 -
orxonox/branches/dave/core/environment.h
r1994 r2242 7 7 8 8 #include "data_tank.h" 9 typedef struct dVektor{ 10 GLdouble x; 11 GLdouble y; 12 GLdouble z; 13 14 15 }dVector; 9 16 10 17 class Environment { … … 16 23 17 24 float mountainTest[10][10]; 18 25 26 27 28 19 29 public: 20 30 Environment (); … … 24 34 void setEnvPosition(void); 25 35 void getEnvPosition(void); 36 dVector CalcNormale(dVector *V1, dVector *V2, dVector *V3); 26 37 27 38 }; -
orxonox/branches/dave/core/orxonox.cc
r1994 r2242 73 73 int Orxonox::globalInit (int argc, char** argv) 74 74 { 75 glEnable(GL_DEPTH_TEST);75 //glEnable(GL_DEPTH_TEST); 76 76 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 77 77 glutInit(&argc, argv); 78 78 glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB | GLUT_DEPTH); 79 79 glEnable(GL_NORMALIZE); 80 glEnable(GL_COLOR_MATERIAL); 80 81 82 //glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,1); 83 84 85 86 87 88 81 89 /*glEnable(GL_LIGHT0); 82 90 glEnable(GL_LIGHTING); … … 137 145 npc->setCollisionRadius(1.0); 138 146 world->addNPC(npc); 139 140 NPC* npc2 =new NPC;141 npc2->setPosition( -2.0, 10.0, 3.0);142 npc2->setCollisionRadius(1 .0);147 148 NPC* npc2=new NPC; 149 npc2->setPosition(3,10,3); 150 npc2->setCollisionRadius(1); 143 151 world->addNPC(npc2); 144 145 NPC* npc3 = new NPC;146 npc3->setPosition(3.0, 30.0, 3.0);147 npc3->setCollisionRadius(1.0);148 world->addNPC(npc3);149 150 NPC* npc4 = new NPC;151 npc4->setPosition(-2.0, 35.0, 3.0);152 npc4->setCollisionRadius(1.0);153 world->addNPC(npc4);154 155 NPC* npc5 = new NPC;156 npc5->setPosition(5.0, 45.0, 3.0);157 npc5->setCollisionRadius(1.0);158 world->addNPC(npc5);159 152 160 153 glutSpecialFunc(specFunc); … … 173 166 /* this is very very unsafe: io could be uninit */ 174 167 io->setPlayerStep(19.0/fps); /* set player to propper speed */ 175 localPlayer->shootLaser->setShootStep( 20.0/fps); /* set shoot speed */176 world->setWorldStep( 7.0/fps); /* set the speed of the terrain moving away */168 localPlayer->shootLaser->setShootStep(400.0/fps); /* set shoot speed */ 169 world->setWorldStep(5.0/fps); /* set the speed of the terrain moving away */ 177 170 fps = 0; 178 171 inputEnabled = true; -
orxonox/branches/dave/core/player.cc
r1994 r2242 76 76 { 77 77 shootLaser->addShoot(xCor,yCor+1.0,5); 78 //shootLaser->addShootExt(xCor,yCor,zCor,.1,.4,.0); 78 shootLaser->addShootExt(xCor,yCor,zCor,.1,.4,.0); 79 shootLaser->addShootExt(xCor,yCor,zCor,-.1,.4,.0); 79 80 //shootLaser->addShootdExt(xCor,yCor,zCor,-.1,.4,.0); 80 shootRocket->addBackParable(xCor,yCor,zCor);81 //shootRocket->addBackParable(xCor,yCor,zCor); 81 82 82 83 … … 96 97 glPopMatrix();*/ 97 98 glPushMatrix(); 98 //glEnable(GL_DEPTH_TEST); 99 glEnable(GL_NORMALIZE); 100 glEnable(GL_COLOR_MATERIAL); 101 glEnable(GL_LIGHTING); 102 glEnable(GL_LIGHT0); 103 GLfloat LPosition[4]={0,20,30,1}; 104 glLightfv(GL_LIGHT0,GL_POSITION,&LPosition[0]); 105 glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); 106 99 107 glTranslatef(xCor,yCor,5.0); 100 108 glRotatef(3*a,1.0,0.0,0.0); … … 102 110 //glTranslatef(xCor,yCor,3.0); 103 111 glBegin(GL_QUADS); 104 glColor3f( 1.0,0.0,0.0);112 glColor3f(.2,0.5,0.5); 105 113 glNormal3f(-1.0,0.0,0.0); 106 114 glVertex3f(-1.0,-1.0,-1.0); 107 115 glVertex3f(-1.0,-1.0,1.0); 108 glVertex3f(- .6,1.0,0.4);109 glVertex3f(- .6,1.0,-0.4);116 glVertex3f(-1,1.0,0.4); 117 glVertex3f(-1,1.0,-0.4); 110 118 111 glNormal3f(0.0,-1.0,0.0); 112 glColor3f(0.0,1.0,0.0); 113 glVertex3f(-.6,1.0,.4); 114 glVertex3f(-.6,1.0,-.4); 115 glVertex3f(.6,1.0,-.4); 116 glVertex3f(.6,1.0,.4); 119 glNormal3f(1,0,0); 120 glVertex3f(-.99,-1,-1); 121 glVertex3f(-.99,-1,1); 122 glVertex3f(-.99,1,.4); 123 glVertex3f(-.99,1,-.4); 117 124 118 glNormal3f(-1.0,0.0,0.0); 119 glColor3f(0.0,0.0,1.0); 120 glVertex3f(.6,1.0,.4); 121 glVertex3f(.6,1.0,-.4); 125 glNormal3f(0.0,1.0,0.0); 126 glVertex3f(-1,1.0,.4); 127 glVertex3f(-1,1.0,-.4); 128 glVertex3f(1,1.0,-.4); 129 glVertex3f(1,1.0,.4); 130 131 glNormal3f(0,-1,0); 132 glVertex3f(-1,.99,.4); 133 glVertex3f(-1,.99,-.4); 134 glVertex3f(1,.99,-.4); 135 glVertex3f(1,.99,.4); 136 137 glNormal3f(1.0,0.0,0.0); 138 glVertex3f(1,1,.4); 139 glVertex3f(1,1,-.4); 122 140 glVertex3f(1.0,-1.0,-1.0); 123 141 glVertex3f(1.0,-1.0,1.0); 142 143 glNormal3f(-1,0,0); 144 glVertex3f(.99,1,.4); 145 glVertex3f(.99,1,-.4); 146 glVertex3f(.99,-1,-1); 147 glVertex3f(.99,-1,1); 124 148 125 149 … … 133 157 134 158 /* draw all the shoots additionaly */ 159 glColor3f(0,0,1); 135 160 shootLaser->drawShoot(); 136 161 shootRocket->drawShoot(); -
orxonox/branches/dave/core/shoot_laser.cc
r1995 r2242 29 29 { 30 30 lastShoot = null; 31 step = 1.0;31 step = .01; 32 32 inhibitor = 0; 33 33 } -
orxonox/branches/dave/core/world.cc
r1994 r2242 206 206 /* draw the ground grid */ 207 207 glColor3f(0.3, 0.3, 0.0); 208 glBegin(GL_LINES);208 // glBegin(GL_LINES); 209 209 /* for the moment, we've got only pseudo moving ground 210 210 for (int y = 0; y < 60; y += 2)
Note: See TracChangeset
for help on using the changeset viewer.