Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10643 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Apr 29, 2007, 6:51:28 PM (18 years ago)
Author:
bknecht
Message:

improvements by landauf on bsp, rotor and wireframe (does build, should work)

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/graphics_engine.cc

    r10618 r10643  
    480480void GraphicsEngine::wireframe()
    481481{
    482   glPolygonMode(GL_FRONT, GL_LINE);
     482  State::showWireframe(!State::showWireframe());
     483  /*
     484   if (State::showWireframe()){}
     485       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
     486   else
     487       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
     488  */
    483489}
    484490
  • trunk/src/lib/graphics/importer/bsp/bsp_manager.cc

    r10618 r10643  
    504504    //  glDisable(GL_BLEND);
    505505  }
     506 
     507  if (State::showWireframe())
     508  {
     509    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
     510    glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap );
     511    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
     512  }
    506513
    507514  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    508515
    509   // glColor4f(3.0,3.0,3.0,1.0);
    510516  glEnableClientState(GL_VERTEX_ARRAY );
    511517  glEnableClientState(GL_TEXTURE_COORD_ARRAY );
     
    536542  glDisableClientState(GL_NORMAL_ARRAY );
    537543  // glDisableClientState(GL_COLOR_ARRAY);
    538 
     544 
     545  if (State::showWireframe())
     546  {
     547    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
     548    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
     549  }
    539550}
    540551
     
    592603  if (Face->effect != -1) return;
    593604
    594 
    595605  if(Face->lm_index < 0) {
    596606    glActiveTextureARB(GL_TEXTURE1_ARB);
     
    602612    glEnable(GL_TEXTURE_2D);
    603613  }
    604   //glColor4f(3.0,3.0,3.0,1.0);
     614 
     615  if (State::showWireframe())
     616  {
     617    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
     618    glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap );
     619    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
     620  }
     621
    605622
    606623  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     
    646663  glDisableClientState(GL_VERTEX_ARRAY );
    647664  glDisableClientState(GL_TEXTURE_COORD_ARRAY );
    648 
    649 
     665 
     666  if (State::showWireframe())
     667  {
     668    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
     669    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
     670  }
    650671}
    651672
  • trunk/src/util/state.cc

    r10618 r10643  
    5252
    5353bool State::bOnline = false;
     54bool State::bWireframe = false;
    5455
    5556int State::menuID = -1;
  • trunk/src/util/state.h

    r10379 r10643  
    9393  /** @returns the local player*/
    9494  static inline Player* getPlayer() { return State::player; };
     95  /** @param sets wireframemode */
     96  static inline void showWireframe(bool wireframe) { State::bWireframe = wireframe; }
     97  /** @retirms the wireframemode */
     98  static inline bool showWireframe() { return State::bWireframe; }
    9599
    96100
     
    151155  static int                    menuID;            //!< -1 on default, otherwise orxonox's Menu ID
    152156  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
     157 
     158  static bool                   bWireframe;        //!< The Wireframemode
    153159  };
    154160
  • trunk/src/world_entities/environments/rotor.cc

    r10554 r10643  
    5656void Rotor::initRotation(float x, float y, float z)
    5757{
     58     this->updateNode(0.001);
    5859     this->mainDir = this->getAbsDir();
    5960     this->rotation = Vector(x,y,z);
     
    7172
    7273
    73      this->setAbsDir(/*this->mainDir**/Quaternion(rotation.x*this->totalTime, Vector(1,0,0)) *
     74     this->setAbsDir(this->mainDir*Quaternion(rotation.x*this->totalTime, Vector(1,0,0)) *
    7475                    Quaternion(rotation.y*this->totalTime, Vector(0,1,0)) *
    7576                    Quaternion(rotation.z*this->totalTime, Vector(0,0,1)));
  • trunk/src/world_entities/npcs/mover.cc

    r10618 r10643  
    8282        .describe("sets the action time of the door")
    8383        .defaultValues(1.0);
     84    LoadParam(root, "stay-open-time", this, Mover, setStayOpenTime)
     85        .describe("sets the time, the door must stay open")
     86        .defaultValues(0.0);
    8487    LoadParam(root, "opening-sound", this, Mover, setOpeningSoundFile)
    8588        .describe("Sets the file of the opening sound source");
     
    146149                this->soundSource_moving.stop();
    147150        }
     151        this->openTime = 0;
    148152    }
    149153    else if (this->state == Open)
    150154    {
    151         if (!this->checkPlayerInActionRadius())
    152         {
    153             this->state = Closing;
    154             if (this->soundBuffer_closing.loaded())
    155                 this->soundSource_starting.play(this->soundBuffer_closing);
    156             if (this->soundBuffer_moving.loaded())
    157                 this->soundSource_moving.play(this->soundBuffer_moving, 1.0, true);
     155        this->openTime += dt;
     156        if (this->openTime >= this->stayOpenTime)
     157        {
     158            if (!this->checkPlayerInActionRadius())
     159            {
     160                this->state = Closing;
     161                if (this->soundBuffer_closing.loaded())
     162                    this->soundSource_starting.play(this->soundBuffer_closing);
     163                if (this->soundBuffer_moving.loaded())
     164                    this->soundSource_moving.play(this->soundBuffer_moving, 1.0, true);
     165            }
    158166        }
    159167    }
  • trunk/src/world_entities/npcs/mover.h

    r10487 r10643  
    3535        void setActionRadius(float radius) { this->actionRadius = radius; }
    3636        void setActionTime(float time) { this->actionTime = time; }
     37        void setStayOpenTime(float time) { this->stayOpenTime = time; }
    3738        void setOpeningSoundFile(const std::string& fileName);
    3839        void setOpenedSoundFile(const std::string& fileName);
     
    6263        float                       actionTime;                 //!< the action-time
    6364        int                         state;                      //!< the state of the mover
     65        float                       stayOpenTime;               //!< waiting time while opened
     66        float                       openTime;                   //!< time since opened
    6467};
    6568
Note: See TracChangeset for help on using the changeset viewer.