Changeset 8089 in orxonox.OLD for branches/water
- Timestamp:
- Jun 1, 2006, 5:24:57 PM (18 years ago)
- Location:
- branches/water/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/lib/graphics/importer/material.cc
r8037 r8089 103 103 * @brief sets the material with which the following Faces will be painted 104 104 */ 105 bool Material::select() const105 bool Material::select() const 106 106 { 107 107 if (unlikely(this == Material::selectedMaterial)) -
branches/water/src/lib/graphics/importer/texture.cc
r7790 r8089 115 115 116 116 117 Texture::Texture(GLenum target )117 Texture::Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type) 118 118 { 119 119 this->init(); 120 GLuint texture ;120 GLuint texture = 0; 121 121 Texture::generateTexture(texture, target); 122 123 glBindTexture(target, texture); 124 125 unsigned int* pixels = new unsigned int[width * height * channels]; 126 memset(pixels, 0, width * height * channels * sizeof(unsigned int)); 127 128 129 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); 130 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 131 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 132 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 133 134 glTexImage2D(target, 0, channels, width, height, 0, type, GL_UNSIGNED_INT, pixels); 135 136 137 138 delete[] pixels; 139 122 140 this->data->setTexture(texture); 123 141 } … … 346 364 // printf("%s, w:%d h:%d, 0x%x\n", this->getName(), surface->w, surface->h, target); 347 365 366 /* control the mipmap levels */ 367 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5); 368 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 369 348 370 // build the MipMaps automaticaly 349 371 errorCode = gluBuild2DMipmaps(target, format, … … 372 394 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 373 395 374 /* control the mipmap levels */ 375 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5); 376 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 377 } 396 } -
branches/water/src/lib/graphics/importer/texture.h
r7790 r8089 50 50 Texture(); 51 51 Texture(const Texture& texture); 52 Texture(GLenum target );52 Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type); 53 53 Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D); 54 54 Texture(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D); -
branches/water/src/lib/gui/gl_gui/glgui_cursor.cc
r8035 r8089 32 32 this->init(); 33 33 34 this->subscribeEvent(ES_ MENU, EV_MOUSE_MOTION);35 this->subscribeEvent(ES_ MENU, EV_WINDOW_FOCUS);34 this->subscribeEvent(ES_ALL, EV_MOUSE_MOTION); 35 this->subscribeEvent(ES_ALL, EV_WINDOW_FOCUS); 36 36 37 37 -
branches/water/src/lib/gui/gl_gui/glgui_handler.cc
r8035 r8089 40 40 41 41 42 EventHandler::getInstance()->withUNICODE(ES_ MENU, true );42 EventHandler::getInstance()->withUNICODE(ES_ALL, true ); 43 43 44 44 this->cursor = NULL; 45 45 for (unsigned int i = 0; i < EV_NUMBER; i++) 46 46 { 47 this->subscribeEvent(ES_ MENU, i);47 this->subscribeEvent(ES_ALL, i); 48 48 } 49 49 } -
branches/water/src/lib/gui/gl_gui/glgui_widget.cc
r8035 r8089 204 204 205 205 206 206 207 void GLGuiWidget::hide() 207 208 { -
branches/water/src/lib/gui/gl_gui/glgui_widget.h
r8035 r8089 42 42 void show(); 43 43 void hide(); 44 45 44 46 45 void setParentWidget(GLGuiWidget* parent); -
branches/water/src/story_entities/game_world.cc
r8037 r8089 107 107 108 108 109 110 111 /// HACK only for testing. 112 void GameWorld::enterGui() 113 { 114 OrxGui::GLGuiBox* imageSelector = new OrxGui::GLGuiBox(); 115 { 116 image = new OrxGui::GLGuiImage(); 117 image->setWidgetSize(300, 300); 118 image->setAbsCoor2D(300, 300); 119 imageSelector->pack(image); 120 121 imageName = new OrxGui::GLGuiInputLine(); 122 imageSelector->pack(imageName); 123 124 OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider(); 125 slider->setWidgetSize(200, 30); 126 slider->setRange(0, 200); 127 slider->setStep(1); 128 129 130 slider->setValue(slider->min()); 131 slider->connect(SIGNAL(slider, valueChanged), this, SLOT(GameWorld, setImage)); 132 133 imageSelector->pack(slider); 134 slider->setValue(getImage("/home/stefalie/svn/orxonox/data/trunk/pictures/dudvmap.bmp")); 135 } 136 imageSelector->showAll(); 137 imageSelector->setAbsCoor2D(400, 30); 138 OrxGui::GLGuiHandler::getInstance()->activateCursor(); 139 140 ///// 141 } 142 143 144 #include "class_list.h" 145 void GameWorld::setImage(int i) 146 { 147 const std::list<BaseObject*>* textures = ClassList::getList(CL_TEXTURE); 148 149 if(textures) 150 { 151 std::list<BaseObject*>::const_iterator test = textures->begin(); 152 std::list<BaseObject*>::const_iterator lastOK = textures->begin(); 153 while (true) 154 { 155 if (--i == 0 || test == textures->end()) 156 break; 157 if (dynamic_cast<Texture*>(*test)->getTexture() != 0) 158 lastOK = test; 159 test++; 160 } 161 this->image->loadImageFromTexture(*dynamic_cast<Texture*>(*lastOK)); 162 this->imageName->setText((*lastOK)->getName()); 163 printf(">>>>> %d\n", dynamic_cast<Texture*>(*lastOK)->getTexture()); 164 } 165 } 166 167 int GameWorld::getImage(const std::string& name) 168 { 169 const std::list<BaseObject*>* textures = ClassList::getList(CL_TEXTURE); 170 171 172 if(textures) 173 { 174 int number = 0; 175 std::list<BaseObject*>::const_iterator test = textures->begin(); 176 std::list<BaseObject*>::const_iterator lastOK = textures->begin(); 177 while (true) 178 { 179 if (test == textures->end()) 180 return 0; 181 if ((*test)->getName() == name) 182 return number; 183 number++; 184 test++; 185 } 186 } 187 } 188 189 190 109 191 /** 110 192 * loads the parameters of a GameWorld from an XML-element … … 225 307 PRINTF(3)("GameWorld::stop() - got stop signal\n"); 226 308 this->bRunning = false; 309 310 OrxGui::GLGuiHandler::getInstance()->deactivateCursor(true); 311 delete OrxGui::GLGuiHandler::getInstance(); 227 312 } 228 313 … … 256 341 { 257 342 PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n"); 343 344 this->enterGui(); 345 258 346 259 347 // initialize Timing … … 387 475 if( likely(this->dataTank->gameRule != NULL)) 388 476 this->dataTank->gameRule->tick(this->dtS); 477 478 479 OrxGui::GLGuiHandler::getInstance()->tick(this->dtS); 480 389 481 } 390 482 } … … 446 538 this->renderPassReflection(); 447 539 // redner the refraction texture 448 this->renderPassRefraction();540 //this->renderPassRefraction(); 449 541 // render all 450 542 this->renderPassAll(); … … 559 651 AtmosphericEngine::getInstance()->draw(); 560 652 561 //glEnable(GL_DEPTH_TEST);562 //glEnable(GL_LIGHTING);653 glEnable(GL_DEPTH_TEST); 654 glEnable(GL_LIGHTING); 563 655 564 656 // set camera -
branches/water/src/story_entities/game_world.h
r7919 r8089 11 11 #include "game_world_data.h" 12 12 #include "playable.h" 13 14 #include "glgui.h" 13 15 14 16 namespace OrxShell { class Shell; }; … … 32 34 GameWorld (); 33 35 virtual ~GameWorld (); 36 37 //// HACK NOT TO THE TRUNK // 38 void enterGui(); 39 void setImage(int i); 40 int getImage(const std::string& name); 41 OrxGui::GLGuiImage* image; 42 OrxGui::GLGuiInputLine* imageName; 43 ///////////////////////////// 34 44 35 45 virtual void loadParams(const TiXmlElement* root); -
branches/water/src/world_entities/environments/mapped_water.cc
r8037 r8089 207 207 glViewport(0,0, textureSize, textureSize); 208 208 209 glMatrixMode(GL_MODELVIEW); 209 210 glPushMatrix(); 210 211 … … 261 262 glViewport(0,0, textureSize, textureSize); 262 263 264 glMatrixMode(GL_MODELVIEW); 263 265 glPushMatrix(); 264 266
Note: See TracChangeset
for help on using the changeset viewer.