Added light attenuation settings.

This commit is contained in:
Leonardo Zide 2023-12-17 11:37:11 -08:00
parent 0e74aea5fa
commit d52159087c
7 changed files with 118 additions and 14 deletions

View file

@ -3185,6 +3185,26 @@ void lcModel::SetLightColor(lcLight* Light, const lcVector3& Color)
UpdateAllViews(); UpdateAllViews();
} }
void lcModel::SetLightAttenuationDistance(lcLight* Light, float Distance)
{
Light->SetAttenuationDistance(Distance, mCurrentStep, gMainWindow->GetAddKeys());
Light->UpdatePosition(mCurrentStep);
SaveCheckpoint(tr("Changing Light Attenuation Distance"));
gMainWindow->UpdateSelectedObjects(false);
UpdateAllViews();
}
void lcModel::SetLightAttenuationPower(lcLight* Light, float Power)
{
Light->SetAttenuationPower(Power, mCurrentStep, gMainWindow->GetAddKeys());
Light->UpdatePosition(mCurrentStep);
SaveCheckpoint(tr("Changing Light Attenuation Power"));
gMainWindow->UpdateSelectedObjects(false);
UpdateAllViews();
}
void lcModel::SetSpotLightConeAngle(lcLight* Light, float Angle) void lcModel::SetSpotLightConeAngle(lcLight* Light, float Angle)
{ {
Light->SetSpotConeAngle(Angle, mCurrentStep, gMainWindow->GetAddKeys()); Light->SetSpotConeAngle(Angle, mCurrentStep, gMainWindow->GetAddKeys());

View file

@ -370,6 +370,8 @@ public:
void SetLightType(lcLight* Light, lcLightType LightType); void SetLightType(lcLight* Light, lcLightType LightType);
void SetLightColor(lcLight* Light, const lcVector3& Color); void SetLightColor(lcLight* Light, const lcVector3& Color);
void SetLightAttenuationDistance(lcLight* Light, float Distance);
void SetLightAttenuationPower(lcLight* Light, float Power);
void SetSpotLightConeAngle(lcLight* Light, float Angle); void SetSpotLightConeAngle(lcLight* Light, float Angle);
void SetSpotLightPenumbraAngle(lcLight* Light, float Angle); void SetSpotLightPenumbraAngle(lcLight* Light, float Angle);
void SetSpotLightTightness(lcLight* Light, float Tightness); void SetSpotLightTightness(lcLight* Light, float Tightness);

View file

@ -27,7 +27,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType)
mPOVRayLight = false; mPOVRayLight = false;
mEnableCutoff = false; mEnableCutoff = false;
mAttenuation = lcVector3(1.0f, 0.0f, 0.0f);
mLightDiffuse = 1.0f; mLightDiffuse = 1.0f;
mLightSpecular = 1.0f; mLightSpecular = 1.0f;
mSpotExponent = 10.0f; mSpotExponent = 10.0f;
@ -40,12 +39,13 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType)
mRotationKeys.ChangeKey(lcMatrix33(mWorldMatrix), 1, true); mRotationKeys.ChangeKey(lcMatrix33(mWorldMatrix), 1, true);
mColorKeys.ChangeKey(mColor, 1, true); mColorKeys.ChangeKey(mColor, 1, true);
mPowerKeys.ChangeKey(mPower, 1, true); mPowerKeys.ChangeKey(mPower, 1, true);
mAttenuationDistanceKeys.ChangeKey(mAttenuationDistance, 1, true);
mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true);
mSpotConeAngleKeys.ChangeKey(mSpotConeAngle, 1, true); mSpotConeAngleKeys.ChangeKey(mSpotConeAngle, 1, true);
mSpotPenumbraAngleKeys.ChangeKey(mSpotPenumbraAngle, 1, true); mSpotPenumbraAngleKeys.ChangeKey(mSpotPenumbraAngle, 1, true);
mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true); mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true);
mAreaGridKeys.ChangeKey(mAreaGrid, 1, true); mAreaGridKeys.ChangeKey(mAreaGrid, 1, true);
mAttenuationKeys.ChangeKey(mAttenuation, 1, true);
mLightDiffuseKeys.ChangeKey(mLightDiffuse, 1, true); mLightDiffuseKeys.ChangeKey(mLightDiffuse, 1, true);
mLightSpecularKeys.ChangeKey(mLightSpecular, 1, true); mLightSpecularKeys.ChangeKey(mLightSpecular, 1, true);
mSpotCutoffKeys.ChangeKey(mSpotCutoff, 1, true); mSpotCutoffKeys.ChangeKey(mSpotCutoff, 1, true);
@ -158,6 +158,8 @@ void lcLight::SaveLDraw(QTextStream& Stream) const
SaveAttribute(Stream, mColor, mColorKeys, "LIGHT", "COLOR"); SaveAttribute(Stream, mColor, mColorKeys, "LIGHT", "COLOR");
SaveAttribute(Stream, mSize, mSizeKeys, "LIGHT", "SIZE"); SaveAttribute(Stream, mSize, mSizeKeys, "LIGHT", "SIZE");
SaveAttribute(Stream, mPower, mPowerKeys, "LIGHT", "POWER"); SaveAttribute(Stream, mPower, mPowerKeys, "LIGHT", "POWER");
SaveAttribute(Stream, mAttenuationDistance, mAttenuationDistanceKeys, "LIGHT", "ATTENUATION_DISTANCE");
SaveAttribute(Stream, mAttenuationPower, mAttenuationPowerKeys, "LIGHT", "ATTENUATION_POWER");
if (!mPOVRayLight) if (!mPOVRayLight)
{ {
@ -306,6 +308,10 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream)
continue; continue;
else if (LoadAttribute(Stream, Token, mPower, mPowerKeys, "POWER")) else if (LoadAttribute(Stream, Token, mPower, mPowerKeys, "POWER"))
continue; continue;
else if (LoadAttribute(Stream, Token, mAttenuationDistance, mAttenuationDistanceKeys, "ATTENUATION_DISTANCE"))
continue;
else if (LoadAttribute(Stream, Token, mAttenuationPower, mAttenuationPowerKeys, "ATTENUATION_POWER"))
continue;
else if (LoadAttribute(Stream, Token, mSpotConeAngle, mSpotConeAngleKeys, "SPOT_CONE_ANGLE")) else if (LoadAttribute(Stream, Token, mSpotConeAngle, mSpotConeAngleKeys, "SPOT_CONE_ANGLE"))
continue; continue;
else if (LoadAttribute(Stream, Token, mSpotPenumbraAngle, mSpotPenumbraAngleKeys, "SPOT_PENUMBRA_ANGLE")) else if (LoadAttribute(Stream, Token, mSpotPenumbraAngle, mSpotPenumbraAngleKeys, "SPOT_PENUMBRA_ANGLE"))
@ -665,6 +671,16 @@ void lcLight::SetColor(const lcVector3& Color, lcStep Step, bool AddKey)
mColorKeys.ChangeKey(Color, Step, AddKey); mColorKeys.ChangeKey(Color, Step, AddKey);
} }
void lcLight::SetAttenuationDistance(float Distance, lcStep Step, bool AddKey)
{
mAttenuationDistanceKeys.ChangeKey(Distance, Step, AddKey);
}
void lcLight::SetAttenuationPower(float Power, lcStep Step, bool AddKey)
{
mAttenuationPowerKeys.ChangeKey(Power, Step, AddKey);
}
void lcLight::SetSpotConeAngle(float Angle, lcStep Step, bool AddKey) void lcLight::SetSpotConeAngle(float Angle, lcStep Step, bool AddKey)
{ {
mSpotConeAngleKeys.ChangeKey(Angle, Step, AddKey); mSpotConeAngleKeys.ChangeKey(Angle, Step, AddKey);
@ -736,8 +752,9 @@ void lcLight::InsertTime(lcStep Start, lcStep Time)
mAreaGridKeys.InsertTime(Start, Time); mAreaGridKeys.InsertTime(Start, Time);
mSizeKeys.InsertTime(Start, Time); mSizeKeys.InsertTime(Start, Time);
mPowerKeys.InsertTime(Start, Time); mPowerKeys.InsertTime(Start, Time);
mAttenuationDistanceKeys.InsertTime(Start, Time);
mAttenuationPowerKeys.InsertTime(Start, Time);
mAttenuationKeys.InsertTime(Start, Time);
mLightDiffuseKeys.InsertTime(Start, Time); mLightDiffuseKeys.InsertTime(Start, Time);
mLightSpecularKeys.InsertTime(Start, Time); mLightSpecularKeys.InsertTime(Start, Time);
mSpotCutoffKeys.InsertTime(Start, Time); mSpotCutoffKeys.InsertTime(Start, Time);
@ -755,8 +772,9 @@ void lcLight::RemoveTime(lcStep Start, lcStep Time)
mAreaGridKeys.RemoveTime(Start, Time); mAreaGridKeys.RemoveTime(Start, Time);
mSizeKeys.RemoveTime(Start, Time); mSizeKeys.RemoveTime(Start, Time);
mPowerKeys.RemoveTime(Start, Time); mPowerKeys.RemoveTime(Start, Time);
mAttenuationDistanceKeys.RemoveTime(Start, Time);
mAttenuationPowerKeys.RemoveTime(Start, Time);
mAttenuationKeys.RemoveTime(Start, Time);
mLightDiffuseKeys.RemoveTime(Start, Time); mLightDiffuseKeys.RemoveTime(Start, Time);
mLightSpecularKeys.RemoveTime(Start, Time); mLightSpecularKeys.RemoveTime(Start, Time);
mSpotCutoffKeys.RemoveTime(Start, Time); mSpotCutoffKeys.RemoveTime(Start, Time);
@ -785,8 +803,9 @@ void lcLight::UpdatePosition(lcStep Step)
mAreaGrid = mAreaGridKeys.CalculateKey(Step); mAreaGrid = mAreaGridKeys.CalculateKey(Step);
mSize = mSizeKeys.CalculateKey(Step); mSize = mSizeKeys.CalculateKey(Step);
mPower = mPowerKeys.CalculateKey(Step); mPower = mPowerKeys.CalculateKey(Step);
mAttenuationDistance = mAttenuationDistanceKeys.CalculateKey(Step);
mAttenuationPower = mAttenuationPowerKeys.CalculateKey(Step);
mAttenuation = mAttenuationKeys.CalculateKey(Step);
mLightDiffuse = mLightDiffuseKeys.CalculateKey(Step); mLightDiffuse = mLightDiffuseKeys.CalculateKey(Step);
mLightSpecular = mLightSpecularKeys.CalculateKey(Step); mLightSpecular = mLightSpecularKeys.CalculateKey(Step);
mSpotCutoff = mSpotCutoffKeys.CalculateKey(Step); mSpotCutoff = mSpotCutoffKeys.CalculateKey(Step);
@ -1230,8 +1249,11 @@ void lcLight::RemoveKeyFrames()
mPowerKeys.RemoveAll(); mPowerKeys.RemoveAll();
mPowerKeys.ChangeKey(mPower, 1, true); mPowerKeys.ChangeKey(mPower, 1, true);
mAttenuationKeys.RemoveAll(); mAttenuationDistanceKeys.RemoveAll();
mAttenuationKeys.ChangeKey(mAttenuation, 1, true); mAttenuationDistanceKeys.ChangeKey(mAttenuationDistance, 1, true);
mAttenuationPowerKeys.RemoveAll();
mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true);
mLightDiffuseKeys.RemoveAll(); mLightDiffuseKeys.RemoveAll();
mLightDiffuseKeys.ChangeKey(mLightDiffuse, 1, true); mLightDiffuseKeys.ChangeKey(mLightDiffuse, 1, true);

View file

@ -248,6 +248,20 @@ public:
return mColor; return mColor;
} }
void SetAttenuationDistance(float Distance, lcStep Step, bool AddKey);
float GetAttenuationDistance() const
{
return mAttenuationDistance;
}
void SetAttenuationPower(float Power, lcStep Step, bool AddKey);
float GetAttenuationPower() const
{
return mAttenuationPower;
}
void SetSpotConeAngle(float Angle, lcStep Step, bool AddKey); void SetSpotConeAngle(float Angle, lcStep Step, bool AddKey);
float GetSpotConeAngle() const float GetSpotConeAngle() const
@ -336,7 +350,6 @@ public:
lcMatrix44 mWorldMatrix; lcMatrix44 mWorldMatrix;
lcVector3 mAttenuation;
bool mSpotBlendSet; bool mSpotBlendSet;
bool mSpotCutoffSet; bool mSpotCutoffSet;
bool mEnableCutoff; bool mEnableCutoff;
@ -367,6 +380,8 @@ protected:
lcVector3 mColor = lcVector3(1.0f, 1.0f, 1.0f); lcVector3 mColor = lcVector3(1.0f, 1.0f, 1.0f);
lcVector2 mSize = lcVector2(0.0f, 0.0f); lcVector2 mSize = lcVector2(0.0f, 0.0f);
float mPower = 1.0f; float mPower = 1.0f;
float mAttenuationDistance = 0.0f;
float mAttenuationPower = 0.0f;
float mSpotConeAngle = 80.0f; float mSpotConeAngle = 80.0f;
float mSpotPenumbraAngle = 0.0f; float mSpotPenumbraAngle = 0.0f;
float mSpotTightness = 0.0f; float mSpotTightness = 0.0f;
@ -383,12 +398,13 @@ protected:
lcObjectKeyArray<lcVector3> mColorKeys; lcObjectKeyArray<lcVector3> mColorKeys;
lcObjectKeyArray<lcVector2> mSizeKeys; lcObjectKeyArray<lcVector2> mSizeKeys;
lcObjectKeyArray<float> mPowerKeys; lcObjectKeyArray<float> mPowerKeys;
lcObjectKeyArray<float> mAttenuationDistanceKeys;
lcObjectKeyArray<float> mAttenuationPowerKeys;
lcObjectKeyArray<float> mSpotConeAngleKeys; lcObjectKeyArray<float> mSpotConeAngleKeys;
lcObjectKeyArray<float> mSpotPenumbraAngleKeys; lcObjectKeyArray<float> mSpotPenumbraAngleKeys;
lcObjectKeyArray<float> mSpotTightnessKeys; lcObjectKeyArray<float> mSpotTightnessKeys;
lcObjectKeyArray<lcVector2i> mAreaGridKeys; lcObjectKeyArray<lcVector2i> mAreaGridKeys;
lcObjectKeyArray<lcVector3> mAttenuationKeys;
lcObjectKeyArray<float> mLightSpecularKeys; lcObjectKeyArray<float> mLightSpecularKeys;
lcObjectKeyArray<float> mLightDiffuseKeys; lcObjectKeyArray<float> mLightDiffuseKeys;
lcObjectKeyArray<float> mSpotCutoffKeys; lcObjectKeyArray<float> mSpotCutoffKeys;

