当前位置: 首页>>代码示例>>C++>>正文


C++ CLight::EnableLight方法代码示例

本文整理汇总了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++;
}
开发者ID:orbv,项目名称:Simple-3D-Software-Render,代码行数:79,代码来源:Main.cpp


注:本文中的CLight::EnableLight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。