- Timestamp:
- Apr 8, 2005, 1:45:12 AM (20 years ago)
- Location:
- orxonox/branches/convention/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/convention/src/story_entities/world.cc
r3758 r3759 1043 1043 else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP); 1044 1044 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(); 1051 1051 1052 1052 return false; -
orxonox/branches/convention/src/world_entities/test_mat.cc
r3756 r3759 40 40 this->model4 = (Model*)ResourceManager::getInstance()->load("cone", PRIM, RP_LEVEL); 41 41 */ 42 this->model1 = new PrimitiveModel(SPHERE );42 this->model1 = new PrimitiveModel(SPHERE, 2, 50); 43 43 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); 46 46 this->mat1 = new Material(); 47 47 this->mat2 = new Material(); … … 50 50 51 51 this->enabled = false; 52 illum = 0; 53 shiny = 1.0; 54 55 } 56 57 void TestMat::changeIllum() 58 { 59 illum++; 60 61 if (illum >3) 62 illum = 0; 63 64 mat1->setIllum(illum); 65 } 66 67 void TestMat::raiseAmbient() 68 { 69 this->ambient+=.1; 70 if (this->ambient > 1) 71 ambient = 0; 72 mat1->setAmbient(ambient,ambient,ambient); 73 } 74 75 void 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 84 void 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 90 void TestMat::enableTexture() 91 { 92 mat1->setDiffuseMap("../data/pictures/load_screen.jpg"); 52 93 } 53 94 54 95 void TestMat::enable() 55 96 { 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 } 57 109 } 58 110 … … 72 124 { 73 125 glPushMatrix(); 126 glTranslatef(0,-1,0); 74 127 this->mat1->select(); 75 128 this->model1->draw(); 76 129 77 130 glTranslatef(0,0,2); 78 this->mat2->select();131 // this->mat2->select(); 79 132 this->model2->draw(); 80 133 81 134 glTranslatef(0,2,-2); 82 this->mat3->select();135 // this->mat3->select(); 83 136 this->model3->draw(); 84 137 85 138 glTranslatef(0,0,2); 86 this->mat4->select();139 // this->mat4->select(); 87 140 this->model4->draw(); 88 141 glPopMatrix(); -
orxonox/branches/convention/src/world_entities/test_mat.h
r3756 r3759 31 31 32 32 void enable(); 33 void changeIllum(); 34 void raiseAmbient(); 35 void raiseShiny(); 36 void randColor(); 37 void enableTexture(); 38 33 39 34 40 virtual void draw(); … … 40 46 41 47 bool enabled; 42 48 int illum; 49 float ambient; 50 float shiny; 43 51 }; 44 52
Note: See TracChangeset
for help on using the changeset viewer.