animate lights

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
ptikaka
Kobold
Posts: 25
Joined: Wed Apr 25, 2007 6:20 pm
Location: PARIS(FRANCE)

animate lights

Post by ptikaka » Wed May 16, 2007 1:08 pm

hi
ive searched but i haven't found how i could animate lights
for example a pointlight that is flickering and/or changing colour every 10 seconds.
0 x
the more you know the less you understand

Ajare
Goblin
Posts: 282
Joined: Sat May 14, 2005 9:20 pm

Post by Ajare » Wed May 16, 2007 2:57 pm

Write a wrapper class for Ogre::Light, and update it each frame with whatever settings you want. Eg:

Code: Select all

void AnimLight::update (float frameTime)
{
    mLightTime += frameTime;
    float amt = sin (mLightTime) * 0.5 + 0.5;
    mLight->setDiffuseColour (amt, amt, amt);    
}
Would create a 'strobe' light.

edit: Light also derives from AnimableObject, so you can animate the diffuse colour with a NumericAnimationTrack. This way is more automated, but less flexible.
0 x

User avatar
ptikaka
Kobold
Posts: 25
Joined: Wed Apr 25, 2007 6:20 pm
Location: PARIS(FRANCE)

Post by ptikaka » Fri May 18, 2007 8:46 pm

THX :D
0 x
the more you know the less you understand

Post Reply