Changeset 11071 for code/trunk/src/orxonox/graphics/Light.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/graphics/Light.cc
r9667 r11071 31 31 #include <OgreSceneManager.h> 32 32 #include <OgreLight.h> 33 #include <boost/static_assert.hpp>34 33 35 34 #include "util/StringUtils.h" … … 45 44 46 45 // Be sure we don't do bad conversions 47 BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT == (int)Light::Point);48 BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional);49 BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Spotlight);46 static_assert((int)Ogre::Light::LT_POINT == (int)Light::Type::Point, "check enum"); 47 static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Type::Directional, "check enum"); 48 static_assert((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Type::Spotlight, "check enum"); 50 49 51 50 Light::Light(Context* context) : StaticEntity(context) … … 53 52 RegisterObject(Light); 54 53 55 this->light_ = 0;54 this->light_ = nullptr; 56 55 this->diffuse_ = ColourValue::White; 57 56 this->specular_ = ColourValue::White; 58 this->type_ = Light::Point;57 this->type_ = Type::Point; 59 58 this->attenuation_ = Vector4(100000, 1, 0, 0); 60 59 this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f); … … 106 105 void Light::registerVariables() 107 106 { 108 registerVariable( (int&)this->type_,VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));107 registerVariable(this->type_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType)); 109 108 registerVariable(this->diffuse_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour)); 110 109 registerVariable(this->specular_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpecularColour)); … … 127 126 void Light::updateAttenuation() 128 127 { 129 if (this->light_ && this->type_ != Light::Directional)128 if (this->light_ && this->type_ != Type::Directional) 130 129 this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w); 131 130 } … … 133 132 void Light::updateSpotlightRange() 134 133 { 135 if (this->light_ && this->type_ == Light::Spotlight)134 if (this->light_ && this->type_ == Type::Spotlight) 136 135 this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z); 137 136 } … … 140 139 { 141 140 if (type == "point") 142 this->setType( Light::Point);141 this->setType(Type::Point); 143 142 else if (type == "directional") 144 this->setType( Light::Directional);143 this->setType(Type::Directional); 145 144 else if (type == "spotlight") 146 this->setType( Light::Spotlight);145 this->setType(Type::Spotlight); 147 146 else 148 this->setType( Light::Point);147 this->setType(Type::Point); 149 148 } 150 149 … … 153 152 switch (this->type_) 154 153 { 155 case Light::Directional:154 case Type::Directional: 156 155 return "directional"; 157 case Light::Spotlight:156 case Type::Spotlight: 158 157 return "spotlight"; 159 case Light::Point:158 case Type::Point: 160 159 default: 161 160 return "point"; … … 169 168 this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_)); 170 169 171 if (this->type_ != Light::Directional)170 if (this->type_ != Type::Directional) 172 171 this->updateAttenuation(); 173 if (this->type_ == Light::Spotlight)172 if (this->type_ == Type::Spotlight) 174 173 this->updateSpotlightRange(); 175 174 }
Note: See TracChangeset
for help on using the changeset viewer.