Exemple #1
0
 void PluginWrapper::notifyPlugin(Common::PluginNotificationFlags flag, const QVariant &data, void *pointer) {
     if (getIsEnabled()) {
         if (Common::HasFlag(m_NotificationFlags, flag)) {
             m_PluginInterface->onPropertyChanged(flag, data, pointer);
         } else {
             LOG_DEBUG << "Plugin" << m_PrettyName << "is not subscribed to" << (Common::flag_t)flag;
         }
     } else {
         LOG_DEBUG << "Plugin" << m_PrettyName << "is disabled";
     }
 }
void PathEditor::visit( Renderer *renderer, const Mat4& transform, uint32_t flags )
{
	Layer::visit( renderer, transform, flags );
	
	renderer->render( );

	auto d = [](std::vector<Point>&v, const Color4F & color, int width)
	{
		glLineWidth( width );
		DrawPrimitives::setDrawColor4F( color.r, color.g, color.b, color.a );
		for( unsigned i = 0; i<v.size( ) - 1; ++i )
			DrawPrimitives::drawLine( v[i], v[i + 1] );
		if( width > 1 )
		{
			DrawPrimitives::setPointSize( 10 );
			DrawPrimitives::drawPoints( v.data(), v.size() );
		}
		DrawPrimitives::setPointSize( 1 );
		DrawPrimitives::setDrawColor4F( 1, 1, 1, 1 );
		return 0;
	};
	if( getIsEnabled() )
	{
		for( auto i : m_routes )
		{
			Color4F color;
			switch( i.type )
			{
				case UnitLayer::earth: color = Color4F::WHITE; break;
				case UnitLayer::sky: color = Color4F::BLUE; break;
				case UnitLayer::sea: color = Color4F::GREEN; break;
				default: color = Color4F::RED; break;
			}
			d( i.main, color, 1 );
		}
		if( m_currentRoute != m_routes.end() )
		{
			Color4F color;
			switch( m_currentRoute->type )
			{
				case UnitLayer::earth: color = Color4F::WHITE; break;
				case UnitLayer::sky: color = Color4F::BLUE; break;
				case UnitLayer::sea: color = Color4F::GREEN; break;
				default: color = Color4F::RED; break;
			}
			d( m_currentRoute->main, color, 2 );
			d( m_currentRoute->left, Color4F( 1, 0, 0, 0.5f ), 1 );
			d( m_currentRoute->right, Color4F( 1, 0, 0, 0.5f ), 1 );
		}
	}
	renderer->render();
}
Exemple #3
0
    void PluginWrapper::triggerActionSafe(int actionID) const {
        LOG_INFO << getPrettyName() << "executing action:" << actionID;

        try {
            if (getIsEnabled()) {
                m_PluginInterface->executeAction(actionID);
            } else {
                LOG_WARNING << getPrettyName() << "is disabled";
            }
        }
        catch (...) {
            LOG_WARNING << "Exception while triggering action for plugin ID" << m_PluginID;
        }
    }
Exemple #4
0
void GLGameModel::setupLightingParameters()
{
    if(getIsEnabled())
    {
        GLfloat ambient_color[] = { 0.6, 0.6, 0.6, 1.0 };
        glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
        GLfloat diffuse_color[] = { 0.3, 0.3, 0.3, 1.0 };
        glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
    }
    else
    {
        GLfloat ambient_color[] = { 0.2, 0.2, 0.2, 1.0 };
        glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
        GLfloat diffuse_color[] = { 0.0, 0.0, 0.0, 1.0 };
        glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
        glEnable(GL_LIGHTING);
    }
}