ovassvepCSSVEPFlickeringObject.cpp 921 Bytes
Newer Older
Jussi Lindgren's avatar
Jussi Lindgren committed
1 2 3

#if defined(TARGET_HAS_ThirdPartyOgre3D)

Jussi Lindgren's avatar
Jussi Lindgren committed
4 5 6 7 8
#include "ovassvepCSSVEPFlickeringObject.h"
#include <iostream>

using namespace OpenViBESSVEP;

9
CSSVEPFlickeringObject::CSSVEPFlickeringObject(Ogre::SceneNode* poObjectNode, uint32_t ui32LitFrames, uint32_t ui32DarkFrames) :
Jussi Lindgren's avatar
Jussi Lindgren committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
	m_poObjectNode( poObjectNode ),
	m_ui32CurrentFrame( 0 ),
	m_ui32LitFrames( ui32LitFrames ),
	m_ui32DarkFrames( ui32DarkFrames ),
	m_bVisible( true )
{
}

void CSSVEPFlickeringObject::setVisible( bool bVisibility )
{
	if ( (!m_bVisible && bVisibility) || (m_bVisible && !bVisibility) )
	{
		m_poObjectNode->flipVisibility();
	}
	m_bVisible = bVisibility;
}

void CSSVEPFlickeringObject::processFrame()
{
	if (m_ui32CurrentFrame < m_ui32LitFrames)
	{
		this->setVisible( true );
	}
	else
	{
		this->setVisible( false );
	}

	m_ui32CurrentFrame++;

	if (m_ui32CurrentFrame == m_ui32LitFrames + m_ui32DarkFrames)
	{
		m_ui32CurrentFrame = 0;
	}
}
Jussi Lindgren's avatar
Jussi Lindgren committed
45 46

#endif