Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3759 in orxonox.OLD


Ignore:
Timestamp:
Apr 8, 2005, 1:45:12 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/convention: new functions for the Test-Material, only works in the second level

Location:
orxonox/branches/convention/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/convention/src/story_entities/world.cc

    r3758 r3759  
    10431043  else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP);
    10441044
    1045   else if( !strcmp( cmd->cmd, "function1")) printf("pressed h\n");
    1046   else if( !strcmp( cmd->cmd, "function2")) printf("pressed j\n"); 
    1047   else if( !strcmp( cmd->cmd, "function3")) printf("pressed k\n");
    1048   else if( !strcmp( cmd->cmd, "function4")) printf("pressed l\n"); 
    1049   else if( !strcmp( cmd->cmd, "function5")) printf("pressed n\n");
    1050   else if( !strcmp( cmd->cmd, "function6")) printf("pressed m\n"); 
     1045  else if( !strcmp( cmd->cmd, "function1")) testMat->enable();
     1046  else if( !strcmp( cmd->cmd, "function2")) testMat->changeIllum(); 
     1047  else if( !strcmp( cmd->cmd, "function3")) testMat->raiseAmbient();
     1048  else if( !strcmp( cmd->cmd, "function4")) testMat->randColor();
     1049  else if( !strcmp( cmd->cmd, "function5")) testMat->enableTexture();
     1050  else if( !strcmp( cmd->cmd, "function6")) testMat->raiseShiny(); 
    10511051 
    10521052  return false;
  • orxonox/branches/convention/src/world_entities/test_mat.cc

    r3756 r3759  
    4040        this->model4 = (Model*)ResourceManager::getInstance()->load("cone", PRIM, RP_LEVEL);
    4141   */
    42    this->model1 = new PrimitiveModel(SPHERE);
     42   this->model1 = new PrimitiveModel(SPHERE, 2, 50);
    4343   this->model2 = new PrimitiveModel(CUBE);
    44    this->model3 = new PrimitiveModel(CONE);
    45    this->model4 = new PrimitiveModel(CYLINDER);
     44   this->model3 = new PrimitiveModel(CONE, 1, 50);
     45   this->model4 = new PrimitiveModel(CYLINDER, 1, 50);
    4646   this->mat1 = new Material();
    4747   this->mat2 = new Material();
     
    5050   
    5151   this->enabled = false;
     52   illum = 0;
     53   shiny = 1.0;
     54
     55}
     56
     57void TestMat::changeIllum()
     58{
     59  illum++;
     60 
     61  if (illum >3)
     62    illum = 0;
     63
     64  mat1->setIllum(illum);
     65}
     66
     67void TestMat::raiseAmbient()
     68{
     69  this->ambient+=.1;
     70  if (this->ambient > 1)
     71    ambient = 0;
     72  mat1->setAmbient(ambient,ambient,ambient);
     73}
     74
     75void TestMat::raiseShiny()
     76{
     77  this->shiny *= 2.0;
     78  if (this->shiny > 200)
     79    shiny = 2;
     80  printf("shiniess changed to %d\n", shiny);
     81  mat1->setShininess(shiny);
     82}
     83
     84void TestMat::randColor()
     85{
     86  mat1->setDiffuse((float)random()/(float)RAND_MAX,(float)random()/(float)RAND_MAX,(float)random()/(float)RAND_MAX);
     87  mat1->setSpecular((float)random()/(float)RAND_MAX,(float)random()/(float)RAND_MAX,(float)random()/(float)RAND_MAX);
     88}
     89
     90void TestMat::enableTexture()
     91{
     92  mat1->setDiffuseMap("../data/pictures/load_screen.jpg");
    5293}
    5394
    5495void TestMat::enable()
    5596{
    56   this->enabled = true;
     97  if (!enabled)
     98    {
     99      this->enabled = true;
     100     
     101      LightManager* tmpLM = LightManager::getInstance();
     102      tmpLM->addLight();
     103      tmpLM->setPosition(-50, 5, -3);
     104      tmpLM->addLight();
     105      tmpLM->setPosition(50, -10, 5);
     106      glDisable(GL_LIGHT0);
     107     
     108    }
    57109}
    58110
     
    72124    {
    73125      glPushMatrix();
     126      glTranslatef(0,-1,0);
    74127      this->mat1->select();
    75128      this->model1->draw();
    76129     
    77130      glTranslatef(0,0,2);
    78       this->mat2->select();
     131      //      this->mat2->select();
    79132      this->model2->draw();
    80133     
    81134      glTranslatef(0,2,-2);
    82       this->mat3->select();
     135      //      this->mat3->select();
    83136      this->model3->draw();
    84137     
    85138      glTranslatef(0,0,2);
    86       this->mat4->select();
     139      //      this->mat4->select();
    87140      this->model4->draw();
    88141      glPopMatrix();
  • orxonox/branches/convention/src/world_entities/test_mat.h

    r3756 r3759  
    3131
    3232  void enable();
     33  void changeIllum();
     34  void raiseAmbient();
     35  void raiseShiny();
     36  void randColor();
     37  void enableTexture();
     38
    3339
    3440  virtual void draw();
     
    4046 
    4147  bool enabled;
    42 
     48  int illum;
     49  float ambient;
     50  float shiny;
    4351};
    4452
Note: See TracChangeset for help on using the changeset viewer.