camera settings
This commit is contained in:
parent
0db8d50359
commit
ce13648721
@ -64,6 +64,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="2%" width="100%" />
|
||||
|
||||
<div width="100%" height="fit" layout="horizontal-row">
|
||||
<spacer width="3%" height="100%" />
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<checkbox id="use_soccer_camera"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" text_align="left" I18N="In the ui/camera screen" text="Follow ball in soccer mode"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer width="100%" height="2%"/>
|
||||
<button id="close" text="Apply" align="center"/>
|
||||
<spacer width="100%" height="1%"/>
|
||||
|
@ -69,14 +69,6 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="follow_ball_backward_camera"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" I18N="In the ui settings" text="Follow ball in soccer mode for backward camera" word_wrap="true"/>
|
||||
</div>
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="showfps"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
|
@ -968,7 +968,88 @@ namespace UserConfigParams
|
||||
&m_camera_normal,
|
||||
"Focal distance (single player)"));
|
||||
|
||||
// ---- Saved custom camera settings
|
||||
PARAM_PREFIX BoolUserConfigParam m_reverse_look_use_soccer_cam
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
|
||||
"Use ball camera in soccer mode, instead of reverse") );
|
||||
|
||||
// ---- The present camera (default: Standard)
|
||||
PARAM_PREFIX IntUserConfigParam m_camera_present
|
||||
PARAM_DEFAULT( IntUserConfigParam(1, "camera-present",
|
||||
"The current used camera. 0=Custom; 1=Standard; 2=Drone chase") );
|
||||
|
||||
// ---- Standard camera settings
|
||||
PARAM_PREFIX GroupUserConfigParam m_standard_camera_settings
|
||||
PARAM_DEFAULT( GroupUserConfigParam(
|
||||
"standard-camera-settings",
|
||||
"Standard camera settings for player.") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_standard_camera_distance
|
||||
PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
|
||||
&m_standard_camera_settings,
|
||||
"Distance between kart and camera"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_standard_camera_forward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
|
||||
&m_standard_camera_settings,
|
||||
"Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_standard_camera_forward_smoothing
|
||||
PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
|
||||
&m_standard_camera_settings,
|
||||
"if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
|
||||
&m_standard_camera_settings,
|
||||
"Angle between camera and plane of kart (pitch) when the camera is pointing backwards. This is usually larger than the forward-up-angle, since the kart itself otherwise obstricts too much of the view"));
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_standard_camera_fov
|
||||
PARAM_DEFAULT( IntUserConfigParam(80, "fov",
|
||||
&m_standard_camera_settings,
|
||||
"Focal distance (single player)"));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_standard_reverse_look_use_soccer_cam
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
|
||||
&m_standard_camera_settings,
|
||||
"Use ball camera in soccer mode, instead of reverse"));
|
||||
|
||||
// ---- Drone chase camera settings
|
||||
PARAM_PREFIX GroupUserConfigParam m_drone_camera_settings
|
||||
PARAM_DEFAULT( GroupUserConfigParam(
|
||||
"drone-camera-settings",
|
||||
"Drone chase camera settings for player.") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_drone_camera_distance
|
||||
PARAM_DEFAULT( FloatUserConfigParam(2.6, "distance",
|
||||
&m_drone_camera_settings,
|
||||
"Distance between kart and camera"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_drone_camera_forward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(33, "forward-up-angle",
|
||||
&m_drone_camera_settings,
|
||||
"Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_drone_camera_forward_smoothing
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "forward-smoothing",
|
||||
&m_drone_camera_settings,
|
||||
"if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(10, "backward-up-angle",
|
||||
&m_drone_camera_settings,
|
||||
"Angle between camera and plane of kart (pitch) when the camera is pointing backwards. This is usually larger than the forward-up-angle, since the kart itself otherwise obstricts too much of the view"));
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_drone_camera_fov
|
||||
PARAM_DEFAULT( IntUserConfigParam(100, "fov",
|
||||
&m_drone_camera_settings,
|
||||
"Focal distance (single player)"));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_drone_reverse_look_use_soccer_cam
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
|
||||
&m_drone_camera_settings,
|
||||
"Use ball camera in soccer mode, instead of reverse"));
|
||||
|
||||
// ---- Custom camera settings
|
||||
PARAM_PREFIX GroupUserConfigParam m_saved_camera_settings
|
||||
PARAM_DEFAULT( GroupUserConfigParam(
|
||||
"saved-camera-settings",
|
||||
@ -999,6 +1080,10 @@ namespace UserConfigParams
|
||||
&m_saved_camera_settings,
|
||||
"Focal distance (single player)"));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_saved_reverse_look_use_soccer_cam
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
|
||||
&m_saved_camera_settings,
|
||||
"Use ball camera in soccer mode, instead of reverse"));
|
||||
|
||||
// camera in artist mode
|
||||
PARAM_PREFIX GroupUserConfigParam m_camera
|
||||
@ -1063,11 +1148,6 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT( FloatUserConfigParam(40.0, "camera-angle", &m_spectator,
|
||||
"Angle between ground, kart and camera.") );
|
||||
|
||||
// ---- Special settings for soccer mode
|
||||
PARAM_PREFIX BoolUserConfigParam m_reverse_look_use_soccer_cam
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
|
||||
"Use ball camera in soccer mode, instead of reverse") );
|
||||
|
||||
// ---- Handicap
|
||||
PARAM_PREFIX GroupUserConfigParam m_handicap
|
||||
PARAM_DEFAULT( GroupUserConfigParam("Handicap",
|
||||
|
@ -57,14 +57,38 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
getWidget<SpinnerWidget>("fov")->setRange(75, 115);
|
||||
getWidget<SpinnerWidget>("fov")->setValue(UserConfigParams::m_saved_camera_fov);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setRange(0 , 20, 0.1);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setRange(0 , 45);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setRange(0 , 45);
|
||||
if (UserConfigParams::m_camera_present == 1) // Standard camera
|
||||
{
|
||||
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_standard_camera_forward_smoothing);
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_standard_reverse_look_use_soccer_cam);
|
||||
// Not allowed to change fov, distance, and angles. Only allow to change smoothing and follow soccer
|
||||
getWidget<SpinnerWidget>("fov")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setActive(false);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setActive(false);
|
||||
}
|
||||
else if (UserConfigParams::m_camera_present == 2) // Drone chase camera
|
||||
{
|
||||
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_drone_camera_forward_smoothing);
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_drone_reverse_look_use_soccer_cam);
|
||||
// Not allowed to change fov, distance, and angles. Only allow to change smoothing and follow soccer
|
||||
getWidget<SpinnerWidget>("fov")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setActive(false);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setActive(false);
|
||||
}
|
||||
else // Custom camera
|
||||
{
|
||||
getWidget<SpinnerWidget>("fov")->setValue(UserConfigParams::m_saved_camera_fov);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setValue(UserConfigParams::m_saved_camera_forward_up_angle);
|
||||
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_saved_camera_forward_smoothing);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setRange(0 , 45);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setValue(UserConfigParams::m_saved_camera_backward_up_angle);
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_saved_reverse_look_use_soccer_cam);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -74,17 +98,33 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
if (eventSource == "close")
|
||||
{
|
||||
UserConfigParams::m_camera_forward_smoothing = getWidget<CheckBoxWidget>("camera_smoothing")->getState();
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = getWidget<CheckBoxWidget>("use_soccer_camera")->getState();
|
||||
if (UserConfigParams::m_camera_present == 1) // Standard camera, only smoothing and follow soccer is customizable
|
||||
{
|
||||
UserConfigParams::m_saved_camera_forward_smoothing = UserConfigParams::m_camera_forward_smoothing;
|
||||
UserConfigParams::m_standard_reverse_look_use_soccer_cam = UserConfigParams::m_reverse_look_use_soccer_cam;
|
||||
|
||||
}
|
||||
else if (UserConfigParams::m_camera_present == 2) // Drone chase camera, only smoothing and follow soccer is customizable
|
||||
{
|
||||
UserConfigParams::m_drone_camera_forward_smoothing = UserConfigParams::m_camera_forward_smoothing;
|
||||
UserConfigParams::m_drone_reverse_look_use_soccer_cam = UserConfigParams::m_reverse_look_use_soccer_cam;
|
||||
}
|
||||
else // Custom camera, everything is customizable
|
||||
{
|
||||
UserConfigParams::m_camera_fov = getWidget<SpinnerWidget>("fov")->getValue();
|
||||
UserConfigParams::m_camera_distance = getWidget<SpinnerWidget>("camera_distance")->getFloatValue();
|
||||
UserConfigParams::m_camera_forward_up_angle = getWidget<SpinnerWidget>("camera_angle")->getValue();
|
||||
UserConfigParams::m_camera_forward_smoothing = getWidget<CheckBoxWidget>("camera_smoothing")->getState();
|
||||
UserConfigParams::m_camera_backward_up_angle = getWidget<SpinnerWidget>("backward_camera_angle")->getValue();
|
||||
UserConfigParams::m_saved_camera_fov = UserConfigParams::m_camera_fov;
|
||||
UserConfigParams::m_saved_camera_distance = UserConfigParams::m_camera_distance;
|
||||
UserConfigParams::m_saved_camera_forward_up_angle = UserConfigParams::m_camera_forward_up_angle;
|
||||
UserConfigParams::m_saved_camera_forward_smoothing = UserConfigParams::m_camera_forward_smoothing;
|
||||
UserConfigParams::m_saved_camera_backward_up_angle = UserConfigParams::m_camera_backward_up_angle;
|
||||
UserConfigParams::m_saved_reverse_look_use_soccer_cam = UserConfigParams::m_reverse_look_use_soccer_cam;
|
||||
}
|
||||
OptionsScreenUI::getInstance()->updateCameraPresetSpinner();
|
||||
m_self_destroy = true;
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
|
@ -310,7 +310,6 @@ void OptionsScreenUI::init()
|
||||
}
|
||||
speedrun_timer->setState( UserConfigParams::m_speedrun_mode );
|
||||
|
||||
getWidget<CheckBoxWidget>("follow_ball_backward_camera")->setState(UserConfigParams::m_reverse_look_use_soccer_cam);
|
||||
// --- select the right skin in the spinner
|
||||
bool currSkinFound = false;
|
||||
const std::string& user_skin = UserConfigParams::m_skin_file;
|
||||
@ -340,30 +339,20 @@ void OptionsScreenUI::init()
|
||||
irr_driver->setMaxTextureSize();
|
||||
}
|
||||
|
||||
// Camera presets
|
||||
m_camera_presets.push_back // Standard
|
||||
({
|
||||
80 /* fov */, 1.0f /* distance */, 0.0f /* angle */, true /* smoothing */, 5.0f /* backward angle */,
|
||||
});
|
||||
|
||||
m_camera_presets.push_back // Drone chase
|
||||
({
|
||||
100 /* fov */, 2.6f /* distance */, 33.0f /* angle */, false /* smoothing */, 10.0f /* backward angle */,
|
||||
});
|
||||
|
||||
GUIEngine::SpinnerWidget* camera_preset = getWidget<GUIEngine::SpinnerWidget>("camera_preset");
|
||||
assert( camera_preset != NULL );
|
||||
|
||||
camera_preset->m_properties[PROP_WRAP_AROUND] = "true";
|
||||
camera_preset->clearLabels();
|
||||
//I18N: custom camera setting
|
||||
//I18N: In the UI options, Camera setting: Custom
|
||||
camera_preset->addLabel( core::stringw(_("Custom")));
|
||||
//I18N: In the UI options,litscreen_method in the race UI
|
||||
//I18N: In the UI options, Camera setting: Standard
|
||||
camera_preset->addLabel( core::stringw(_("Standard")));
|
||||
//I18N: In the UI options, splitscreen_method position in the race UI
|
||||
//I18N: In the UI options, Camera setting: Drone chase
|
||||
camera_preset->addLabel( core::stringw(_("Drone chase")));
|
||||
camera_preset->m_properties[GUIEngine::PROP_MIN_VALUE] = "1";
|
||||
camera_preset->m_properties[GUIEngine::PROP_MAX_VALUE] = "2";
|
||||
camera_preset->setValue(UserConfigParams::m_camera_present); // use the saved camera
|
||||
|
||||
updateCameraPresetSpinner();
|
||||
} // init
|
||||
@ -384,37 +373,7 @@ void OptionsScreenUI::updateCamera()
|
||||
|
||||
void OptionsScreenUI::updateCameraPresetSpinner()
|
||||
{
|
||||
GUIEngine::SpinnerWidget* camera_preset = getWidget<GUIEngine::SpinnerWidget>("camera_preset");
|
||||
assert( camera_preset != NULL );
|
||||
|
||||
#define FLOAT_EPSILON 0.001
|
||||
|
||||
bool found = false;
|
||||
unsigned int i = 0;
|
||||
for (; i < m_camera_presets.size(); i++)
|
||||
{
|
||||
if (m_camera_presets[i].fov == UserConfigParams::m_camera_fov &&
|
||||
m_camera_presets[i].smoothing == UserConfigParams::m_camera_forward_smoothing &&
|
||||
fabs(m_camera_presets[i].distance - UserConfigParams::m_camera_distance) < FLOAT_EPSILON &&
|
||||
fabs(m_camera_presets[i].angle - UserConfigParams::m_camera_forward_up_angle) < FLOAT_EPSILON &&
|
||||
fabs(m_camera_presets[i].backward_angle - UserConfigParams::m_camera_backward_up_angle) < FLOAT_EPSILON)
|
||||
{
|
||||
camera_preset->setValue(i + 1);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
getWidget("custom_camera")->setActive(true);
|
||||
camera_preset->setValue(0);
|
||||
camera_preset->m_properties[GUIEngine::PROP_MIN_VALUE] = std::to_string(0);
|
||||
}
|
||||
else
|
||||
getWidget("custom_camera")->setActive(false);
|
||||
updateCamera();
|
||||
|
||||
} // updateCameraPresetSpinner
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -550,30 +509,36 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
||||
GUIEngine::SpinnerWidget* camera_preset = getWidget<GUIEngine::SpinnerWidget>("camera_preset");
|
||||
assert( camera_preset != NULL );
|
||||
unsigned int i = camera_preset->getValue();
|
||||
if (i != 0)
|
||||
UserConfigParams::m_camera_present = i;
|
||||
if (i == 1) //Standard
|
||||
{
|
||||
UserConfigParams::m_camera_fov = m_camera_presets[i-1].fov;
|
||||
UserConfigParams::m_camera_distance = m_camera_presets[i-1].distance;
|
||||
UserConfigParams::m_camera_forward_up_angle = m_camera_presets[i-1].angle;
|
||||
UserConfigParams::m_camera_forward_smoothing = m_camera_presets[i-1].smoothing;
|
||||
UserConfigParams::m_camera_backward_up_angle = m_camera_presets[i-1].backward_angle;
|
||||
getWidget("custom_camera")->setActive(false);
|
||||
UserConfigParams::m_camera_fov = UserConfigParams::m_standard_camera_fov;
|
||||
UserConfigParams::m_camera_distance = UserConfigParams::m_standard_camera_distance;
|
||||
UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_standard_camera_forward_up_angle;
|
||||
UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_standard_camera_forward_smoothing;
|
||||
UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_standard_camera_backward_up_angle;
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_standard_reverse_look_use_soccer_cam;
|
||||
}
|
||||
else
|
||||
else if (i == 2) //Drone chase
|
||||
{
|
||||
UserConfigParams::m_camera_fov = UserConfigParams::m_drone_camera_fov;
|
||||
UserConfigParams::m_camera_distance = UserConfigParams::m_drone_camera_distance;
|
||||
UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_drone_camera_forward_up_angle;
|
||||
UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_drone_camera_forward_smoothing;
|
||||
UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_drone_camera_backward_up_angle;
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_drone_reverse_look_use_soccer_cam;
|
||||
}
|
||||
else //Custom
|
||||
{
|
||||
UserConfigParams::m_camera_fov = UserConfigParams::m_saved_camera_fov;
|
||||
UserConfigParams::m_camera_distance = UserConfigParams::m_saved_camera_distance;
|
||||
UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_saved_camera_forward_up_angle;
|
||||
UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_saved_camera_forward_smoothing;
|
||||
UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_saved_camera_backward_up_angle;
|
||||
getWidget("custom_camera")->setActive(true);
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_saved_reverse_look_use_soccer_cam;
|
||||
}
|
||||
updateCamera();
|
||||
}
|
||||
else if (name == "follow_ball_backward_camera")
|
||||
{
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = getWidget<CheckBoxWidget>("follow_ball_backward_camera")->getState();
|
||||
}
|
||||
else if(name == "custom_camera")
|
||||
{
|
||||
new CustomCameraSettingsDialog(0.8f, 0.9f);
|
||||
|
Loading…
Reference in New Issue
Block a user