Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4300 in orxonox.OLD


Ignore:
Timestamp:
May 26, 2005, 3:17:24 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: flush for merge

Location:
orxonox/branches/physics/src/subprojects/particles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/subprojects/particles/framework.cc

    r4298 r4300  
    2424#include "debug.h"
    2525#include "graphics_engine.h"
     26#include "light.h"
    2627#include "resource_manager.h"
    2728#include "camera.h"
     
    4142
    4243      // Draw the scene
    43       draw(dt);     
     44      draw(dt);
    4445    }
    4546}
     
    5859
    5960}
     61
     62
    6063float Framework::tick()
    6164{
    6265  currFrame = SDL_GetTicks();
    63   float dt = (float)(currFrame - lastFrame) /1000.0;
    64   if (dt == 0)
    65     dist += (zoomTo-dist);
    66   else
    67     dist += (zoomTo-dist) *(float)dt;
    68   rotatorP += rotatorV *(float)dt;
     66  float dt = (float)(currFrame - lastFrame) / 1000.0;
     67  lastFrame = currFrame;
    6968
    7069  ParticleEngine::getInstance()->tick(dt);
    71 
    72   lastFrame = currFrame;
    7370
    7471  NullParent::getInstance()->update(dt);
     
    121118              p1 = p2;
    122119            */
     120           
    123121
    124122          }
     
    128126          {
    129127            PRINTF(4)("MouseWheel up\n");
    130             zoomTo *= .5;
     128            //      zoomTo *= .5;
    131129          }
    132130        else if (event.button.button == 5)
    133131          {
    134132            PRINTF(4)("MouseWheel down\n");
    135             zoomTo *= 2.0;
     133            //      zoomTo *= 2.0;
    136134          }
    137135        else if (event.button.button == 1)
    138136          {
    139137            mouse1Down = true;
    140             int mX = event.button.x;
    141             int mY = event.button.y;
    142             int wH = GraphicsEngine::getInstance()->getResolutionY();
    143             int wW = GraphicsEngine::getInstance()->getResolutionX();
    144             Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
    145             p1 = tmpV-M;
    146             p1.y = -p1.y;
    147 
     138            movement[0] = event.button.x;
     139            movement[1] = event.button.y;
     140            movement[2] = 0;
     141            movement[3] = 0;
     142            printf("test %d %d\n", movement[0], movement[1]);
     143            /*
     144              int mX = event.button.x;
     145              int mY = event.button.y;
     146              int wH = GraphicsEngine::getInstance()->getResolutionY();
     147              int wW = GraphicsEngine::getInstance()->getResolutionX();
     148              Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
     149              p1 = tmpV-M;
     150              p1.y = -p1.y;
     151            */
    148152          }
    149153        else
     
    151155            PRINTF(0)("MouseButton %d pressed at (%d,%d).\n",
    152156                   event.button.button, event.button.x, event.button.y);
    153             rotatorV = ( (float)GraphicsEngine::getInstance()->getResolutionY()/2 -event.button.x) / (float)GraphicsEngine::getInstance()->getResolutionY() / 100.0;
    154157          }
    155158           
     
    181184            break;
    182185          case SDLK_a:
    183             zoomTo /=2;
     186            //zoomTo /=2;
    184187            break;
    185188          case SDLK_z:
    186             zoomTo *=2;
    187 
     189            //zoomTo *=2;
     190            break;
    188191          }
    189192        break;
     
    210213
    211214
    212  Framework::Framework()
     215Framework::Framework()
    213216{
    214217
     
    219222 
    220223
    221   M = Vector(GraphicsEngine::getInstance()->getResolutionY()/2, GraphicsEngine::getInstance()->getResolutionX()/2, 0);
    222   rotAxis = Vector (0.0,1.0,0.0);
    223   rotAngle = 0;
    224 
    225   matQ[0][0] = matQ[1][1] = matQ[2][2] = matQ[3][3] = 1;
    226   rotQ = Quaternion (rotAngle, rotAxis);
    227   rotQlast = rotQ;
    228   dir = Vector (0.0, 0.0, 1.0);
    229   up = Vector (0.0, 1.0, 0.0);
    230 
    231   glEnable(GL_LIGHTING);
    232   glEnable(GL_DEPTH_TEST);
    233 
    234   GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0};
    235   GLfloat light0Position[] = {10.0, 10.0, 10.0, 0.0};
    236   GLfloat light1Position[] = {-10.0, -7.0, -6.0, 0.0};
    237   GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0};
    238 
    239   glEnable(GL_LIGHT0);
    240   glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
    241   glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
    242   glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
    243  
    244   glEnable(GL_LIGHT1);
    245   glLightfv(GL_LIGHT1, GL_POSITION, light1Position);
    246   glLightfv(GL_LIGHT1, GL_DIFFUSE, whiteLight);
    247   glLightfv(GL_LIGHT1, GL_SPECULAR, whiteLight);
    248  
    249 
     224  LightManager::getInstance();
    250225  glEnable(GL_TEXTURE_2D);
    251   rotatorP = .0;
    252   rotatorV = .0;
    253   dist = 5.0;
    254   zoomTo = dist;
     226
    255227  // Build the font from a TGA image font.tga in the data directory
    256228  // Hide the mouse cursor
     
    260232  ResourceManager::getInstance()->setDataDir(DATA_DIRECTORY);
    261233 
    262     // Creating a Test Particle System
     234  // Creating a Test Particle System
    263235  ParticleSystem* system = new ParticleSystem(100000, PARTICLE_SPRITE);
    264236  system->setLifeSpan(5);
    265   system->setConserve(1);
     237  system->setConserve(.99);
    266238  system->setRadius(4, 3, 1, 2);
    267239  system->setColor(.5,0,0,.5, 1,1,0,1, 0,0,0,0);
    268240
    269241  // Creating a Test Particle Emitter
    270   ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 1, 0), 0, 100, .01);
     242  ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 1, 0), M_PI_4, 20, .1);
    271243  emitter->setType(EMITTER_DOT  );
    272244  emitter->setSize(0);
  • orxonox/branches/physics/src/subprojects/particles/framework.h

    r4297 r4300  
    1313 private:
    1414  Camera* camera;
    15   float rotatorP;
    16   float rotatorV;
    1715 
    18   float dist;
    19   float zoomTo;
     16  int movement [4];
    2017 
    2118  Uint32 lastFrame;
    2219  Uint32 currFrame;
    23  
    24   Vector dir;
    25   Vector up;
    26  
    27   float matQ[4][4];
    28  
    29   Vector M;
    30   Vector p1;
    31   Vector p2;
    32   Vector rotAxis;
    33   float rotAngle;
    34   Quaternion rotQ;
    35   Quaternion rotQlast;
    36  
     20   
    3721  Uint8* keys; // This variable will be used in the keyboard routine
    3822  bool mouse1Down;
     23  bool mouse2Down;
    3924
    4025 public:
Note: See TracChangeset for help on using the changeset viewer.