Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/textEngine/src/world_entities/skysphere.cc @ 3772

Last change on this file since 3772 was 3681, checked in by bensch, 20 years ago

orxonox/branches/textEngine: merged trunk here.
merged with command:
svn merge ../trunk textEngine -r 3467:HEAD
no conflicts

File size: 2.7 KB
Line 
1
2/*
3   orxonox - the future of 3D-vertical-scrollers
4
5   Copyright (C) 2004 orx
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2, or (at your option)
10   any later version.
11
12   ### File Specific:
13   main-programmer: David Gruetter
14   co-programmer: Benjamin Grauer
15   
16   Created by Dave: this file is actually quite similar to player.cc and so is
17   skybox.h similar to player.h
18   With that said, things should be clear:)
19   
20   Edited:
21   Bensch: more constructors, changeability, comments...
22   Patrick: giving it the common orxonox style, not much to do... good work Dave!
23
24*/
25
26#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
27
28
29#include "skysphere.h"
30#include "stdincl.h"
31
32#include "material.h"
33#include "vector.h"
34//#include "world_entity.h"
35
36
37using namespace std;
38
39/**
40   \brief Standart Constructor
41*/
42Skysphere::Skysphere()
43{ 
44  this->initialize("../data/pictures/sky-replace.jpg");
45}
46
47
48/**
49   \brief Constructs a SkySphere and takes fileName as a map.
50   \param fileName the file to take as input for the skysphere
51*/
52Skysphere::Skysphere(char* fileName)
53{
54  this->initialize(fileName);
55}
56
57
58/**
59   \brief default destructor
60*/
61Skysphere::~Skysphere()
62{
63  PRINTF(3)("Deleting the SkySphere\n");
64  delete this->skyMaterial;
65  free(this->sphereObj);
66}
67
68/**
69   \brief initializes the Skysphere.
70   \param fileName the file to take as input for the skysphere
71*/
72void Skysphere::initialize(char* fileName)
73{
74  PRINTF(1)("initializing the Skysphere with Material %s.\n", fileName);
75  this->sphereObj = gluNewQuadric();
76  gluQuadricTexture(this->sphereObj, GL_TRUE);
77  this->setRadius(1900.0);
78
79  this->skyMaterial = new Material("Sky");
80  this->setTexture(fileName);
81  this->skyMaterial->setIllum(3);
82  this->skyMaterial->setAmbient(1.0, 1.0, 1.0);
83}
84
85
86/**
87   \brief Defines which texture should be loaded onto the skysphere.
88   \param fileName The filename of the Texture
89*/
90void Skysphere::setTexture(char* fileName)
91{
92  this->skyMaterial->setDiffuseMap(fileName);
93}
94
95
96/**
97   \brief draws the Skysphere
98   
99   This part is normally precessed in the "Painting Phase".
100*/
101void Skysphere::draw()
102{
103  glPushMatrix();
104  glMatrixMode(GL_MODELVIEW);
105  Vector r = this->getAbsCoor();
106  glTranslatef(r.x, r.y, r.z);
107
108  //glRotatef(-30, 1, 0, 0);
109  //glRotatef(95.0f, 0.0f, 0.0f, 1.0f);
110  //glRotatef(-250.0f, 0.0, 1.0f, 0.0f);
111 
112  skyMaterial->select();
113  gluSphere(this->sphereObj, this->sphereRadius, 20, 20);
114  glPopMatrix();
115}
116
117
118/**
119   \brief sets the Radius of the Sphere.
120   \param radius The Radius of The Sphere
121*/
122void Skysphere::setRadius(float radius)
123{
124  this->sphereRadius = radius;
125}
Note: See TracBrowser for help on using the repository browser.