View file

@ -2007,7 +2007,7 @@ bool Project::ExportPOVRay(const QString& FileName)
sprintf(Line, sprintf(Line,
"#ifndef (SkipWriteLightMacro)\n" "#ifndef (SkipWriteLightMacro)\n"
"#macro WriteLight(Type, Shadowless, Location, Target, Color, Power, SpotRadius, SpotFalloff, SpotTightness, AreaCircle, AreaWidth, AreaHeight, AreaRows, AreaColumns)\n" "#macro WriteLight(Type, Shadowless, Location, Target, Color, Power, FadeDistance, FadePower, SpotRadius, SpotFalloff, SpotTightness, AreaCircle, AreaWidth, AreaHeight, AreaRows, AreaColumns)\n"
" #local PointLight = %i;\n" " #local PointLight = %i;\n"
" #local Spotlight = %i;\n" " #local Spotlight = %i;\n"
" #local DirectionalLight = %i;\n" " #local DirectionalLight = %i;\n"
@ -2018,6 +2018,12 @@ bool Project::ExportPOVRay(const QString& FileName)
" #if (Shadowless > 0)\n" " #if (Shadowless > 0)\n"
" shadowless\n" " shadowless\n"
" #end\n" " #end\n"
" #if (FadeDistance > 0)\n"
" fade_distance FadeDistance\n"
" #end\n"
" #if (FadePower > 0)\n"
" fade_power FadePower\n"
" #end\n"
" #if (Type = Spotlight)\n" " #if (Type = Spotlight)\n"
" spotlight\n" " spotlight\n"
" radius SpotRadius\n" " radius SpotRadius\n"
@ -2143,7 +2149,7 @@ bool Project::ExportPOVRay(const QString& FileName)
lcVector2i AreaGrid(1, 1); lcVector2i AreaGrid(1, 1);
int AreaCircle = 0, Shadowless = 0; int AreaCircle = 0, Shadowless = 0;
lcLightType LightType = lcLightType::Area; lcLightType LightType = lcLightType::Area;
float Power = 0, SpotRadius = 0, SpotFalloff = 0, SpotTightness = 0; float Power = 0.0f, FadeDistance = 0.0f, FadePower = 0.0f, SpotRadius = 0.0f, SpotFalloff = 0.0f, SpotTightness = 0.0f;
if (Lights.IsEmpty()) if (Lights.IsEmpty())
{ {
@ -2158,7 +2164,7 @@ bool Project::ExportPOVRay(const QString& FileName)
for (int Idx = 0; Idx < 4; Idx++) for (int Idx = 0; Idx < 4; Idx++)
{ {
Power = Idx < 2 ? 0.75f : 0.5f; Power = Idx < 2 ? 0.75f : 0.5f;
sprintf(Line,"#ifndef (SkipLight%i)\nWriteLight(%i, %i, <%g, %g, %g>, <%g, %g, %g>, <%g, %g, %g>, %g, %g, %g, %g, %i, <%g, %g, %g>, <%g, %g, %g>, %i, %i)\n#end\n\n", sprintf(Line,"#ifndef (SkipLight%i)\nWriteLight(%i, %i, <%g, %g, %g>, <%g, %g, %g>, <%g, %g, %g>, %g, %g, %g, %g, %g, %g, %i, <%g, %g, %g>, <%g, %g, %g>, %i, %i)\n#end\n\n",
Idx, Idx,
LightType, LightType,
Shadowless, Shadowless,
@ -2166,6 +2172,7 @@ bool Project::ExportPOVRay(const QString& FileName)
LightTarget[0], LightTarget[1], LightTarget[2], LightTarget[0], LightTarget[1], LightTarget[2],
LightColor[0], LightColor[1], LightColor[2], LightColor[0], LightColor[1], LightColor[2],
Power, Power,
FadeDistance, FadePower,
SpotRadius, SpotFalloff, SpotTightness, SpotRadius, SpotFalloff, SpotTightness,
AreaCircle, AreaX[0], AreaX[1], AreaX[2], AreaY[0], AreaY[1], AreaY[2], AreaGrid.x, AreaGrid.y); AreaCircle, AreaX[0], AreaX[1], AreaX[2], AreaY[0], AreaY[1], AreaY[2], AreaGrid.x, AreaGrid.y);
POVFile.WriteLine(Line); POVFile.WriteLine(Line);
@ -2182,6 +2189,8 @@ bool Project::ExportPOVRay(const QString& FileName)
LightType = Light->GetLightType(); LightType = Light->GetLightType();
Shadowless = Light->GetCastShadow() ? 0 : 1; Shadowless = Light->GetCastShadow() ? 0 : 1;
Power = Light->mPOVRayExponent; Power = Light->mPOVRayExponent;
FadeDistance = Light->GetAttenuationDistance();
FadePower = Light->GetAttenuationPower();
switch (LightType) switch (LightType)
{ {
@ -2207,7 +2216,7 @@ bool Project::ExportPOVRay(const QString& FileName)
break; break;
} }
sprintf(Line,"#ifndef (Skip%s)\n WriteLight(%i, %i, <%g, %g, %g>, <%g, %g, %g>, <%g, %g, %g>, %g, %g, %g, %g, %i, <%g, %g, %g>, <%g, %g, %g>, %i, %i)\n#end\n\n", sprintf(Line,"#ifndef (Skip%s)\n WriteLight(%i, %i, <%g, %g, %g>, <%g, %g, %g>, <%g, %g, %g>, %g, %g, %g, %g, %g, %g, %i, <%g, %g, %g>, <%g, %g, %g>, %i, %i)\n#end\n\n",
LightName.toLatin1().constData(), LightName.toLatin1().constData(),
LightType, LightType,
Shadowless, Shadowless,
@ -2215,6 +2224,7 @@ bool Project::ExportPOVRay(const QString& FileName)
LightTarget[1], LightTarget[0], LightTarget[2], LightTarget[1], LightTarget[0], LightTarget[2],
LightColor[0], LightColor[1], LightColor[2], LightColor[0], LightColor[1], LightColor[2],
Power, Power,
FadeDistance, FadePower,
SpotRadius, SpotFalloff, SpotTightness, SpotRadius, SpotFalloff, SpotTightness,
AreaCircle, AreaX[0], AreaX[1], AreaX[2], AreaY[0], AreaY[1], AreaY[2], AreaGrid.x, AreaGrid.y); AreaCircle, AreaX[0], AreaX[1], AreaX[2], AreaY[0], AreaY[1], AreaY[2], AreaGrid.x, AreaGrid.y);
POVFile.WriteLine(Line); POVFile.WriteLine(Line);

View file

@ -838,7 +838,19 @@ void lcQPropertiesTree::slotReturnPressed()
{ {
lcLightProperties Props = Light->GetLightProperties(); lcLightProperties Props = Light->GetLightProperties();
if (Item == mLightSpotConeAngleItem) if (Item == mLightAttenuationDistanceItem)
{
float Value = lcParseValueLocalized(Editor->text());
Model->SetLightAttenuationDistance(Light, Value);
}
else if (Item == mLightAttenuationPowerItem)
{
float Value = lcParseValueLocalized(Editor->text());
Model->SetLightAttenuationPower(Light, Value);
}
else if (Item == mLightSpotConeAngleItem)
{ {
float Value = lcParseValueLocalized(Editor->text()); float Value = lcParseValueLocalized(Editor->text());
@ -1124,6 +1136,8 @@ void lcQPropertiesTree::SetEmpty()
lightExponent = nullptr; lightExponent = nullptr;
mLightTypeItem = nullptr; mLightTypeItem = nullptr;
mLightNameItem = nullptr; mLightNameItem = nullptr;
mLightAttenuationDistanceItem = nullptr;
mLightAttenuationPowerItem = nullptr;
mLightSpotConeAngleItem = nullptr; mLightSpotConeAngleItem = nullptr;
mLightSpotPenumbraAngleItem = nullptr; mLightSpotPenumbraAngleItem = nullptr;
mLightSpotTightnessItem = nullptr; mLightSpotTightnessItem = nullptr;
@ -1387,6 +1401,8 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
lcVector2 LightSize(0.0f, 0.0f); lcVector2 LightSize(0.0f, 0.0f);
lcVector2i AreaGrid(2, 2); lcVector2i AreaGrid(2, 2);
float Power = 0.0f; float Power = 0.0f;
float AttenuationDistance = 0.0f;
float AttenuationPower = 0.0f;
int FormatIndex = 0; int FormatIndex = 0;
float Diffuse = 0.0f; float Diffuse = 0.0f;
float Specular = 0.0f; float Specular = 0.0f;
@ -1411,6 +1427,8 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
Position = Light->GetPosition(); Position = Light->GetPosition();
Color = lcQColorFromVector3(Light->GetColor()); Color = lcQColorFromVector3(Light->GetColor());
Power = Light->GetPower(); Power = Light->GetPower();
AttenuationDistance = Light->GetAttenuationDistance();
AttenuationPower = Light->GetAttenuationPower();
SpotConeAngle = Light->GetSpotConeAngle(); SpotConeAngle = Light->GetSpotConeAngle();
SpotPenumbraAngle = Light->GetSpotPenumbraAngle(); SpotPenumbraAngle = Light->GetSpotPenumbraAngle();
@ -1478,6 +1496,12 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
mLightCastShadowItem = addProperty(mLightAttributesItem, tr("Cast Shadows"), PropertyBool); mLightCastShadowItem = addProperty(mLightAttributesItem, tr("Cast Shadows"), PropertyBool);
mLightAttenuationDistanceItem = addProperty(mLightAttributesItem, tr("Attenuation Distance"), PropertyFloat);
mLightAttenuationDistanceItem->setToolTip(1, tr("The distance at which the full light intensity arrives (POV-Ray only)."));
mLightAttenuationPowerItem = addProperty(mLightAttributesItem, tr("Attenuation Power"), PropertyFloat);
mLightAttenuationPowerItem->setToolTip(1, tr("Light falloff rate (POV-Ray only)."));
switch (LightType) switch (LightType)
{ {
case lcLightType::Point: case lcLightType::Point:
@ -1624,6 +1648,14 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
mLightPowerItem->setText(1, lcFormatValueLocalized(Power)); mLightPowerItem->setText(1, lcFormatValueLocalized(Power));
mLightPowerItem->setData(0, PropertyValueRole, Power); mLightPowerItem->setData(0, PropertyValueRole, Power);
mLightAttenuationDistanceItem->setText(1, lcFormatValueLocalized(AttenuationDistance));
mLightAttenuationDistanceItem->setData(0, PropertyValueRole, AttenuationDistance);
mLightAttenuationDistanceItem->setData(0, PropertyRangeRole, QPointF(0.0, FLT_MAX));
mLightAttenuationPowerItem->setText(1, lcFormatValueLocalized(AttenuationPower));
mLightAttenuationPowerItem->setData(0, PropertyValueRole, AttenuationPower);
mLightAttenuationPowerItem->setData(0, PropertyRangeRole, QPointF(0.0, FLT_MAX));
lightFormat->setText(1, Format); lightFormat->setText(1, Format);
lightFormat->setData(0, PropertyValueRole, FormatIndex); lightFormat->setData(0, PropertyValueRole, FormatIndex);

View file

@ -125,6 +125,8 @@ protected:
QTreeWidgetItem* lightEnableCutoff; QTreeWidgetItem* lightEnableCutoff;
QTreeWidgetItem* lightExponent; QTreeWidgetItem* lightExponent;
QTreeWidgetItem* mLightTypeItem; QTreeWidgetItem* mLightTypeItem;
QTreeWidgetItem* mLightAttenuationDistanceItem;
QTreeWidgetItem* mLightAttenuationPowerItem;
QTreeWidgetItem* mLightSpotConeAngleItem; QTreeWidgetItem* mLightSpotConeAngleItem;
QTreeWidgetItem* mLightSpotPenumbraAngleItem; QTreeWidgetItem* mLightSpotPenumbraAngleItem;
QTreeWidgetItem* mLightSpotTightnessItem; QTreeWidgetItem* mLightSpotTightnessItem;