Overrides - Camera angles problem fixed

Because of fucking numerical instability, updating the UI's input values
every frame caused problems. Fixed this by making sure it's set only if
the override is disabled or at the first frame after it is enabled.
This commit is contained in:
Emmanuel BENOîT 2017-11-20 11:36:30 +01:00
parent 75af2c15c7
commit 2b1657ac3a
2 changed files with 22 additions and 17 deletions

View file

@ -1125,9 +1125,10 @@ void T_CamOverride::makeEditWidgets(
T_StringBuilder& sb ) noexcept
{
auto& sinp( Globals::Sync( ).inputs( ) );
// Set field of view / near plane
auto const& fc( *fovConfig_ );
if ( !enabled( ) || !prevEnabled_ ) {
// Set field of view / near plane
if ( fc.mode == FM_FOV ) {
camera_.fieldOfView( sinp[ inputPos_[ fc.inputIndex ] ] );
} else {
@ -1145,6 +1146,8 @@ void T_CamOverride::makeEditWidgets(
const glm::vec3 up{ vectorFromInputs( *upVector_ ) };
camera_.camera( lookAt , position , up );
}
}
prevEnabled_ = enabled( );
// Draw UI
char const* const name( buildLabel( counter , sb ) );

View file

@ -267,6 +267,8 @@ class T_CamOverride : public A_SyncOverride
E_CamMode_ camMode_;
T_Camera camera_;
bool prevEnabled_{ false };
public:
T_CamOverride( T_String const& title ) noexcept;