Compare commits
1 Commits
master
...
AnimateSun
Author | SHA1 | Date | |
---|---|---|---|
|
abb3465429 |
@ -16,6 +16,7 @@
|
|||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "scriptengine/property_animator.hpp"
|
#include "scriptengine/property_animator.hpp"
|
||||||
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
#include "tracks/track_object_presentation.hpp"
|
#include "tracks/track_object_presentation.hpp"
|
||||||
#include "utils/log.hpp"
|
#include "utils/log.hpp"
|
||||||
@ -84,6 +85,15 @@ bool AnimatedProperty::update(double dt)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AnimatablePropery::SUN_COLOR:
|
||||||
|
{
|
||||||
|
Track* track = (Track*)m_data;
|
||||||
|
video::SColor color(255, (int)m_new_values[0], (int)m_new_values[1], (int)m_new_values[2]);
|
||||||
|
track->setSunColor(color);
|
||||||
|
irr_driver->setSunColor(color);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log::error("PropertyAnimator", "Unknown properry %i", (int)m_property);
|
Log::error("PropertyAnimator", "Unknown properry %i", (int)m_property);
|
||||||
break;
|
break;
|
||||||
|
@ -26,7 +26,8 @@ enum AnimatablePropery
|
|||||||
AP_LIGHT_ENERGY,
|
AP_LIGHT_ENERGY,
|
||||||
FOG_RANGE,
|
FOG_RANGE,
|
||||||
FOG_MAX,
|
FOG_MAX,
|
||||||
FOG_COLOR
|
FOG_COLOR,
|
||||||
|
SUN_COLOR
|
||||||
};
|
};
|
||||||
|
|
||||||
class AnimatedProperty : NoCopy
|
class AnimatedProperty : NoCopy
|
||||||
|
@ -166,6 +166,27 @@ namespace Scripting
|
|||||||
duration, track)
|
duration, track)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSunColor(int r, int g, int b, float duration)
|
||||||
|
{
|
||||||
|
PropertyAnimator* animator = PropertyAnimator::get();
|
||||||
|
::Track* track = World::getWorld()->getTrack();
|
||||||
|
video::SColor color = track->getSunColor();
|
||||||
|
animator->add(
|
||||||
|
new AnimatedProperty(SUN_COLOR, 3,
|
||||||
|
new double[3] {
|
||||||
|
(double)color.getRed(),
|
||||||
|
(double)color.getGreen(),
|
||||||
|
(double)color.getBlue()
|
||||||
|
},
|
||||||
|
new double[3] {
|
||||||
|
(double)r,
|
||||||
|
(double)g,
|
||||||
|
(double)b
|
||||||
|
},
|
||||||
|
duration, track)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \cond DOXYGEN_IGNORE */
|
/** \cond DOXYGEN_IGNORE */
|
||||||
@ -365,7 +386,8 @@ namespace Scripting
|
|||||||
r = engine->RegisterGlobalFunction("void exitRace()", asFUNCTION(exitRace), asCALL_CDECL); assert(r >= 0);
|
r = engine->RegisterGlobalFunction("void exitRace()", asFUNCTION(exitRace), asCALL_CDECL); assert(r >= 0);
|
||||||
r = engine->RegisterGlobalFunction("void pauseRace()", asFUNCTION(pauseRace), asCALL_CDECL); assert(r >= 0);
|
r = engine->RegisterGlobalFunction("void pauseRace()", asFUNCTION(pauseRace), asCALL_CDECL); assert(r >= 0);
|
||||||
r = engine->RegisterGlobalFunction("void setFog(float maxDensity, float start, float end, int r, int g, int b, float duration)", asFUNCTION(setFog), asCALL_CDECL); assert(r >= 0);
|
r = engine->RegisterGlobalFunction("void setFog(float maxDensity, float start, float end, int r, int g, int b, float duration)", asFUNCTION(setFog), asCALL_CDECL); assert(r >= 0);
|
||||||
|
r = engine->RegisterGlobalFunction("void setSunColor(int r, int g, int b, float duration)", asFUNCTION(setSunColor), asCALL_CDECL); assert(r >= 0);
|
||||||
|
|
||||||
// TrackObject
|
// TrackObject
|
||||||
r = engine->RegisterObjectMethod("TrackObject", "void setEnabled(bool status)", asMETHOD(::TrackObject, setEnabled), asCALL_THISCALL); assert(r >= 0);
|
r = engine->RegisterObjectMethod("TrackObject", "void setEnabled(bool status)", asMETHOD(::TrackObject, setEnabled), asCALL_THISCALL); assert(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("TrackObject", "SoundEmitter@ getSoundEmitter()", asMETHOD(::TrackObject, getSoundEmitter), asCALL_THISCALL); assert(r >= 0);
|
r = engine->RegisterObjectMethod("TrackObject", "SoundEmitter@ getSoundEmitter()", asMETHOD(::TrackObject, getSoundEmitter), asCALL_THISCALL); assert(r >= 0);
|
||||||
|
@ -577,6 +577,8 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
video::SColor getSunColor() const { return m_sun_diffuse_color; }
|
video::SColor getSunColor() const { return m_sun_diffuse_color; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
void setSunColor(video::SColor color) { m_sun_diffuse_color = color; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
/** Whether this is an "internal" track. If so it won't be offered
|
/** Whether this is an "internal" track. If so it won't be offered
|
||||||
* in the track selection screen. */
|
* in the track selection screen. */
|
||||||
bool isInternal() const { return m_internal; }
|
bool isInternal() const { return m_internal; }
|
||||||
|
Loading…
Reference in New Issue
Block a user