Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3796 in orxonox.OLD


Ignore:
Timestamp:
Apr 13, 2005, 4:52:55 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some simple implementation of a SkyBox

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

Legend:

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

    r3790 r3796  
    4343                 world_entities/environment.cc \
    4444                 world_entities/skysphere.cc \
     45                 world_entities/skybox.cc \
    4546                 world_entities/terrain.cc \
    4647                 world_entities/weapon.cc \
     
    9596                 world_entities/environment.h \
    9697                 world_entities/skysphere.h \
     98                 world_entities/skybox.h \
    9799                 world_entities/power_up.h \
    98100                 world_entities/terrain.h \
  • orxonox/trunk/src/Makefile.in

    r3790 r3796  
    6060        campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
    6161        player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
    62         terrain.$(OBJEXT) weapon.$(OBJEXT) projectile.$(OBJEXT) \
    63         satellite.$(OBJEXT) character_attributes.$(OBJEXT) \
    64         test_gun.$(OBJEXT) test_bullet.$(OBJEXT) ai.$(OBJEXT) \
    65         p_node.$(OBJEXT) null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
     62        skybox.$(OBJEXT) terrain.$(OBJEXT) weapon.$(OBJEXT) \
     63        projectile.$(OBJEXT) satellite.$(OBJEXT) \
     64        character_attributes.$(OBJEXT) test_gun.$(OBJEXT) \
     65        test_bullet.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
     66        null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
    6667        data_tank.$(OBJEXT) graphics_engine.$(OBJEXT) light.$(OBJEXT) \
    6768        text_engine.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \
     
    99100@AMDEP_TRUE@    ./$(DEPDIR)/satellite.Po \
    100101@AMDEP_TRUE@    ./$(DEPDIR)/simple_animation.Po \
    101 @AMDEP_TRUE@    ./$(DEPDIR)/skysphere.Po \
     102@AMDEP_TRUE@    ./$(DEPDIR)/skybox.Po ./$(DEPDIR)/skysphere.Po \
    102103@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/terrain.Po \
    103104@AMDEP_TRUE@    ./$(DEPDIR)/test_bullet.Po ./$(DEPDIR)/test_gun.Po \
     
    254255                 world_entities/environment.cc \
    255256                 world_entities/skysphere.cc \
     257                 world_entities/skybox.cc \
    256258                 world_entities/terrain.cc \
    257259                 world_entities/weapon.cc \
     
    306308                 world_entities/environment.h \
    307309                 world_entities/skysphere.h \
     310                 world_entities/skybox.h \
    308311                 world_entities/power_up.h \
    309312                 world_entities/terrain.h \
     
    450453@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/satellite.Po@am__quote@
    451454@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_animation.Po@am__quote@
     455@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skybox.Po@am__quote@
    452456@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
    453457@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
     
    591595@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    592596@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o skysphere.obj `if test -f 'world_entities/skysphere.cc'; then $(CYGPATH_W) 'world_entities/skysphere.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/skysphere.cc'; fi`
     597
     598skybox.o: world_entities/skybox.cc
     599@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT skybox.o -MD -MP -MF "$(DEPDIR)/skybox.Tpo" -c -o skybox.o `test -f 'world_entities/skybox.cc' || echo '$(srcdir)/'`world_entities/skybox.cc; \
     600@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/skybox.Tpo" "$(DEPDIR)/skybox.Po"; else rm -f "$(DEPDIR)/skybox.Tpo"; exit 1; fi
     601@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/skybox.cc' object='skybox.o' libtool=no @AMDEPBACKSLASH@
     602@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/skybox.Po' tmpdepfile='$(DEPDIR)/skybox.TPo' @AMDEPBACKSLASH@
     603@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     604@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o skybox.o `test -f 'world_entities/skybox.cc' || echo '$(srcdir)/'`world_entities/skybox.cc
     605
     606skybox.obj: world_entities/skybox.cc
     607@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT skybox.obj -MD -MP -MF "$(DEPDIR)/skybox.Tpo" -c -o skybox.obj `if test -f 'world_entities/skybox.cc'; then $(CYGPATH_W) 'world_entities/skybox.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/skybox.cc'; fi`; \
     608@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/skybox.Tpo" "$(DEPDIR)/skybox.Po"; else rm -f "$(DEPDIR)/skybox.Tpo"; exit 1; fi
     609@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/skybox.cc' object='skybox.obj' libtool=no @AMDEPBACKSLASH@
     610@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/skybox.Po' tmpdepfile='$(DEPDIR)/skybox.TPo' @AMDEPBACKSLASH@
     611@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     612@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o skybox.obj `if test -f 'world_entities/skybox.cc'; then $(CYGPATH_W) 'world_entities/skybox.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/skybox.cc'; fi`
    593613
    594614terrain.o: world_entities/terrain.cc
  • orxonox/trunk/src/animation.cc

    r3795 r3796  
    1717#include "animation.h"
    1818#include "debug.h"
    19 #include "list.h"
    2019
    2120
  • orxonox/trunk/src/world_entities/skybox.cc

    r3794 r3796  
    2727
    2828
    29 #include "skysphere.h"
     29#include "skybox.h"
    3030#include "stdincl.h"
    3131
    3232#include "material.h"
    3333#include "vector.h"
     34#include "resource_manager.h"
     35#include "model.h"
    3436//#include "world_entity.h"
    3537
     
    3840
    3941/**
    40    \brief Constructs a SkySphere and takes fileName as a map.
    41    \param fileName the file to take as input for the skysphere
     42   \brief Constructs a SkyBox and takes fileName as a map.
     43   \param fileName the file to take as input for the SkyBox
    4244*/
    43 Skysphere::Skysphere(char* fileName)
     45SkyBox::SkyBox(char* fileName)
    4446{
    45   if (fileName == NULL)
    46     this->initialize("../data/pictures/sky-replace.jpg");
    47   else
    48     this->initialize(fileName);
     47  this->setClassName("SkyBox");
     48
     49
     50  this->model = (Model*)ResourceManager::getInstance()->load("cube", PRIM, RP_LEVEL);
     51  this->setMode(PNODE_MOVEMENT);
     52
     53  this->setSize(1900.0);
     54
     55  this->material = new Material("Sky");
     56  if (fileName)
     57    this->setTexture(fileName);
     58  this->material->setIllum(3);
     59  this->material->setAmbient(1.0, 1.0, 1.0);
     60
    4961}
    5062
     
    5365   \brief default destructor
    5466*/
    55 Skysphere::~Skysphere()
     67SkyBox::~SkyBox()
    5668{
    57   PRINTF(3)("Deleting the SkySphere\n");
    58   delete this->skyMaterial;
    59   free(this->sphereObj);
    60 }
    61 
    62 /**
    63    \brief initializes the Skysphere.
    64    \param fileName the file to take as input for the skysphere
    65 */
    66 void Skysphere::initialize(char* fileName)
    67 {
    68   PRINTF(1)("initializing the Skysphere with Material %s.\n", fileName);
    69   this->sphereObj = gluNewQuadric();
    70   this->setMode(PNODE_MOVEMENT);
    71 
    72   gluQuadricTexture(this->sphereObj, GL_TRUE);
    73   this->setRadius(1900.0);
    74 
    75   this->skyMaterial = new Material("Sky");
    76   this->setTexture(fileName);
    77   this->skyMaterial->setIllum(3);
    78   this->skyMaterial->setAmbient(1.0, 1.0, 1.0);
     69  PRINTF(3)("Deleting the SkyBox\n");
     70  delete this->material;
    7971}
    8072
    8173
    8274/**
    83    \brief Defines which texture should be loaded onto the skysphere.
     75   \brief Defines which texture should be loaded onto the SkyBox.
    8476   \param fileName The filename of the Texture
    8577*/
    86 void Skysphere::setTexture(char* fileName)
     78void SkyBox::setTexture(char* fileName)
    8779{
    88   this->skyMaterial->setDiffuseMap(fileName);
     80  this->material->setDiffuseMap(fileName);
    8981}
    9082
    9183
    9284/**
    93    \brief draws the Skysphere
     85   \brief draws the SkyBox
    9486   
    9587   This part is normally precessed in the "Painting Phase".
    9688*/
    97 void Skysphere::draw()
     89void SkyBox::draw()
    9890{
    9991  glPushMatrix();
     
    10294  glTranslatef(r.x, r.y, r.z);
    10395
    104   //glRotatef(-30, 1, 0, 0);
    105   //glRotatef(95.0f, 0.0f, 0.0f, 1.0f);
    106   //glRotatef(-250.0f, 0.0, 1.0f, 0.0f);
    107  
    108   skyMaterial->select();
    109   gluSphere(this->sphereObj, this->sphereRadius, 20, 20);
     96  this->material->select();
     97
     98  this->model->draw();
     99
    110100  glPopMatrix();
    111101}
     
    116106   \param radius The Radius of The Sphere
    117107*/
    118 void Skysphere::setRadius(float radius)
     108void SkyBox::setSize(float size)
    119109{
    120   this->sphereRadius = radius;
     110  this->size = size;
    121111}
  • orxonox/trunk/src/world_entities/skybox.h

    r3794 r3796  
    11/*!
    2     \file skysphere.h
    3     \brief Definition of the Skysphere, that handles the Display of an atmosphere of orxonox.
     2    \file skybox.h
     3    \brief Definition of the SkyBox, that handles the Display of an atmosphere for orxonox.
    44
    5     A SkySphere is always centered at the current working Camera, and will only obey the cameras
     5    A SkyBox is always centered at the current working Camera, and will only obey the cameras
    66    movment but not its rotation.
    7 
    8     \todo self-rotation
    9     \todo handle reference to parent-object
    107*/
    118
    12 #ifndef _SKYSPHERE_H
    13 #define _SKYSPHERE_H
     9#ifndef _SKYBOX_H
     10#define _SKYBOX_H
    1411
    1512/* INCLUDES */
     
    2017class Vector;
    2118
    22 //! A Class to handle a SkySphere
    23 class Skysphere : public WorldEntity
     19//! A Class to handle a Skybox
     20class SkyBox : public WorldEntity
    2421{
    2522
    2623 public:
    27   Skysphere(char* fileName = NULL);
    28   virtual ~Skysphere();
    29   void destroy();
     24  SkyBox(char* fileName = NULL);
     25  virtual ~SkyBox();
    3026
    31   void setRadius(float radius);
     27  void setSize(float size);
    3228  void setTexture(char* fileName);
    3329
     
    3531
    3632 private:
    37   GLUquadricObj *sphereObj; //!< A Placeholder for the SkySphere.
    38   Material *skyMaterial;    //!< A Material for the SkySphere.
    39   float sphereRadius;       //!< Radius of the SkySphere. This should match the frustum maximum range.
     33  Material *material;    //!< A Material for the Skybox.
     34  float size;       //!< Radius of the Skybox. This should match the frustum maximum range.
    4035   
    41   void initialize(char* fileName); 
    4236};
    4337
    44 #endif  /* _SKYSPHERE_H */
     38#endif  /* _SKYBOX_H */
    4539
    4640
Note: See TracChangeset for help on using the changeset viewer.