kick
|
00001 // 00002 // light.h 00003 // KickCPP 00004 // 00005 // Created by morten on 8/15/13. 00006 // Copyright (c) 2013 Morten Nobel-Joergensen. All rights reserved. 00007 // 00008 00009 #pragma once 00010 00011 #include "kick/scene/component.h" 00012 #include "kick/core/event.h" 00013 00014 #include <glm/glm.hpp> 00015 00016 namespace kick { 00017 class GameObject; 00018 00019 enum class LightType{ 00020 Uninitialized, 00021 Ambient, 00022 Directional, 00023 Point, 00024 Spot 00025 }; 00026 00027 enum class ShadowType{ 00028 None, 00029 Hard, 00030 Soft 00031 }; 00032 00033 class Light : public Component { 00034 public: 00035 Light(GameObject *gameObject); 00036 void setColor(glm::vec3 color); 00037 glm::vec3 color(); 00038 void setIntensity(float intensity); 00039 float intensity(); 00040 glm::vec3 colorIntensity(); 00041 void setLightType(LightType lightType); 00042 LightType lightType(); 00043 glm::vec3 attenuation() const; 00044 // attenuation: {constant, linear, quadratic} 00045 void setAttenuation(glm::vec3 attenuation); 00046 Event<std::shared_ptr<Light>> lightTypeChanged; 00047 ShadowType const &shadowType() const; 00048 void setShadowType(ShadowType const &shadowType); 00049 private: 00050 void updateIntensity(); 00051 glm::vec3 mColorIntensity = glm::vec3(1,1,1); 00052 glm::vec3 mColor = glm::vec3(1,1,1); 00053 glm::vec3 mAttenuation = glm::vec3(1,0,0); 00054 float mIntensity = 1; 00055 LightType mLightType = LightType::Uninitialized; 00056 ShadowType mShadowType = ShadowType::None; 00057 }; 00058 }