本文整理汇总了C++中Light::GetAmbient方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::GetAmbient方法的具体用法?C++ Light::GetAmbient怎么用?C++ Light::GetAmbient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::GetAmbient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupDirectionalLight
void GLSLProgram<real>::SetupLights()
{
const std::vector<Light<real>*>* lights = RenderState<real>::Get()->GetLights();
// Setup enabled lights
for ( uint i=0 ; i<lights->size() && i<mLightLocations.size() ; ++i )
{
Light<real>* light = (*lights)[i];
glUniform1i( mLightLocations[i].enabled, true );
glUniform1i( mLightLocations[i].type, light->GetLightType() );
Vector3<float> position = light->GetLocalToGlobal() * Vector3<real>( 0, 0, 0 );
glUniform3fv( mLightLocations[i].position, 1, (float*)&position );
Color<float> intensity = light->GetIntensity();
glUniform4fv( mLightLocations[i].intensity, 1, (float*)&intensity );
Color<float> ambient = light->GetAmbient();
glUniform4fv( mLightLocations[i].ambient, 1, (float*)&ambient );
// Setup sub-parameters
switch( light->GetLightType() )
{
case Light<real>::TypeDirectional: SetupDirectionalLight( i, light ); break;
case Light<real>::TypePoint: SetupPointLight( i, light ); break;
case Light<real>::TypeSpot: SetupSpotLight( i, light ); break;
}
}
// Disabled lights
for ( uint i=lights->size() ; i<mLightLocations.size() ; ++i )
glUniform1i( mLightLocations[i].enabled, false );
// Nb of lights
glUniform1i( mNbLightsLocation, lights->size() );
}
示例2: ambientColor
Color<real> BlinnPhongShader<real>::GetAmbient( const Light<real>& light )
{
Color<real> ambientColor( 0, 0, 0, 1 );
////////////////////////////////////////////
//////////////////IFT 3355//////////////////
////////////////////////////////////////////
//Ici, vous calculerez la composante
//ambiante.
////////////////////////////////////////////
//////////////////IFT 3355//////////////////
////////////////////////////////////////////
ambientColor += light.GetAmbient() *
GetMaterialSurfaceColor() *
mMaterial.GetAmbient() *
GetAmbientOcclusion(mRayTracer.GetNbAmbientOcclusionSamples(),
mRayTracer.GetAmbientOcclusionRadius());
return ambientColor;
}