Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 16, 2009, 2:25:05 PM (15 years ago)
Author:
rgrieder
Message:

Last part of the cleanup: world entities.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pch/src/orxonox/objects/worldentities/Light.cc

    r3110 r3186  
    2929#include "Light.h"
    3030
    31 #include <sstream>
    32 #include <cassert>
    33 
    3431#include <OgreSceneManager.h>
     32#include <OgreLight.h>
     33#include <boost/static_assert.hpp>
    3534
    3635#include "util/String.h"
    3736#include "util/Exception.h"
     37#include "core/CoreIncludes.h"
    3838#include "core/GameMode.h"
    39 #include "core/CoreIncludes.h"
    4039#include "core/XMLPort.h"
    4140#include "objects/Scene.h"
     
    4443{
    4544    CreateFactory(Light);
     45
     46    // Be sure we don't do bad conversions
     47    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT       == (int)Light::LT_POINT);
     48    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::LT_DIRECTIONAL);
     49    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::LT_SPOTLIGHT);
    4650
    4751    Light::Light(BaseObject* creator) : StaticEntity(creator)
     
    5256        this->diffuse_ = ColourValue::White;
    5357        this->specular_ = ColourValue::White;
    54         this->type_ = Ogre::Light::LT_POINT;
     58        this->type_ = Light::LT_POINT;
    5559        this->attenuation_ = Vector4(100000, 1, 0, 0);
    5660        this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
     
    136140    {
    137141        if (type == "point")
    138             this->setType(Ogre::Light::LT_POINT);
     142            this->setType(Light::LT_POINT);
    139143        else if (type == "directional")
    140             this->setType(Ogre::Light::LT_DIRECTIONAL);
     144            this->setType(Light::LT_DIRECTIONAL);
    141145        else if (type == "spotlight")
    142             this->setType(Ogre::Light::LT_SPOTLIGHT);
     146            this->setType(Light::LT_SPOTLIGHT);
    143147        else
    144             this->setType(Ogre::Light::LT_POINT);
     148            this->setType(Light::LT_POINT);
    145149    }
    146150
     
    149153        switch (this->type_)
    150154        {
    151             case Ogre::Light::LT_DIRECTIONAL:
     155            case Light::LT_DIRECTIONAL:
    152156                return "directional";
    153             case Ogre::Light::LT_SPOTLIGHT:
     157            case Light::LT_SPOTLIGHT:
    154158                return "spotlight";
    155             case Ogre::Light::LT_POINT:
     159            case Light::LT_POINT:
    156160            default:
    157161                return "point";
     
    163167        if (this->light_)
    164168        {
    165             this->light_->setType(this->type_);
     169            this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_));
    166170
    167171            if (this->type_ != Ogre::Light::LT_DIRECTIONAL)
Note: See TracChangeset for help on using the changeset viewer.