Base: Add fromPercent and toPercent helpers

This commit is contained in:
Kacper Donat
2025-02-20 00:02:06 +01:00
parent 7f984811e8
commit 2f35f1c561
12 changed files with 67 additions and 93 deletions

View File

@@ -95,7 +95,7 @@ DlgSettingsLightSources::DlgSettingsLightSources(QWidget* parent)
QCheckBox* enabledCheckbox,
std::function<void(bool)> setLightEnabled) {
light->color = Base::convertTo<SbColor>(colorButton->color());
light->intensity = intensitySpinBox->value() / 100.F;
light->intensity = Base::fromPercent(intensitySpinBox->value());
light->direction =
Base::convertTo<SbVec3f>(azimuthElevationToDirection(horizontalAngleSpinBox->rawValue(),
verticalAngleSpinBox->rawValue()));
@@ -161,7 +161,7 @@ DlgSettingsLightSources::DlgSettingsLightSources(QWidget* parent)
view->getEnvironment()->ambientColor =
Base::convertTo<SbColor>(ui->ambientLightColor->color());
view->getEnvironment()->ambientIntensity =
ui->ambientLightIntensitySpinBox->value() / 100.F;
Base::fromPercent(ui->ambientLightIntensitySpinBox->value());
};
connect(ui->ambientLightIntensitySpinBox,