Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/levelloader/src/world_entities/skysphere.cc @ 3725

Last change on this file since 3725 was 3605, checked in by bensch, 20 years ago

orxonox/trunk: merged trunk back to levelloader
merged with command:
svn merge -r 3499:HEAD trunk branches/levelloader

Conflicts in
C track_manager.h
C world_entities/player.cc
C world_entities/player.h
C world_entities/environment.h
C lib/coord/p_node.cc
C defs/debug.h
C track_manager.cc
C story_entities/campaign.h

solved in merge-favouring. It was quite easy because Chris only worked on the headers, and he didi it quite clean. Thats the spirit :)

Conflits in world.cc are a MESS: fix it

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#include "material.h"
29#include "skysphere.h"
30#include "stdincl.h"
31#include "vector.h"
32#include "world_entity.h"
33
34using namespace std;
35
36/**
37   \brief Standart Constructor
38*/
39Skysphere::Skysphere()
40{ 
41  this->initialize("../data/pictures/sky-replace.jpg");
42}
43
44
45/**
46   \brief Constructs a SkySphere and takes fileName as a map.
47   \param fileName the file to take as input for the skysphere
48*/
49Skysphere::Skysphere(char* fileName)
50{
51  this->initialize(fileName);
52}
53
54
55/**
56   \brief default destructor
57*/
58Skysphere::~Skysphere()
59{
60  PRINTF(3)("Deleting the SkySphere\n");
61  delete this->skyMaterial;
62  free(this->sphereObj);
63}
64
65/**
66   \brief initializes the Skysphere.
67   \param fileName the file to take as input for the skysphere
68*/
69void Skysphere::initialize(char* fileName)
70{
71  PRINTF(1)("initializing the Skysphere with Material %s.\n", fileName);
72  this->sphereObj = gluNewQuadric();
73  gluQuadricTexture(this->sphereObj, GL_TRUE);
74  this->setRadius(1900.0);
75
76  this->skyMaterial = new Material("Sky");
77  this->setTexture(fileName);
78  this->skyMaterial->setIllum(3);
79  this->skyMaterial->setAmbient(1.0, 1.0, 1.0);
80}
81
82
83/**
84   \brief Defines which texture should be loaded onto the skysphere.
85   \param fileName The filename of the Texture
86*/
87void Skysphere::setTexture(char* fileName)
88{
89  this->skyMaterial->setDiffuseMap(fileName);
90}
91
92
93/**
94   \brief draws the Skysphere
95   
96   This part is normally precessed in the "Painting Phase".
97*/
98void Skysphere::draw()
99{
100  glPushMatrix();
101  glMatrixMode(GL_MODELVIEW);
102  glTranslatef(this->absCoordinate.x,
103               this->absCoordinate.y,
104               this->absCoordinate.z);
105
106  //glRotatef(-30, 1, 0, 0);
107  //glRotatef(95.0f, 0.0f, 0.0f, 1.0f);
108  //glRotatef(-250.0f, 0.0, 1.0f, 0.0f);
109 
110  skyMaterial->select();
111  gluSphere(this->sphereObj, this->sphereRadius, 20, 20);
112  glPopMatrix();
113}
114
115
116/**
117   \brief sets the Radius of the Sphere.
118   \param radius The Radius of The Sphere
119*/
120void Skysphere::setRadius(float radius)
121{
122  this->sphereRadius = radius;
123}
Note: See TracBrowser for help on using the repository browser.