本文整理汇总了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++;
}
}
}
示例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;
}
}
示例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++;
}
}
}
}
示例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++;
}
}
}