]> git.tdb.fi Git - libs/game.git/commitdiff
Don't allow setting a zero field of view at runtime
authorMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2025 11:50:36 +0000 (14:50 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2025 11:50:36 +0000 (14:50 +0300)
source/game/camera.cpp

index 927b620501e9cf5a7453de0fb04537e41602976a..1e35d21d608b6f07fef7bfcc9af10e9118f97443 100644 (file)
@@ -20,6 +20,9 @@ Camera::Camera(Handle<Entity> e, const CameraSetup &s):
 
 void Camera::set_field_of_view(Geometry::Angle<float> f, float a)
 {
+       if(f<=Geometry::Angle<float>::zero())
+               throw invalid_argument("Camera::set_field_of_view");
+
        Data &d = write();
        if(d.is_orthographic())
                throw logic_error("Camera is not perspective");