25 #ifndef __I6ENGINE_API_ANIMATEDLUMINOUSAPPEARANCECOMPONENT_H_
26 #define __I6ENGINE_API_ANIMATEDLUMINOUSAPPEARANCECOMPONENT_H_
62 return "AnimatedLuminousAppearance";
65 virtual std::vector<componentOptions> getComponentOptions()
override;
68 virtual void Tick()
override;
74 T
interpolate(uint64_t duration,
const std::map<double, T> & values)
const {
76 double timePoint = (((cT - _startTime) % duration) + 1) /
double(duration);
77 for (
auto it = values.begin(); it != values.end(); it++) {
78 if (it->first <= timePoint) {
79 double currentTimePoint = it->first;
80 T currentValue = it->second;
82 double timeDiff = 0.0;
83 double timePercent = 0.0;
84 if (it == values.end()) {
85 timeDiff = 1.0 - currentTimePoint;
87 timeDiff += it->first;
88 timePercent = (timePoint + 1.0 - currentTimePoint) / timeDiff;
90 timeDiff = it->first - currentTimePoint;
91 timePercent = (timePoint - currentTimePoint) / timeDiff;
93 T newValue = currentValue * (1.0 - timePercent) + (it->second) * timePercent;
103 uint64_t _diffuseDuration;
104 std::map<double, Vec3> _diffuseColours;
105 uint64_t _specularDuration;
106 std::map<double, Vec3> _specularColours;
107 uint64_t _attenuationDuration;
108 std::map<double, Vec4> _attenuations;
110 void Init()
override;
111 void Finalize()
override;
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
T interpolate(uint64_t duration, const std::map< double, T > &values) const
used to interpolate between two following values depending on current time
#define ISIXE_MODULES_API
std::map< std::string, std::string > attributeMap
static T & GetSingleton()
Returns a reference to the Singleton class.
#define ISIXE_THROW_FAILURE(module, message)
std::string getTemplateName() const override
returns the name this template was registered with
interpolates light colours and attenuation (e.g. range) For creating a AnimatedLuminousAppearanceComp...