// ---------------------------------------------------------------------------- // void SceneChannelFilter::initAnimation( AnimationTask* task, DWORD time_ms, BYTE* dmx_packet ) { m_animation_task = task; m_channel_animations.clear(); double start_angle = 0.0; // Determine which channels will be participating for ( UID actor_uid : populateActors() ) { Fixture* pf = m_animation_task->getActorRepresentative( actor_uid ); if ( !pf ) continue; for ( channel_t channel : m_channels ) { if ( pf->getNumChannels() <= channel ) continue; // Each fixture may have a different start value so do independantly (and for random) ChannelValueArray value_array; // Get unmodified initial value SceneActor* actor = m_animation_task->getActor( actor_uid ); BYTE start_value = actor->getChannelValue( channel ); switch ( m_filter ) { case CF_SINE_WAVE: start_angle += m_offset; // We want this first to be able to offset multiple filters value_array = generateSineWave( start_value, start_angle, m_amplitude, m_step ); break; case CF_STEP_WAVE: value_array = generateStepWave( start_value, m_step ); break; case CF_RAMP_UP: value_array = generateRampUp( start_value, m_step, m_amplitude ); break; case CF_RAMP_DOWN: value_array = generateRampDown( start_value, m_step, m_amplitude ); break; case CF_RANDOM: value_array = generateRandom( start_value, m_amplitude ); break; } m_channel_animations.push_back( ChannelAnimation( actor_uid, channel, CAM_LIST, value_array ) ); } } return SceneChannelAnimator::initAnimation( task, time_ms, dmx_packet ); }
// ---------------------------------------------------------------------------- // void ScenePixelAnimator::initAnimation( AnimationTask* task, DWORD time_ms, BYTE* dmx_packet ) { m_animation_task = task; m_channel_animations.clear(); typedef std::vector<Participant> ParticipantArray; ParticipantArray participants; // Determine which channels will be participating for ( UID actor_uid : populateActors() ) { Fixture* pf = m_animation_task->getActorRepresentative( actor_uid ); if ( pf->getNumPixels() > 0 ) { participants.push_back( Participant( actor_uid, pf->getPixels() ) ); } } if ( participants.size() > 0 ) { PixelEngine engine; if ( m_combine_fixtures ) { for ( Participant& p : participants ) engine.loadPixels( p.m_actor_uid, p.m_pixels ); generateEffect( engine ); } else { for ( Participant& p : participants ) { engine.clear(); engine.loadPixels( p.m_actor_uid, p.m_pixels ); generateEffect( engine ); } } } SceneChannelAnimator::initAnimation( task, time_ms, dmx_packet ); }