Exemplo n.º 1
0
void QIMPenInput::loadProfiles()
{
    profileList.clear();
    profile = 0;
    delete shortcutCharSet;
    shortcutCharSet = new QIMPenCharSet();
    shortcutCharSet->setTitle( tr("Shortcut") );
    QString path = QPEApplication::qpeDir() + "etc/qimpen";
    QDir dir( path, "*.conf" );
    QStringList list = dir.entryList();
    QStringList::Iterator it;
    for ( it = list.begin(); it != list.end(); ++it ) {
	QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
	profileList.append( p );
	if ( p->shortcut() ) {
	    QIMPenCharIterator it( p->shortcut()->characters() );
	    for ( ; it.current(); ++it ) {
		shortcutCharSet->addChar( new QIMPenChar(*it.current()) );
	    }
	}
    }

    Config config( "handwriting" );
    config.setGroup( "Settings" );
    QString prof = config.readEntry( "Profile", "Default" );
    selectProfile( prof );
}
Exemplo n.º 2
0
    //-----------------------------------------------------------------------
    void CgProgram::loadFromSource(void)
    {
        // Create Cg Program
        selectProfile();
		if (mSelectedCgProfile == CG_PROFILE_UNKNOWN)
		{
			LogManager::getSingleton().logMessage(
				"Attempted to load Cg program '" + mName + "', but no suported "
				"profile was found. ");
			return;
		}
        buildArgs();
		// deal with includes
		String sourceToUse = resolveCgIncludes(mSource, this, mFilename);
        mCgProgram = cgCreateProgram(mCgContext, CG_SOURCE, sourceToUse.c_str(), 
            mSelectedCgProfile, mEntryPoint.c_str(), const_cast<const char**>(mCgArguments));

        // Test
        //LogManager::getSingleton().logMessage(cgGetProgramString(mCgProgram, CG_COMPILED_PROGRAM));

        // Check for errors
        checkForCgError("CgProgram::loadFromSource", 
            "Unable to compile Cg program " + mName + ": ", mCgContext);

    }
Exemplo n.º 3
0
void QIMPenInput::handleExtended( const QString &ex )
{
    if ( ex.find( "Select" ) == 0 ) {
	QString set = ex.mid( 7 );
	odebug << "Select new profile: " << set.latin1() << oendl;
	selectProfile( set );
    }
}
Exemplo n.º 4
0
	//-----------------------------------------------------------------------
	void CgProgram::loadFromSource(void)
	{
		selectProfile();

		if ( GpuProgramManager::getSingleton().isMicrocodeAvailableInCache(String("CG_") + mName) )
		{
			getMicrocodeFromCache();
		}
		else
		{
			compileMicrocode();
		}

		if (mDelegate)
		{
			mDelegate->setSource(mProgramString);
			mDelegate->setAdjacencyInfoRequired(isAdjacencyInfoRequired());
			if (mSelectedCgProfile == CG_PROFILE_GLSLG)
			{
				// need to set input and output operations
				if (mInputOp == CG_POINT)
				{
					mDelegate->setParameter("input_operation_type", "point_list");
				}
				else if (mInputOp == CG_LINE)
				{
					mDelegate->setParameter("input_operation_type", "line_strip");
				}
				else if (mInputOp == CG_LINE_ADJ)
				{
					mDelegate->setParameter("input_operation_type", "line_strip");
					mDelegate->setAdjacencyInfoRequired(true);
				}
				else if (mInputOp == CG_TRIANGLE)
				{
					mDelegate->setParameter("input_operation_type", "triangle_strip");
				}
				else if (mInputOp == CG_TRIANGLE_ADJ)
				{
					mDelegate->setParameter("input_operation_type", "triangle_strip");
					mDelegate->setAdjacencyInfoRequired(true);
				}

				if (mOutputOp == CG_POINT_OUT)
					mDelegate->setParameter("output_operation_type", "point_list");
				else if (mOutputOp == CG_LINE_OUT)
					mDelegate->setParameter("output_operation_type", "line_strip");
				else if (mOutputOp == CG_TRIANGLE_OUT)
					mDelegate->setParameter("output_operation_type", "triangle_strip");
			}
			if (getHighLevelLanguage() == "glsl")
			{
				// for GLSL, also ensure we explicitly bind samplers to their register
				// otherwise, GLSL will assign them in the order first used, which is
				// not what we want.
				GpuProgramParametersSharedPtr params = mDelegate->getDefaultParameters();
				for (map<String,int>::type::iterator i = mSamplerRegisterMap.begin(); i != mSamplerRegisterMap.end(); ++i)
					params->setNamedConstant(i->first, i->second);
			}
			mDelegate->load();
		}
	}
Exemplo n.º 5
0
	//-----------------------------------------------------------------------
	void CgProgram::setProfiles(const StringVector& profiles)
	{
		mProfiles = profiles;
		selectProfile();
	}