本文整理汇总了C++中CLight::EnableLight方法的典型用法代码示例。如果您正苦于以下问题:C++ CLight::EnableLight方法的具体用法?C++ CLight::EnableLight怎么用?C++ CLight::EnableLight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLight
的用法示例。
在下文中一共展示了CLight::EnableLight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Render()
{
Matrix mat,mat1,mat2;
Bulid_XYZ_RotationMatrix(mat1,0.0,0.0,g_roty);
BuildTranslateMatrix(mat2,0.0,0.0,g_tranz);
static bool bDrawNonTextureCube=false;
if(KEY_DOWN(VK_F1))
{
//Draw the color cube. don't use texture
bDrawNonTextureCube = !bDrawNonTextureCube;
}
int icount = g_RenderManager.RenderObjectSize();
for(int i = 0; i < icount;++i)
{
CRenderObject *pobj = g_RenderManager[i];
POLYGONLIST &polygonlist = pobj->m_PolyGonList;
int polygonsize = polygonlist.size();
for( int j = 0; j < polygonsize;++j)
{
POLYGON &polygon = polygonlist[j];
if(bDrawNonTextureCube)
polygon.state &= ~OBJECT_HAS_TEXTURE;
else
polygon.state |= OBJECT_HAS_TEXTURE;
}
pobj->Transform(mat1);//transform local
pobj->world_pos *= mat2;
}
//local->world,world->camera,camera->screen
static bool bEnableLighting = false;
static bool bEableBackfaceRemove =false;
static bool bEnableInvZBuffer = false;
if(KEY_DOWN(VK_HOME))
{
//user press p
for(int i=0; i< g_lights.GetLightsCount();++i)
{
CLight* pLight = g_lights.GetLight(i);
pLight->EnableLight();
/* if(pLight->GetLightType() == CLight::kAmbientLight)
{
pLight->EnableLight();
break;
}*/
}
bEnableLighting = true;
}
else if(KEY_DOWN(VK_END))
{
bEnableLighting = false;
}
else if(KEY_DOWN(VK_F2))
{
bEableBackfaceRemove = true;
}
else if(KEY_DOWN(VK_F3))
{
bEableBackfaceRemove = false;
}
else if(KEY_DOWN(VK_F4))
{
bEnableInvZBuffer = true;
}
else if(KEY_DOWN(VK_F5))
{
bEnableInvZBuffer = false;
}
if(bEnableInvZBuffer)
ZBuffer::GetInstance()->Clear(0);
else
ZBuffer::GetInstance()->Clear((1<<30)-1);
g_RenderManager.Render(bEnableLighting,bEableBackfaceRemove,!bEnableInvZBuffer);
g_fps++;
}