update_projection_matrix();
}
-void Camera::set_aspect(float a)
+void Camera::set_aspect_ratio(float a)
{
aspect = a;
update_projection_matrix();
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> &);
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 &);
// 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);
}
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);
{
camera = c;
if(camera)
- camera->set_aspect(get_aspect());
+ camera->set_aspect_ratio(get_aspect_ratio());
}
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()
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();
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