i6engine  1.0
LuminousAppearanceComponent.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_LUMINOUSAPPEARANCECOMPONENT_H_
26 #define __I6ENGINE_API_LUMINOUSAPPEARANCECOMPONENT_H_
27 
30 
32 
33 namespace i6e {
34 namespace api {
35 
52  public:
56  enum class LightType {
57  POINT = 0,
58  DIRECTIONAL = 1,
59  SPOT = 2
60  };
61 
65  LuminousAppearanceComponent(const int64_t id, const attributeMap & params);
66 
67  virtual ~LuminousAppearanceComponent();
68 
76  void setLightType(const LightType lightType);
77 
85  inline LightType getLightType() const { return _lightType; }
86 
94  void setDiffuseColor(const Vec3 & diffuseColor);
95 
103  inline Vec3 getDiffuseColor() const { return _diffuseColor; }
104 
112  void setSpecularColor(const Vec3 & specular);
113 
121  inline Vec3 getSpecularColor() const { return _specularColor; }
122 
130  void setAttenuation(const Vec4 & attenuation);
131 
139  inline Vec4 getAttenuation() const { return _attenuation; }
140 
148  void setDirection(const Vec3 & direction);
149 
157  inline Vec3 getDirection() const { return _direction; }
158 
162  void setSpotLightInnerRange(double angle);
163 
167  void setSpotLightOuterRange(double angle);
168 
172  virtual attributeMap synchronize() const override;
173 
174  virtual std::string getTemplateName() const override {
175  return "LuminousAppearance";
176  }
177 
178  virtual std::vector<componentOptions> getComponentOptions() override;
179 
180  protected:
185 
190 
195 
204 
209 
214 
220 
226 
227  virtual void Init() override;
228  virtual void Finalize() override;
229 
230  private:
231  std::pair<AddStrategy, int64_t> howToAdd(const ComPtr & comp) const override;
232 
238  void sendUpdateMessage();
239  };
240 
241 } /* namespace api */
242 } /* namespace i6e */
243 
244 #endif /* __I6ENGINE_API_LUMINOUSAPPEARANCECOMPONENT_H_ */
245 
Implements 4-dimensional vectors.
Definition: i6eVector4.h:56
Vec4 getAttenuation() const
Gets attenuation.
Tells the engine that this GameObject is emitting light. For creating a LuminousAppearanceComponent, these keys are possible: Name Required Type Description Public lightType yes int one of the LightTypes yes diffuseColor yes Vec3 diffuse colour of the light yes specularColor yes Vec3 specular colour of the light yes attenuation yes Vec4 attenuation of the light, W = range (range in world units), X = constant (1.0 never attenuate, 0.0 complete attenuation), Y = linear (linear attenuation depending on distance), Z = quadratic factor yes pos no Vec3 relative position to SceneNode yes direction *) Vec3 direction of the light shaft, *) required if lightType is DIRECTIONAL or SPOT yes spotLightRangeInner *) double range of the inner cone of a spot light in degree, *) required if lightType is SPOT yes spotLightRangeOuter *) double range of the outer cone of a spot light in degree, *) required if lightType is SPOT yes
#define ISIXE_MODULES_API
std::map< std::string, std::string > attributeMap
Definition: attributeMap.h:42
Implements 3-dimensional vectors.
Definition: i6eVector.h:48
virtual std::string getTemplateName() const override
returns the name this template was registered with
A shared pointer counting references and adds objects being not referenced any more to an internal li...
Definition: sharedPtr.h:50
Vec3 getSpecularColor() const
Gets specular colour.
LightType getLightType() const
Gets component's light type.
Vec3 getDiffuseColor() const
Gets diffuse colour.
Component Base Class. All Components must derive from Component.
Definition: Component.h:97