Removed unused light options.

Specular is EEVEE only and Diffuse/Cutoff are unknown.
This commit is contained in:
Leonardo Zide 2023-12-17 12:16:32 -08:00
parent d52159087c
commit 321b9389ed
4 changed files with 2 additions and 190 deletions

View file

@ -26,12 +26,8 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType)
mWorldMatrix = lcMatrix44Translation(Position); mWorldMatrix = lcMatrix44Translation(Position);
mPOVRayLight = false; mPOVRayLight = false;
mEnableCutoff = false;
mLightDiffuse = 1.0f;
mLightSpecular = 1.0f;
mSpotExponent = 10.0f; mSpotExponent = 10.0f;
mPOVRayExponent = 1.0f; mPOVRayExponent = 1.0f;
mSpotCutoff = LightType != lcLightType::Directional ? 40.0f : 0.0f;
UpdateLightType(); UpdateLightType();
@ -46,9 +42,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType)
mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true); mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true);
mAreaGridKeys.ChangeKey(mAreaGrid, 1, true); mAreaGridKeys.ChangeKey(mAreaGrid, 1, true);
mLightDiffuseKeys.ChangeKey(mLightDiffuse, 1, true);
mLightSpecularKeys.ChangeKey(mLightSpecular, 1, true);
mSpotCutoffKeys.ChangeKey(mSpotCutoff, 1, true);
mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true); mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true);
UpdatePosition(1); UpdatePosition(1);
@ -161,19 +154,8 @@ void lcLight::SaveLDraw(QTextStream& Stream) const
SaveAttribute(Stream, mAttenuationDistance, mAttenuationDistanceKeys, "LIGHT", "ATTENUATION_DISTANCE"); SaveAttribute(Stream, mAttenuationDistance, mAttenuationDistanceKeys, "LIGHT", "ATTENUATION_DISTANCE");
SaveAttribute(Stream, mAttenuationPower, mAttenuationPowerKeys, "LIGHT", "ATTENUATION_POWER"); SaveAttribute(Stream, mAttenuationPower, mAttenuationPowerKeys, "LIGHT", "ATTENUATION_POWER");
if (!mPOVRayLight)
{
SaveAttribute(Stream, mLightDiffuse, mLightDiffuseKeys, "LIGHT", "DIFFUSE");
SaveAttribute(Stream, mLightSpecular, mLightSpecularKeys, "LIGHT", "SPECULAR");
}
// SaveAttribute(Stream, (mPOVRayLight ? mPOVRayExponent : mSpotExponent), mSpotExponentKeys, "LIGHT", "POWER"); // SaveAttribute(Stream, (mPOVRayLight ? mPOVRayExponent : mSpotExponent), mSpotExponentKeys, "LIGHT", "POWER");
if (mEnableCutoff && !mPOVRayLight)
{
SaveAttribute(Stream, mSpotCutoff, mSpotCutoffKeys, "LIGHT", "CUTOFF_DISTANCE");
}
switch (mLightType) switch (mLightType)
{ {
case lcLightType::Count: case lcLightType::Count:
@ -348,22 +330,6 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream)
// mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true); // mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true);
// } // }
// } // }
else if (Token == QLatin1String("DIFFUSE"))
{
Stream >>mLightDiffuse;
mLightDiffuseKeys.ChangeKey(mLightDiffuse, 1, true);
}
else if (Token == QLatin1String("SPECULAR"))
{
Stream >>mLightSpecular;
mLightSpecularKeys.ChangeKey(mLightSpecular, 1, true);
}
else if ((mSpotCutoffSet = Token == QLatin1String("CUTOFF_DISTANCE")))
{
mEnableCutoff = true;
Stream >> mSpotCutoff;
mSpotCutoffKeys.ChangeKey(mSpotCutoff, 1, true);
}
else if (Token == QLatin1String("TYPE")) else if (Token == QLatin1String("TYPE"))
{ {
QString Type; QString Type;
@ -388,37 +354,11 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream)
} }
else if ((Token == QLatin1String("POWER_KEY")) || (Token == QLatin1String("STRENGTH_KEY"))) else if ((Token == QLatin1String("POWER_KEY")) || (Token == QLatin1String("STRENGTH_KEY")))
mSpotExponentKeys.LoadKeysLDraw(Stream); mSpotExponentKeys.LoadKeysLDraw(Stream);
else if (Token == QLatin1String("DIFFUSE_KEY"))
mLightDiffuseKeys.LoadKeysLDraw(Stream);
else if (Token == QLatin1String("SPECULAR_KEY"))
mLightSpecularKeys.LoadKeysLDraw(Stream);
else if (Token == QLatin1String("CUTOFF_DISTANCE_KEY"))
mSpotCutoffKeys.LoadKeysLDraw(Stream);
else if (Token == QLatin1String("NAME")) else if (Token == QLatin1String("NAME"))
{ {
mName = Stream.readAll().trimmed(); mName = Stream.readAll().trimmed();
mName.replace("\"", ""); mName.replace("\"", "");
// Set default settings per light type
switch (mLightType)
{
case lcLightType::Point:
case lcLightType::Spot:
break;
case lcLightType::Directional:
if (!mSpotCutoffSet)
{
mSpotCutoff = 0.0f;
mSpotCutoffKeys.ChangeKey(mSpotCutoff, 1, true);
}
break;
case lcLightType::Area:
case lcLightType::Count:
break;
}
return true; return true;
} }
} }
@ -440,14 +380,6 @@ void lcLight::UpdateLight(lcStep Step, lcLightProperties Props, int Property)
{ {
switch(Property) switch(Property)
{ {
case LC_LIGHT_DIFFUSE:
mLightDiffuse = Props.mLightDiffuse;
mLightDiffuseKeys.ChangeKey(mLightDiffuse, Step, false);
break;
case LC_LIGHT_SPECULAR:
mLightSpecular = Props.mLightSpecular;
mLightSpecularKeys.ChangeKey(mLightSpecular, Step, false);
break;
case LC_LIGHT_EXPONENT: case LC_LIGHT_EXPONENT:
if (Props.mPOVRayLight) if (Props.mPOVRayLight)
{ {
@ -460,13 +392,6 @@ void lcLight::UpdateLight(lcStep Step, lcLightProperties Props, int Property)
mSpotExponentKeys.ChangeKey(mSpotExponent, Step, false); mSpotExponentKeys.ChangeKey(mSpotExponent, Step, false);
} }
break; break;
case LC_LIGHT_CUTOFF:
mSpotCutoff = Props.mSpotCutoff;
mSpotCutoffKeys.ChangeKey(mSpotCutoff, Step, false);
break;
case LC_LIGHT_USE_CUTOFF:
mEnableCutoff = Props.mEnableCutoff;
break;
case LC_LIGHT_POVRAY: case LC_LIGHT_POVRAY:
mPOVRayLight = Props.mPOVRayLight; mPOVRayLight = Props.mPOVRayLight;
break; break;
@ -755,9 +680,6 @@ void lcLight::InsertTime(lcStep Start, lcStep Time)
mAttenuationDistanceKeys.InsertTime(Start, Time); mAttenuationDistanceKeys.InsertTime(Start, Time);
mAttenuationPowerKeys.InsertTime(Start, Time); mAttenuationPowerKeys.InsertTime(Start, Time);
mLightDiffuseKeys.InsertTime(Start, Time);
mLightSpecularKeys.InsertTime(Start, Time);
mSpotCutoffKeys.InsertTime(Start, Time);
mSpotExponentKeys.InsertTime(Start, Time); mSpotExponentKeys.InsertTime(Start, Time);
} }
@ -775,9 +697,6 @@ void lcLight::RemoveTime(lcStep Start, lcStep Time)
mAttenuationDistanceKeys.RemoveTime(Start, Time); mAttenuationDistanceKeys.RemoveTime(Start, Time);
mAttenuationPowerKeys.RemoveTime(Start, Time); mAttenuationPowerKeys.RemoveTime(Start, Time);
mLightDiffuseKeys.RemoveTime(Start, Time);
mLightSpecularKeys.RemoveTime(Start, Time);
mSpotCutoffKeys.RemoveTime(Start, Time);
mSpotExponentKeys.RemoveTime(Start, Time); mSpotExponentKeys.RemoveTime(Start, Time);
} }
@ -806,9 +725,6 @@ void lcLight::UpdatePosition(lcStep Step)
mAttenuationDistance = mAttenuationDistanceKeys.CalculateKey(Step); mAttenuationDistance = mAttenuationDistanceKeys.CalculateKey(Step);
mAttenuationPower = mAttenuationPowerKeys.CalculateKey(Step); mAttenuationPower = mAttenuationPowerKeys.CalculateKey(Step);
mLightDiffuse = mLightDiffuseKeys.CalculateKey(Step);
mLightSpecular = mLightSpecularKeys.CalculateKey(Step);
mSpotCutoff = mSpotCutoffKeys.CalculateKey(Step);
mSpotExponent = mSpotExponentKeys.CalculateKey(Step); mSpotExponent = mSpotExponentKeys.CalculateKey(Step);
} }
@ -1255,15 +1171,6 @@ void lcLight::RemoveKeyFrames()
mAttenuationPowerKeys.RemoveAll(); mAttenuationPowerKeys.RemoveAll();
mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true); mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true);
mLightDiffuseKeys.RemoveAll();
mLightDiffuseKeys.ChangeKey(mLightDiffuse, 1, true);
mLightSpecularKeys.RemoveAll();
mLightSpecularKeys.ChangeKey(mLightSpecular, 1, true);
mSpotCutoffKeys.RemoveAll();
mSpotCutoffKeys.ChangeKey(mSpotCutoff, 1, true);
mSpotExponentKeys.RemoveAll(); mSpotExponentKeys.RemoveAll();
mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true); mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true);
} }

