Exemplo n.º 1
0
bool CConvexTest::SetLight()
{
	ShaderManager *pShaderMgr = m_Shader.GetShaderManager();
	if( !pShaderMgr )
		return false;

	ShaderLightManager *pShaderLightMgr = m_Shader.GetShaderManager()->GetShaderLightManager().get();
	if( pShaderLightMgr )
	{
		pShaderLightMgr->ClearLights();

		HemisphericDirectionalLight light;
		light.Attribute.UpperDiffuseColor.SetRGBA( 1.0f, 1.0f, 1.0f, 1.0f );
		light.Attribute.LowerDiffuseColor.SetRGBA( 0.1f, 0.1f, 0.1f, 1.0f );
		light.vDirection = Vec3GetNormalized( Vector3( -1.0f, -1.8f, -0.9f ) );

//		pShaderLightMgr->SetLight( 0, light );
//		pShaderLightMgr->SetDirectionalLightOffset( 0 );
//		pShaderLightMgr->SetNumDirectionalLights( 1 );
		pShaderLightMgr->SetHemisphericDirectionalLight( light );

		pShaderLightMgr->CommitChanges();

		return true;
	}
	else
		return false;
}
void SimpleOverlayEffectsDemo::SetLights()
{
    ShaderManager *pShaderMgr = m_Shader.GetShaderManager();

    if( !pShaderMgr )
        return;

    ShaderManager& shader_mgr = *pShaderMgr;

//	if( !shader_loaded )
//		return false;

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

    pShaderLightMgr->ClearLights();

    HemisphericDirectionalLight light;
    light.Attribute.UpperDiffuseColor.SetRGBA( 1.0f, 1.0f, 1.0f, 1.0f );
    light.Attribute.LowerDiffuseColor.SetRGBA( 0.1f, 0.1f, 0.1f, 1.0f );
    light.vDirection = Vec3GetNormalized( Vector3( -1.0f, -1.8f, 0.9f ) );

//	pShaderLightMgr->SetLight( 0, light );
//	pShaderLightMgr->SetDirectionalLightOffset( 0 );
//	pShaderLightMgr->SetNumDirectionalLights( 1 );
    pShaderLightMgr->SetHemisphericDirectionalLight( light );

    pShaderLightMgr->CommitChanges();
}
Exemplo n.º 3
0
void LightingDemo::SetHSDirectionalLights( ShaderLightManager& shader_light_mgr, bool random_color )
{
	// Always use hemispheric lights
	const bool use_hemespheric_light = true;

	if( use_hemespheric_light )
	{
//		HemisphericDirectionalLight light;
//		light.Attribute.UpperDiffuseColor.SetRGBA( 0.0f, 1.0f, 1.0f, 1.0f );
//		light.Attribute.LowerDiffuseColor.SetRGBA( 1.0f, 0.1f, 0.1f, 1.0f );
//		light.vDirection = Vec3GetNormalized( Vector3( -1.0f, -1.8f, -0.9f ) );
		HemisphericDirectionalLight light;
//		light.Attribute.UpperDiffuseColor.SetRGBA( 1.0f, 1.0f, 1.0f, 1.0f );
//		light.Attribute.LowerDiffuseColor.SetRGBA( 0.0f, 0.0f, 0.0f, 1.0f );
		light.Attribute.UpperDiffuseColor = SFloatRGBAColor::Red();
		light.Attribute.LowerDiffuseColor = SFloatRGBAColor::Blue();
		light.vDirection = Vec3GetNormalized( Vector3( -1.0f, -1.5f, -0.9f ) );
		shader_light_mgr.SetHemisphericDirectionalLight( light );
	}
	else
	{
		DirectionalLight dir_light;
		dir_light.DiffuseColor = SFloatRGBColor(1,1,1);
		dir_light.fIntensity = 1.0f;
		dir_light.vDirection = Vec3GetNormalized( Vector3( 1.2f, -1.8f, 1.0f ) );
		shader_light_mgr.SetDirectionalLight( dir_light );
	}
}
Exemplo n.º 4
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();
}