]> git.tdb.fi Git - libs/gl.git/commitdiff
Rename various get/set_aspect functions to aspect_ratio
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Dec 2017 10:54:39 +0000 (12:54 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Dec 2017 10:55:33 +0000 (12:55 +0200)
That's the correct term.  The old versions have been left in and marked
as deprecated for now.

source/camera.cpp
source/camera.h
source/environmentmap.cpp
source/scene.cpp
source/view.cpp
source/view.h
source/windowview.cpp

index e15d1cfe5f8a8107f79ad3cac96717315f2712a7..6ae162aeb77909fca84b20fa8bf9b9ed3389dfef 100644 (file)
@@ -36,7 +36,7 @@ void Camera::set_orthographic(float w, float h)
        update_projection_matrix();
 }
 
-void Camera::set_aspect(float a)
+void Camera::set_aspect_ratio(float a)
 {
        aspect = a;
        update_projection_matrix();
index d96ada81e45c4c26840e79c4b813f6034c1a8d82..1c13e67d9d6de544a1aa0a73c00e0fcb4e4f0248 100644 (file)
@@ -29,7 +29,7 @@ public:
 
        void set_field_of_view(const Geometry::Angle<float> &);
        void set_orthographic(float, float);
-       void set_aspect(float);
+       void set_aspect_ratio(float);
        void set_depth_clip(float, float);
        void set_frustum_axis(float, float);
        void set_frustum_rotation(const Geometry::Angle<float> &);
@@ -37,11 +37,15 @@ public:
        bool is_orthographic() const { return fov==Geometry::Angle<float>::zero(); }
        float get_orthographic_width() const { return height*aspect; }
        float get_orthographic_height() const { return height; }
-       float get_aspect() const { return aspect; }
+       float get_aspect_ratio() const { return aspect; }
        float get_near_clip() const { return clip_near; }
        float get_far_clip() const { return clip_far; }
        const Geometry::Angle<float> &get_frustum_rotation() const { return rotate; }
 
+       // Deprecated, use set/get_aspect_ratio instead
+       void set_aspect(float a) { set_aspect_ratio(a); }
+       float get_aspect() const { return get_aspect_ratio(); }
+
        void set_position(const Vector3 &);
        void set_look_direction(const Vector3 &);
        void look_at(const Vector3 &);
index 94ae5150a7aee552a12bf2519c44e8733e59cae0..b55dd2c7c6cca956d000a4823859b102b9513086 100644 (file)
@@ -25,7 +25,7 @@ EnvironmentMap::EnvironmentMap(unsigned s, Renderable &r, Renderable &e):
 
        // XXX Make the depth range configurable
        camera.set_field_of_view(Geometry::Angle<float>::right());
-       camera.set_aspect(1);
+       camera.set_aspect_ratio(1);
        camera.set_depth_clip(0.1, 100);
 
 }
index 9d301fbfb0801ab3d1ea95b5104d88f81b94d902..fbde0cd34dff6c0960238c6d5384cef1a99fcff5 100644 (file)
@@ -40,7 +40,7 @@ bool Scene::setup_frustum(const Renderer &renderer) const
                frustum_edges[0] = Vector4(0, 1/s, y/s, 0);
                frustum_edges[1] = Vector4(0, -1/s, y/s, 0);
 
-               float x = y*camera->get_aspect();
+               float x = y*camera->get_aspect_ratio();
                s = sqrt(x*x+1);
                frustum_edges[2] = Vector4(1/s, 0, x/s, 0);
                frustum_edges[3] = Vector4(-1/s, 0, x/s, 0);
index f531905f59e1ae387908538c4198489f27fa79ad..074967cfe1e3b14cafb925e0902e9e9cf11500b0 100644 (file)
@@ -16,7 +16,7 @@ void View::set_camera(Camera *c)
 {
        camera = c;
        if(camera)
-               camera->set_aspect(get_aspect());
+               camera->set_aspect_ratio(get_aspect_ratio());
 }
 
 void View::set_content(Renderable *r)
@@ -27,7 +27,7 @@ void View::set_content(Renderable *r)
 void View::synchronize_camera_aspect(Camera &c)
 {
        synced_cameras.push_back(&c);
-       c.set_aspect(get_aspect());
+       c.set_aspect_ratio(get_aspect_ratio());
 }
 
 void View::render()
index 08629fa065ab159725a5d025ca0b4dc1093f488b..6aca12f1a117ab3d3c0f14ffdfb565075d289d0b 100644 (file)
@@ -26,12 +26,13 @@ protected:
 public:
        virtual unsigned get_width() const { return target.get_width(); }
        virtual unsigned get_height() const { return target.get_height(); }
-       float get_aspect() const { return static_cast<float>(get_width())/get_height(); }
+       float get_aspect_ratio() const { return static_cast<float>(get_width())/get_height(); }
 
        void set_camera(Camera *);
        void set_content(Renderable *);
 
        // Deprecated
+       float get_aspect() const { return get_aspect_ratio(); }
        void synchronize_camera_aspect(Camera &);
 
        virtual void render();
index 61027acc126a13d85abc84ee7ca50d73ed4b5015..6a0eebda574034de2beb0025d84bec924d781ebb 100644 (file)
@@ -25,9 +25,9 @@ void WindowView::window_resized(unsigned w, unsigned h)
        target.viewport(0, 0, w, h);
        float aspect = static_cast<float>(w)/h;
        if(camera)
-               camera->set_aspect(aspect);
+               camera->set_aspect_ratio(aspect);
        for(list<Camera *>::iterator i=synced_cameras.begin(); i!=synced_cameras.end(); ++i)
-               (*i)->set_aspect(aspect);
+               (*i)->set_aspect_ratio(aspect);
 }
 
 } // namespace GL