View file

@ -33,21 +33,13 @@ enum class lcLightAreaShape
enum lcLightProperty enum lcLightProperty
{ {
LC_LIGHT_DIFFUSE,
LC_LIGHT_SPECULAR,
LC_LIGHT_EXPONENT, LC_LIGHT_EXPONENT,
LC_LIGHT_CUTOFF,
LC_LIGHT_USE_CUTOFF,
LC_LIGHT_POVRAY LC_LIGHT_POVRAY
}; };
struct lcLightProperties struct lcLightProperties
{ {
float mLightDiffuse;
float mLightSpecular;
float mSpotExponent; float mSpotExponent;
float mSpotCutoff;
bool mEnableCutoff;
bool mPOVRayLight; bool mPOVRayLight;
}; };
@ -339,24 +331,14 @@ public:
lcLightProperties GetLightProperties() const lcLightProperties GetLightProperties() const
{ {
lcLightProperties props; lcLightProperties props;
props.mLightDiffuse = mLightDiffuse;
props.mLightSpecular = mLightSpecular;
props.mSpotExponent = mSpotExponent; props.mSpotExponent = mSpotExponent;
props.mSpotCutoff = mSpotCutoff;
props.mPOVRayLight = mPOVRayLight; props.mPOVRayLight = mPOVRayLight;
props.mEnableCutoff = mEnableCutoff;
return props; return props;
} }
lcMatrix44 mWorldMatrix; lcMatrix44 mWorldMatrix;
bool mSpotBlendSet;
bool mSpotCutoffSet;
bool mEnableCutoff;
bool mPOVRayLight; bool mPOVRayLight;
float mLightDiffuse;
float mLightSpecular;
float mSpotCutoff;
float mSpotExponent; float mSpotExponent;
float mPOVRayExponent; float mPOVRayExponent;
@ -405,9 +387,6 @@ protected:
lcObjectKeyArray<float> mSpotTightnessKeys; lcObjectKeyArray<float> mSpotTightnessKeys;
lcObjectKeyArray<lcVector2i> mAreaGridKeys; lcObjectKeyArray<lcVector2i> mAreaGridKeys;
lcObjectKeyArray<float> mLightSpecularKeys;
lcObjectKeyArray<float> mLightDiffuseKeys;
lcObjectKeyArray<float> mSpotCutoffKeys;
lcObjectKeyArray<float> mSpotExponentKeys; lcObjectKeyArray<float> mSpotExponentKeys;
static constexpr float mTargetDistance = 50.0f; static constexpr float mTargetDistance = 50.0f;

