Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8089 in orxonox.OLD


Ignore:
Timestamp:
Jun 1, 2006, 5:24:57 PM (18 years ago)
Author:
stefalie
Message:

water: gui hack

Location:
branches/water/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/lib/graphics/importer/material.cc

    r8037 r8089  
    103103 * @brief sets the material with which the following Faces will be painted
    104104 */
    105 bool Material::select() const
     105  bool Material::select() const
    106106{
    107107  if (unlikely(this == Material::selectedMaterial))
  • branches/water/src/lib/graphics/importer/texture.cc

    r7790 r8089  
    115115
    116116
    117 Texture::Texture(GLenum target)
     117Texture::Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type)
    118118{
    119119  this->init();
    120   GLuint texture;
     120  GLuint texture = 0;
    121121  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
    122140  this->data->setTexture(texture);
    123141}
     
    346364  //  printf("%s, w:%d h:%d, 0x%x\n", this->getName(), surface->w, surface->h, target);
    347365
     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
    348370  // build the MipMaps automaticaly
    349371  errorCode = gluBuild2DMipmaps(target, format,
     
    372394  glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    373395
    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  
    5050  Texture();
    5151  Texture(const Texture& texture);
    52   Texture(GLenum target);
     52  Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type);
    5353  Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);
    5454  Texture(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
  • branches/water/src/lib/gui/gl_gui/glgui_cursor.cc

    r8035 r8089  
    3232    this->init();
    3333
    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);
    3636
    3737
  • branches/water/src/lib/gui/gl_gui/glgui_handler.cc

    r8035 r8089  
    4040
    4141
    42     EventHandler::getInstance()->withUNICODE(ES_MENU, true );
     42    EventHandler::getInstance()->withUNICODE(ES_ALL, true );
    4343
    4444    this->cursor = NULL;
    4545    for (unsigned int i = 0; i < EV_NUMBER; i++)
    4646    {
    47       this->subscribeEvent(ES_MENU, i);
     47      this->subscribeEvent(ES_ALL, i);
    4848    }
    4949  }
  • branches/water/src/lib/gui/gl_gui/glgui_widget.cc

    r8035 r8089  
    204204
    205205
     206
    206207  void GLGuiWidget::hide()
    207208  {
  • branches/water/src/lib/gui/gl_gui/glgui_widget.h

    r8035 r8089  
    4242    void show();
    4343    void hide();
    44 
    4544
    4645    void setParentWidget(GLGuiWidget* parent);
  • branches/water/src/story_entities/game_world.cc

    r8037 r8089  
    107107
    108108
     109
     110
     111/// HACK only for testing.
     112void 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"
     145void 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
     167int 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
    109191/**
    110192 * loads the parameters of a GameWorld from an XML-element
     
    225307  PRINTF(3)("GameWorld::stop() - got stop signal\n");
    226308  this->bRunning = false;
     309 
     310  OrxGui::GLGuiHandler::getInstance()->deactivateCursor(true);
     311  delete OrxGui::GLGuiHandler::getInstance();
    227312}
    228313
     
    256341{
    257342  PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n");
     343
     344  this->enterGui();
     345
    258346
    259347  // initialize Timing
     
    387475    if( likely(this->dataTank->gameRule != NULL))
    388476      this->dataTank->gameRule->tick(this->dtS);
     477     
     478     
     479    OrxGui::GLGuiHandler::getInstance()->tick(this->dtS);
     480
    389481  }
    390482}
     
    446538  this->renderPassReflection();
    447539  // redner the refraction texture
    448   this->renderPassRefraction();
     540  //this->renderPassRefraction();
    449541  // render all
    450542  this->renderPassAll();
     
    559651  AtmosphericEngine::getInstance()->draw();
    560652
    561   //glEnable(GL_DEPTH_TEST);
    562   //glEnable(GL_LIGHTING);
     653  glEnable(GL_DEPTH_TEST);
     654  glEnable(GL_LIGHTING);
    563655
    564656  // set camera
  • branches/water/src/story_entities/game_world.h

    r7919 r8089  
    1111#include "game_world_data.h"
    1212#include "playable.h"
     13
     14#include "glgui.h"
    1315
    1416namespace OrxShell { class Shell; };
     
    3234    GameWorld ();
    3335    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/////////////////////////////
    3444
    3545    virtual void loadParams(const TiXmlElement* root);
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8037 r8089  
    207207  glViewport(0,0, textureSize, textureSize);
    208208
     209  glMatrixMode(GL_MODELVIEW);
    209210  glPushMatrix();
    210211
     
    261262  glViewport(0,0, textureSize, textureSize);
    262263
     264  glMatrixMode(GL_MODELVIEW);
    263265  glPushMatrix();
    264266
Note: See TracChangeset for help on using the changeset viewer.