Exemplo n.º 1
0
void CMultiShapeActorsTest::SetLights()
{
	ShaderManager *pShaderManager = m_Shader.GetShaderManager();
//	ShaderManager& shader_mgr = pShaderManager ? (*pShaderManager) : FixedFunctionPipelineManager();
	if( !pShaderManager )
		return;

	ShaderManager& shader_mgr = *pShaderManager;

	ShaderLightManager *pShaderLightMgr = shader_mgr.GetShaderLightManager().get();
	if( !pShaderLightMgr )
		return;

	pShaderLightMgr->ClearLights();

//	DirectionalLight dir_light;
//	dir_light.DiffuseColor = SFloatRGBColor(1,1,1);
//	dir_light.fIntensity = 1.0f;
//	dir_light.vDirection = Vec3GetNormalized( Vector3( -1.0f, -2.5f, -0.9f ) );
//	pShaderLightMgr->SetDirectionalLight( dir_light );

	bool set_pnt_light = false;
	if( set_pnt_light )
	{
		PointLight pnt_light;
		pnt_light.DiffuseColor = SFloatRGBColor(1,1,1);
		pnt_light.fIntensity = 1.0f;
		pnt_light.vPosition = Vector3( 0.3f, 3.5f, -1.9f );
		pnt_light.fAttenuation[0] = 1.0f;
		pnt_light.fAttenuation[1] = 1.0f;
		pnt_light.fAttenuation[2] = 0.1f;
		pShaderLightMgr->SetPointLight( pnt_light );
	}

	HemisphericDirectionalLight hdir_light;
	hdir_light.Attribute.UpperDiffuseColor.SetRGBA( 1.0f, 1.0f, 1.0f, 1.0f );
	hdir_light.Attribute.LowerDiffuseColor.SetRGBA( 0.3f, 0.3f, 0.3f, 1.0f );
	hdir_light.vDirection = Vec3GetNormalized( Vector3( -1.0f, -2.5f, -0.9f ) );
	pShaderLightMgr->SetHemisphericDirectionalLight( hdir_light );

	pShaderLightMgr->CommitChanges();
}