Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3419 in orxonox.OLD for orxonox/trunk/src/skysphere.cc


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

File:
1 copied

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.