kick
/Users/morten/Programmering/cpp/kick/src/kick/scene/light.cpp
00001 //
00002 //  light.cpp
00003 //  KickCPP
00004 //
00005 //  Created by morten on 8/15/13.
00006 //  Copyright (c) 2013 Morten Nobel-Joergensen. All rights reserved.
00007 //
00008 
00009 #include "kick/scene/light.h"
00010 #include <cassert>
00011 
00012 namespace kick {
00013     Light::Light(GameObject *gameObject)
00014     :Component(gameObject)
00015     {
00016     }
00017     
00018     
00019     void Light::updateIntensity(){
00020         mColorIntensity = mColor * mIntensity;
00021     }
00022     
00023     void Light::setColor(glm::vec3 color) {
00024         this->mColor = color;
00025         updateIntensity();
00026     }
00027     
00028     glm::vec3 Light::color(){
00029         return mColor;
00030     }
00031     
00032     void Light::setIntensity(float intensity){
00033         this->mIntensity = intensity; updateIntensity();
00034     }
00035     
00036     float Light::intensity() {
00037         return mIntensity;
00038     }
00039     
00040     void Light::setLightType(LightType lightType) {
00041         assert(this->mLightType == LightType::Uninitialized);
00042         this->mLightType = lightType;
00043         lightTypeChanged.notifyListeners(std::dynamic_pointer_cast<Light>(shared_from_this()));
00044     };
00045     
00046     LightType Light::lightType(){
00047         return mLightType;
00048     }
00049     
00050     glm::vec3 Light::colorIntensity(){
00051         return mColorIntensity;
00052     }
00053 
00054     glm::vec3 Light::attenuation() const {
00055         return mAttenuation;
00056     }
00057 
00058     void Light::setAttenuation(glm::vec3 attenuation) {
00059         Light::mAttenuation = attenuation;
00060     }
00061 
00062     ShadowType const &Light::shadowType() const {
00063         return mShadowType;
00064     }
00065 
00066     void Light::setShadowType(ShadowType const &shadowType) {
00067         Light::mShadowType = shadowType;
00068     }
00069 
00070 
00071 }
 All Classes Functions Variables