本文整理汇总了C++中Environment::GetAmbient方法的典型用法代码示例。如果您正苦于以下问题:C++ Environment::GetAmbient方法的具体用法?C++ Environment::GetAmbient怎么用?C++ Environment::GetAmbient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::GetAmbient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _SetParameters
//--------------------------------------------------------------------------------------
void PrePixelLightTransform::_SetParameters ()
{
Engine& engine = Engine::Instance();
Device* device = engine.GetDevice();
Environment* env = engine.GetEnvironment();
ICamera* camera = engine.GetCamera();
Matrix44f wvp = *m_pTransform * camera->GetViewProj();
device->SetShaderParameter(m_hTransform, *m_pTransform);
if( NULL == m_pColor )
{
device->SetShaderParameter(m_hColor, vector4f(1,1,1,1) );
}
else
{
device->SetShaderParameter(m_hColor, *m_pColor);
}
device->SetShaderParameter(m_hNormalTransform, Matrix33f( *m_pTransform ) );
device->SetShaderParameter(m_hWorldViewProjMatrixLoc, wvp);
device->SetShaderParameter(m_hLightDirectionLoc, -env->GetCurrentLight().GetWorldDirection());//phong光是像素到光源的方向,所以这里反向
device->SetShaderParameter(m_hCameraPositionLoc, camera->GetPosition() );
device->SetShaderParameter(m_hAmbientLoc, env->GetAmbient());
device->SetShaderParameter(m_hLightLoc, env->GetCurrentLight().GetColor());
//clean up
m_pTransform = NULL;
m_pColor = NULL;
}
示例2: _SetParameters
//--------------------------------------------------------------------------------------
void ModelSpotLightPerpixel::_SetParameters ()
{
Engine& engine = Engine::Instance();
Device* device = engine.GetDevice();
Environment* env = engine.GetEnvironment();
ICamera* camera = engine.GetCamera();
device->SetShaderParameter(m_hTransform, *(Matrix44f*)(m_pMaterial->Attribute( IAttributeNode::ATT_WORLDTRANSFORM )) );
device->SetShaderParameter(m_hNormalTransform, *(Matrix33f*)(m_pMaterial->Attribute( IAttributeNode::ATT_NORMALTRANSFORM )) );
device->SetShaderParameter(m_hViewProjMatrixLoc, camera->GetViewProj());
device->SetShaderParameter(m_hLightDirectionLoc, env->GetCurrentLight().GetWorldDirection() );
device->SetShaderParameter(m_hLightPosition, env->GetCurrentLight().GetWorldPosition() );
device->SetShaderParameter(m_hCameraPositionLoc, camera->GetPosition() );
device->SetShaderParameter(m_hLightRangeInv, 1.0f / env->GetCurrentLight().GetRange() );
device->SetShaderParameter(m_hInner_DiffInv, env->GetCurrentLight().GetLightInnerDiffInv() );
device->SetShaderParameter(m_hAttenuation, env->GetCurrentLight().GetAttenuation() );
Matrix44f Bais( 0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.5, 0.5, 0.5, 1.0 );
Matrix44f PBais = env->GetCurrentLight().GetCaster().GetFirstCamera().GetViewProj() * Bais;
device->SetShaderParameter(m_hshadowMatrixBasi, PBais );
device->SetShaderParameter(m_hCameraLineDepthParam, env->GetCurrentLight().GetCaster().GetFirstCamera().LineDepthParam() );
device->SetShaderParameter( m_hTextureBase, *((Texture*)m_pMaterial->Attribute(Material::ATT_TEX_DIFFUSE)) );
device->SetShaderParameter( m_hTextureDepth, env->GetCurrentLight().GetCaster().GetFirstDepthTexture() );
device->SetShaderParameter(m_hAmbient_AmbientLight, env->GetAmbient() * m_pMaterial->Ambient() );
device->SetShaderParameter(m_hSpecular_Light, env->GetCurrentLight().GetColor() * m_pMaterial->Specular() * m_pMaterial->SpeLevel() );
device->SetShaderParameter(m_hLight, m_pMaterial->Diffuse() * env->GetCurrentLight().GetColor() );
device->SetShaderParameter(m_hShininess, m_pMaterial->Shininess() );
}