コード例 #1
0
ファイル: EffectManager.cpp プロジェクト: ByeDream/pixellight
/**
*  @brief
*    Constructor
*/
EffectManager::EffectManager(RendererContext &cRendererContext) :
	m_pRendererContext(&cRendererContext),
	m_pDefault(new EffectHandler())
{
	PL_LOG(Debug, "Create effect manager")

	// Set manager name
	SetManagerName("Effect manager");

	// Unload unused resources, please
	SetUnloadUnused(true);

	// Create the standard effect
	Effect *pFX = CreateResource(Default);
	if (pFX) {
		// Create the effect
		EffectTechnique *pEffectTechnique = pFX->AddTechnique();
		if (pEffectTechnique) {
			pEffectTechnique->AddPass();
			pFX->SelectTechnique(0);
		}

		// Setup effect
		pFX->SetProtected(true);
		m_pDefault->SetResource(pFX);
		SetStandard(pFX);
	}
}
コード例 #2
0
/**
*  @brief
*    Constructor
*/
SPMultiViewFixedFunctions::SPMultiViewFixedFunctions(Renderer &cRenderer) : SPMultiView(cRenderer)
{
	// Get the renderer context
	RendererContext &cRendererContext = GetRenderer().GetRendererContext();

	// Create and set a special material & effect
	Material *pMaterial = cRendererContext.GetMaterialManager().Create("MyTeapot");
	if (pMaterial) {
		Effect *pFX = cRendererContext.GetEffectManager().Create("MyTeapot");
		if (pFX) {
			EffectTechnique *pTechnique = pFX->AddTechnique();
			if (pTechnique) {
				pFX->SelectTechnique(0);
				EffectPass *pEffectPass = pTechnique->AddPass();
				if (pEffectPass)
					pEffectPass->GetFixedFunctionsRenderStates().SetLighting(true);
			}
			pMaterial->SetEffect(pFX);
		}
		m_pMeshHandlerSphere->SetMaterial(0, pMaterial);
		m_pMeshHandlerTorus ->SetMaterial(0, pMaterial);
		m_pMeshHandlerCube  ->SetMaterial(0, pMaterial);
	}
}