View file

@ -658,13 +658,7 @@ void lcQPropertiesTree::slotToggled(bool Value)
if (Light) if (Light)
{ {
if (Item == lightEnableCutoff) if (Item == mLightCastShadowItem)
{
lcLightProperties Props = Light->GetLightProperties();
Props.mEnableCutoff = Value;
Model->UpdateLight(Light, Props, LC_LIGHT_USE_CUTOFF);
}
else if (Item == mLightCastShadowItem)
{ {
Model->SetLightCastShadow(Light, Value); Model->SetLightCastShadow(Light, Value);
} }
@ -902,30 +896,12 @@ void lcQPropertiesTree::slotReturnPressed()
Model->SetLightPower(Light, Value); Model->SetLightPower(Light, Value);
} }
else if (Item == lightDiffuse)
{
Props.mLightDiffuse = lcParseValueLocalized(Editor->text());
Model->UpdateLight(Light, Props, LC_LIGHT_DIFFUSE);
}
else if (Item == lightSpecular)
{
Props.mLightSpecular = lcParseValueLocalized(Editor->text());
Model->UpdateLight(Light, Props, LC_LIGHT_SPECULAR);
}
else if (Item == lightExponent) else if (Item == lightExponent)
{ {
Props.mSpotExponent = lcParseValueLocalized(Editor->text()); Props.mSpotExponent = lcParseValueLocalized(Editor->text());
Model->UpdateLight(Light, Props, LC_LIGHT_EXPONENT); Model->UpdateLight(Light, Props, LC_LIGHT_EXPONENT);
} }
else if (Item == lightCutoff)
{
Props.mSpotCutoff = lcParseValueLocalized(Editor->text());
Model->UpdateLight(Light, Props, LC_LIGHT_CUTOFF);
}
else if (Item == mLightNameItem) else if (Item == mLightNameItem)
{ {
QString Value = Editor->text(); QString Value = Editor->text();
@ -1129,10 +1105,6 @@ void lcQPropertiesTree::SetEmpty()
mLightColorItem = nullptr; mLightColorItem = nullptr;
mLightPowerItem = nullptr; mLightPowerItem = nullptr;
mLightAttributesItem = nullptr; mLightAttributesItem = nullptr;
lightDiffuse = nullptr;
lightSpecular = nullptr;
lightCutoff = nullptr;
lightEnableCutoff = nullptr;
lightExponent = nullptr; lightExponent = nullptr;
mLightTypeItem = nullptr; mLightTypeItem = nullptr;
mLightNameItem = nullptr; mLightNameItem = nullptr;
@ -1394,8 +1366,7 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
QString Name = tr("Light"); QString Name = tr("Light");
QString ExponentLabel = tr("Exponent"); QString ExponentLabel = tr("Exponent");
QString FactorALabel = QLatin1String("FactorA"); QString Format, ExponentToolTip;
QString Format, ExponentToolTip, FactorAToolTip, FactorBToolTip;
lcLightType LightType = lcLightType::Point; lcLightType LightType = lcLightType::Point;
lcLightAreaShape LightAreaShape = lcLightAreaShape::Rectangle; lcLightAreaShape LightAreaShape = lcLightAreaShape::Rectangle;
lcVector2 LightSize(0.0f, 0.0f); lcVector2 LightSize(0.0f, 0.0f);
@ -1404,8 +1375,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
float AttenuationDistance = 0.0f; float AttenuationDistance = 0.0f;
float AttenuationPower = 0.0f; float AttenuationPower = 0.0f;
int FormatIndex = 0; int FormatIndex = 0;
float Diffuse = 0.0f;
float Specular = 0.0f;
float Cutoff = 0.0f; float Cutoff = 0.0f;
float Exponent = 0.0f; float Exponent = 0.0f;
bool EnableCutoff = false; bool EnableCutoff = false;
@ -1444,7 +1413,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
break; break;
case lcLightType::Spot: case lcLightType::Spot:
FactorBToolTip = tr("The softness of the spotlight edge.");
ExponentLabel = tr("Power"); ExponentLabel = tr("Power");
break; break;
@ -1459,9 +1427,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
break; break;
} }
Diffuse = Light->mLightDiffuse;
Specular = Light->mLightSpecular;
if (POVRayLight) if (POVRayLight)
{ {
Exponent = Light->mPOVRayExponent; Exponent = Light->mPOVRayExponent;
@ -1474,8 +1439,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
} }
ExponentLabel = LightType == lcLightType::Directional ? tr("Strength") : tr("Power"); ExponentLabel = LightType == lcLightType::Directional ? tr("Strength") : tr("Power");
Cutoff = Light->mSpotCutoff;
EnableCutoff = Light->mEnableCutoff;
SpotTightness = Light->GetSpotTightness(); SpotTightness = Light->GetSpotTightness();
} }
@ -1571,18 +1534,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
lightExponent = addProperty(mLightAttributesItem, ExponentLabel, PropertyFloat); lightExponent = addProperty(mLightAttributesItem, ExponentLabel, PropertyFloat);
if (!POVRayLight)
{
if (LightType != lcLightType::Directional)
{
lightEnableCutoff = addProperty(mLightAttributesItem, tr("Cutoff"), PropertyBool);
lightCutoff = addProperty(mLightAttributesItem, tr("Cutoff Distance"), PropertyFloat);
}
lightDiffuse = addProperty(mLightAttributesItem, tr("Diffuse"), PropertyFloat);
lightSpecular = addProperty(mLightAttributesItem, tr("Specular"), PropertyFloat);
}
// Configuration // Configuration
lightConfiguration = addProperty(nullptr, tr("Configuration"), PropertyGroup); lightConfiguration = addProperty(nullptr, tr("Configuration"), PropertyGroup);
lightFormat = addProperty(lightConfiguration, tr("Format"), PropertyLightFormat); lightFormat = addProperty(lightConfiguration, tr("Format"), PropertyLightFormat);
@ -1715,27 +1666,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
break; break;
} }
if (!POVRayLight)
{
if (LightType != lcLightType::Directional)
{
lightEnableCutoff->setCheckState(1, EnableCutoff ? Qt::Checked : Qt::Unchecked);
lightEnableCutoff->setData(0, PropertyValueRole, EnableCutoff);
lightCutoff->setText(1, lcFormatValueLocalized(Cutoff));
lightCutoff->setData(0, PropertyValueRole, Cutoff);
lightCutoff->setToolTip(1, tr("Distance at which the light influence will be set to 0."));
}
lightDiffuse->setText(1, lcFormatValueLocalized(Diffuse));
lightDiffuse->setData(0, PropertyValueRole, Diffuse);
lightDiffuse->setToolTip(1, tr("Diffuse reflection multiplier factor."));
lightSpecular->setText(1, lcFormatValueLocalized(Specular));
lightSpecular->setData(0, PropertyValueRole, Specular);
lightSpecular->setToolTip(1, tr("Specular reflection multiplier factor."));
}
mLightNameItem->setText(1, Name); mLightNameItem->setText(1, Name);
mLightNameItem->setData(0, PropertyValueRole, QVariant::fromValue(Name)); mLightNameItem->setData(0, PropertyValueRole, QVariant::fromValue(Name));
} }

View file

@ -119,10 +119,6 @@ protected:
QTreeWidgetItem* mLightColorItem; QTreeWidgetItem* mLightColorItem;
QTreeWidgetItem* mLightPowerItem; QTreeWidgetItem* mLightPowerItem;
QTreeWidgetItem* mLightAttributesItem; QTreeWidgetItem* mLightAttributesItem;
QTreeWidgetItem* lightDiffuse;
QTreeWidgetItem* lightSpecular;
QTreeWidgetItem* lightCutoff;
QTreeWidgetItem* lightEnableCutoff;
QTreeWidgetItem* lightExponent; QTreeWidgetItem* lightExponent;
QTreeWidgetItem* mLightTypeItem; QTreeWidgetItem* mLightTypeItem;
QTreeWidgetItem* mLightAttenuationDistanceItem; QTreeWidgetItem* mLightAttenuationDistanceItem;