Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3419 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Feb 22, 2005, 6:26:03 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: copied dave's SkySphere into the Trunk
done it with svn copy, and implemented the Class into the world.cc
it works perfectly

Location:
orxonox/trunk/src
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r3396 r3419  
    3737                 matrix.cc \
    3838                 curve.cc \
    39                  glmenu_imagescreen.cc
     39                 glmenu_imagescreen.cc \
     40                 skysphere.cc
    4041
    4142
     
    7980                 curve.h \
    8081                 glmenu_imagescreen.h \
    81                  debug.h
     82                 debug.h \
     83                 skysphere.h
    8284
    8385
  • orxonox/trunk/src/Makefile.in

    r3396 r3419  
    6464        base_object.$(OBJEXT) helper_parent.$(OBJEXT) \
    6565        track_manager.$(OBJEXT) matrix.$(OBJEXT) curve.$(OBJEXT) \
    66         glmenu_imagescreen.$(OBJEXT)
     66        glmenu_imagescreen.$(OBJEXT) skysphere.$(OBJEXT)
    6767orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    6868orxonox_LDADD = $(LDADD)
     
    8585@AMDEP_TRUE@    ./$(DEPDIR)/null_parent.Po ./$(DEPDIR)/objModel.Po \
    8686@AMDEP_TRUE@    ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/p_node.Po \
    87 @AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/story_entity.Po \
    88 @AMDEP_TRUE@    ./$(DEPDIR)/texture.Po ./$(DEPDIR)/track.Po \
    89 @AMDEP_TRUE@    ./$(DEPDIR)/track_manager.Po ./$(DEPDIR)/vector.Po \
    90 @AMDEP_TRUE@    ./$(DEPDIR)/world.Po ./$(DEPDIR)/world_entity.Po
     87@AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/skysphere.Po \
     88@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \
     89@AMDEP_TRUE@    ./$(DEPDIR)/track.Po ./$(DEPDIR)/track_manager.Po \
     90@AMDEP_TRUE@    ./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \
     91@AMDEP_TRUE@    ./$(DEPDIR)/world_entity.Po
    9192CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    9293        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     
    238239                 matrix.cc \
    239240                 curve.cc \
    240                  glmenu_imagescreen.cc
     241                 glmenu_imagescreen.cc \
     242                 skysphere.cc
    241243
    242244noinst_HEADERS = ability.h \
     
    279281                 curve.h \
    280282                 glmenu_imagescreen.h \
    281                  debug.h
     283                 debug.h \
     284                 skysphere.h
    282285
    283286EXTRA_DIST = orxonox.conf
     
    384387@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
    385388@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
     389@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
    386390@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
    387391@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
  • orxonox/trunk/src/skysphere.cc

    r3416 r3419  
    3434/**
    3535   \brief Standart Constructor
    36    \todo second Constructor with char* input for different skies
    3736*/
    3837Skysphere::Skysphere()
    3938
    40     //GLUquadricObj *sphereObj=0;
    41     sphereObj=gluNewQuadric();
    42     gluQuadricTexture(sphereObj,GL_TRUE);
    43     sky = new Material("Sky");
    44     sky->setDiffuseMap("../data/pictures/sky-replace.jpg");
    45     sky->setIllum(3);
    46     //    sky->setAmbient(1,1,1);
     39  initialize("../data/pictures/sky-replace.jpg");
     40}
    4741
     42/**
     43   \brief Constructs a SkySphere and takes fileName as a map.
     44   \param fileName the file to take as input for the skysphere
     45*/
     46Skysphere::Skysphere(char* fileName)
     47{
     48  initialize(fileName);
    4849}
    4950
     
    5354Skysphere::~Skysphere()
    5455{
    55     delete sky;
    56     delete sphereObj;
     56  delete sky;
     57  free(sphereObj);
     58}
    5759
     60/**
     61   \brief initializes the Skysphere.
     62   \param fileName the file to take as input for the skysphere
     63*/
     64void Skysphere::initialize(char* fileName)
     65{
     66  sphereObj=gluNewQuadric();
     67  gluQuadricTexture(sphereObj,GL_TRUE);
     68  sky = new Material("Sky");
     69  sky->setDiffuseMap(fileName);
     70  sky->setIllum(3);
     71  sky->setAmbient(.5, .5, 1.0);
    5872}
    5973
     
    6377   \param y the y-coordinate of the Center of the Sphere
    6478   \param z the z-coordinate of the Center of the Sphere
    65 
     79   
    6680   This is normally done in the update-phase of world, so the Skysphere is always centered at the Camera.
    6781*/
    68 void Skysphere::updatePosition(float x,float y,float z)
     82void Skysphere::updatePosition(Vector sphereCenter)
    6983{
    70     this->a=x;
    71     this->b=y;
    72     this->c=z;
     84  this->sphereCenter = sphereCenter;
    7385}
    7486
    7587/**
    7688   \brief draws the Skysphere
    77 
     89   
    7890   This part is normally precessed in the "Painting Phase".
    7991*/
    80    
     92
    8193void Skysphere::draw()
    8294{
    83     sky->select();
    84     glPushMatrix();
    85     glTranslatef(this->a,this->b,this->c);
    86    
    87     glRotatef(-30,1,0,0);
    88     glRotatef(95.0f,0.0f,0.0f,1.0f);
    89     glRotatef(-250.0f,0.0,1.0f,0.0f);
    90    
    91     gluSphere(sphereObj,200.0f,20,20);
    92     glPopMatrix();
    93 
    94 
     95  sky->select();
     96  glPushMatrix();
     97  glTranslatef(this->sphereCenter.x,this->sphereCenter.y,this->sphereCenter.z);
     98 
     99  glRotatef(-30,1,0,0);
     100  glRotatef(95.0f,0.0f,0.0f,1.0f);
     101  glRotatef(-250.0f,0.0,1.0f,0.0f);
     102 
     103  gluSphere(sphereObj,200.0f,20,20);
     104  glPopMatrix();
    95105}
    96106
  • orxonox/trunk/src/skysphere.h

    r3416 r3419  
    1313#define _SKYSPHERE_H
    1414
     15/* INCLUDES */
     16#include "p_node.h"
    1517
    16 #include "importer/material.h"
    17 #include "p_node.h"
    18 #include "world_entity.h"
     18/* FORWARD DEFINITION */
     19class Material;
     20class Vector;
    1921
    2022//! A Class to handle a SkySphere
    2123class Skysphere: public PNode
    2224{
    23 
    24 
    2525 private:
    2626  GLUquadricObj *sphereObj;
    27   float a,b,c;       //!< Parameters to hold the Position of the SkySphere
    28   Material *sky;     //!< A Material for the Sky
    29  
     27  Vector sphereCenter; //!< Center of the Skysphere
     28  Material *sky;       //!< A Material for the Sky
    3029 
    3130 public:
    3231  Skysphere();
     32  Skysphere(char* fileName);
    3333  ~Skysphere();
    34  
    35  
    36  
    37  
    38   void updatePosition(float x,float y,float z);
     34
     35  void updatePosition(Vector sphereCenter);
    3936  void draw();
    40  
    41    
    42    
    43    
    44    
     37
     38 private:
     39  void initialize(char* fileName); 
    4540};
    4641
  • orxonox/trunk/src/world.cc

    r3370 r3419  
    2828#include "helper_parent.h"
    2929#include "glmenu_imagescreen.h"
     30#include "skysphere.h"
    3031
    3132using namespace std;
     
    292293            this->localPlayer->addChild (this->localCamera);
    293294
     295            // Create SkySphere
     296            skySphere = new Skysphere("../data/pictures/sky-replace.jpg");
     297
    294298            /*monitor progress*/
    295299            this->glmis->step();
     
    631635  // draw debug coord system
    632636  glCallList (objectList);
     637
     638  //! \todo skysphere is a WorldEntity and should be inside of the world-entity-list.
     639  skySphere->draw();
    633640
    634641}
     
    712719    }
    713720
     721  skySphere->updatePosition(localCamera->absCoordinate);
    714722  //for( int i = 0; i < tracklen; i++) track[i].tick (seconds);
    715723}
  • orxonox/trunk/src/world.h

    r3365 r3419  
    1717class PNode;
    1818class GLMenuImageScreen;
     19class Skysphere;
    1920
    2021//! The game environment
     
    7980  GLuint objectList;
    8081  SDL_Surface *loadImage;
     82  Skysphere* skySphere;
    8183
    8284  WorldEntity* localPlayer;
Note: See TracChangeset for help on using the changeset viewer.