本文整理汇总了C++中CLight::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CLight::SetColor方法的具体用法?C++ CLight::SetColor怎么用?C++ CLight::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLight
的用法示例。
在下文中一共展示了CLight::SetColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bCreateWorld
bool CEnvSphere::bCreateWorld()
{
m_pCamera = 0;
m_hSphere = 0;
m_hLight = 0;
// Create and setup camera ------------------------------------------------
m_pCamera = new CMyCamera( pGetGraphics() );
if( !m_pCamera->bCreateRenderCamera( iGetWindowWidth(), iGetWindowHeight() ) )
return false;
m_pCamera->CalculateProjection( M3D_PI * 0.5f, 10.0f, 0.1f );
m_pCamera->SetPosition( vector3( 0, 0, -2 ) );
m_pCamera->SetLookAt( vector3( 0, 0, 0 ), vector3( 0, 1, 0 ) );
m_pCamera->CalculateView();
// Register triangle-entity and create an instance ------------------------
pGetScene()->RegisterEntityType( "sphere", CSphere::pCreate );
m_hSphere = pGetScene()->hCreateEntity( "sphere" );
if( !m_hSphere )
return false;
CSphere *pSphere = (CSphere *)pGetScene()->pGetEntity( m_hSphere );
if( !pSphere->bInitialize( 1.0f, 16, 16, "majestic.cube" ) )
return false;
// Create the light -------------------------------------------------------
m_hLight = pGetScene()->hCreateLight();
if( !m_hLight )
return false;
CLight *pLight = pGetScene()->pGetLight( m_hLight );
pLight->SetPosition( vector3( 1.5f, 0.25f, 0 ) );
pLight->SetColor( vector4( 1, 1, 0.75f, 1 ) );
// Demonstrating smooth-subdivision to get a round sphere
// disable this and increase sphere-tesselation for better preformance (memory-usage will be higher!)
pGetGraphics()->SetRenderState( m3drs_subdivisionmode, m3dsubdiv_smooth );
pGetGraphics()->SetRenderState( m3drs_subdivisionlevels, 1 );
pGetGraphics()->SetRenderState( m3drs_subdivisionpositionregister, 0 );
pGetGraphics()->SetRenderState( m3drs_subdivisionnormalregister, 0 ); // using vertex-positions as normals (unit-sphere at origin)
return true;
}