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


C++ Light::SetAttenuation方法代码示例

本文整理汇总了C++中Light::SetAttenuation方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::SetAttenuation方法的具体用法?C++ Light::SetAttenuation怎么用?C++ Light::SetAttenuation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Light的用法示例。


在下文中一共展示了Light::SetAttenuation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateLightsWithAnimStatic

void LightAnimation::CreateLightsWithAnimStatic()
{
	const float3 SponzaExtentInner[] = {
		float3(750,  10, -120),
		float3(750,  10, 230),
		float3(-950, 10, 230),
		float3(-950, 10, -100) };

	SceneManager* sceneMan = Environment::GetSingleton().GetSceneManager();

	const int NumLightX = 40;
	const int NumLightZ = 12;
	for (int i = 0; i < NumLightZ; ++i)
	{
		float t = float(i) / NumLightZ;
		float3 start = Lerp(SponzaExtentInner[0], SponzaExtentInner[1], t);
		float3 end = Lerp(SponzaExtentInner[3], SponzaExtentInner[2], t);

		for (int j = 0; j < NumLightX; ++j)
		{
			Light* light = sceneMan->CreateLight("", LT_PointLight);
			light->SetPosition(Lerp(start, end, float(j)/NumLightX));

			float3 color = IntensityDist(rng) * HueToRGB(HueDist(rng));
			light->SetLightColor(color);

			light->SetLightIntensity(1.0);
			light->SetAttenuation(1.0f, 0.0f);
			light->SetRange(25.0f);
			sceneMan->GetRootSceneNode()->AttachObject(light);

			mNumTotalLights++;
		}
	}
}
开发者ID:hustruan,项目名称:RcEngine,代码行数:35,代码来源:LightAnimation.cpp

示例2: Parse

void XmlSceneParser::Parse (const ParseNode& decl, Light& node, Node& parent, SceneContext& context)
{
  try
  {
      //предварительный разбор
      
    LightDeclPtr node_decl = impl->PrepareLight (decl);
    
      //настройка узла
      
    if (node_decl->light_color.state) node.SetLightColor (node_decl->light_color.value);
    if (node_decl->attenuation.state) node.SetAttenuation (node_decl->attenuation.value);
    if (node_decl->intensity.state)   node.SetIntensity (node_decl->intensity.value);
    if (node_decl->range.state)       node.SetRange (node_decl->range.value);
      
      //разбор родительских параметров
    
    Parse (decl, static_cast<Entity&> (node), parent, context);    
  }
  catch (xtl::exception& e)
  {
    e.touch ("scene_graph::XmlSceneParser::Parse(const ParseNode&,Light&,Node&,SceneContext&)");
    throw;
  }
}
开发者ID:untgames,项目名称:funner,代码行数:25,代码来源:sg_xml_scene_parser.cpp

示例3: CreateLightsWithAnimLine

void LightAnimation::CreateLightsWithAnimLine()
{
	SceneManager* sceneMan = Environment::GetSingleton().GetSceneManager();
	
	const int NumBandLights[] = { 10, 20 };

	for (int iFloor = 0; iFloor < 2; ++iFloor)
	{
		for (int iLine = 0; iLine < 4; ++iLine)
		{
			const int NumLight = NumBandLights[iLine & 0x1];
			const float3 LeftPos = SponzaExtent[iLine];
			const float3 RightPos = SponzaExtent[(iLine+1)%4];

			for (int32_t iLight = 0; iLight <  NumLight; ++iLight)
			{
				float3 position = Lerp(LeftPos, RightPos, float(iLight) / NumLight);

				position.Y() = SponzaFloorHeightRange[iFloor][0];

				//position.Y() = Lerp(SponzaFloorHeightRange[iFloor][0], SponzaFloorHeightRange[iFloor][1], NormDist(rng));

				float3 color = IntensityDist(rng) * HueToRGB(HueDist(rng));

				Light* light = sceneMan->CreateLight("", LT_PointLight);
				light->SetPosition(position);
				light->SetLightColor(color);
				light->SetLightIntensity(1.0);
				light->SetAttenuation(1.0f, 0.0f);
				light->SetRange(100);
				sceneMan->GetRootSceneNode()->AttachObject(light);

				LineAnimatedLight aminLight;
				aminLight.Light = light;
				aminLight.LineIndex = iLine;
				aminLight.FloorIndex = iFloor;
				mLineAnimatedLights.push_back(aminLight);

				mNumTotalLights++;
			}
		}
	}
}
开发者ID:hustruan,项目名称:RcEngine,代码行数:43,代码来源:LightAnimation.cpp

示例4: CreateLightsWithAnimEllipse

void LightAnimation::CreateLightsWithAnimEllipse()
{
	SceneManager* sceneMan = Environment::GetSingleton().GetSceneManager();

	const int NumEllipses = 10;
	const int NumLightsEllipse = 40;

	for (int i = 0; i < NumEllipses; ++i)
	{
		for (int j = 0; j < NumLightsEllipse; ++j)
		{
			EllipseAnimatedLight aminLight;

			aminLight.EllipseWidth = 950.0f;
			aminLight.EllipseHeight = 175.0f;
			aminLight.Height = Lerp(100.0f, 1000.0f, float(i) / NumEllipses);

			//aminLight.Angle = Mathf::TWO_PI / NumLightsEllipse * j;
			aminLight.Angle = AngleDist(rng);
			aminLight.AnimationSpeed = (AnimationDirection(rng) * 2 - 1) * AnimationSpeedDist(rng);

			float3 pos(aminLight.EllipseWidth * cosf(aminLight.Angle), aminLight.Height, aminLight.EllipseHeight * sinf(aminLight.Angle));
			float3 color = IntensityDist(rng) * HueToRGB(HueDist(rng));

			Light* light = sceneMan->CreateLight("", LT_PointLight);
			light->SetPosition(pos);
			light->SetLightColor(color);
			light->SetLightIntensity(1.0);
			light->SetAttenuation(1.0f, 0.0f);
			light->SetRange(100);
			sceneMan->GetRootSceneNode()->AttachObject(light);

			aminLight.Light = light;
			mEllipseAnimatedLights.push_back(aminLight);

			mNumTotalLights++;
		}
	}
}
开发者ID:hustruan,项目名称:RcEngine,代码行数:39,代码来源:LightAnimation.cpp


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