コード例 #1
0
	//---------------------------------------------------------------------
	HighLevelGpuProgramPtr
		TerrainMaterialGeneratorA::SM2Profile::ShaderHelperCg::createFragmentProgram(
			const SM2Profile* prof, const Terrain* terrain, TechniqueType tt)
	{
		HighLevelGpuProgramManager& mgr = HighLevelGpuProgramManager::getSingleton();
		String progName = getFragmentProgramName(prof, terrain, tt);

		HighLevelGpuProgramPtr ret = mgr.getByName(progName);
		if (ret.isNull())
		{
			ret = mgr.createProgram(progName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 
				"cg", GPT_FRAGMENT_PROGRAM);
		}
		else
		{
			ret->unload();
		}
		
		if(prof->isLayerNormalMappingEnabled() || prof->isLayerParallaxMappingEnabled())
			ret->setParameter("profiles", "ps_4_0 ps_3_0 ps_2_x fp40 arbfp1");
		else
			ret->setParameter("profiles", "ps_4_0 ps_3_0 ps_2_0 fp30 arbfp1");
		ret->setParameter("entry_point", "main_fp");

		return ret;

	}
コード例 #2
0
    //---------------------------------------------------------------------
    HighLevelGpuProgramPtr
    ShaderHelperHLSL::createFragmentProgram(
        const SM2Profile* prof, const Terrain* terrain, TechniqueType tt)
    {
        HighLevelGpuProgramManager& mgr = HighLevelGpuProgramManager::getSingleton();
        String progName = getFragmentProgramName(prof, terrain, tt);

        HighLevelGpuProgramPtr ret = mgr.getByName(progName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
        if (!ret)
        {
            ret = mgr.createProgram(progName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 
                "hlsl", GPT_FRAGMENT_PROGRAM);
        }
        else
        {
            ret->unload();
        }
        // creating Shader Model 4.0 type hlsl shader fol DirectX11 Render System
        if (prof->_isSM4Available())
            ret->setParameter("target", "ps_4_0");
        //else if (prof->_isSM3Available())
        //  ret->setParameter("target", "ps_3_0");
        //else
        //  ret->setParameter("target", "ps_2_x");
        ret->setParameter("entry_point", "main_fp");

        return ret;

    }