1 #ifndef INCLUDE_AL_VIEWPOINT_HPP
2 #define INCLUDE_AL_VIEWPOINT_HPP
39 #include "al/graphics/al_Lens.hpp"
40 #include "al/spatial/al_Pose.hpp"
53 Viewport(
int w = 640,
int h = 480) : l(0), b(0), w(w),
h(
h) {}
59 Viewport(
int l,
int b,
int w,
int h) : l(l), b(b), w(w),
h(
h) {}
65 float aspect()
const {
return (
h != 0 && w != 0) ? float(w) /
h : 1; }
68 void set(
int l_,
int b_,
int w_,
int h_) {
82 return (l == v.l) && (b == v.b) && (w == v.w) && (
h == v.h);
97 const Lens& lens()
const {
return mLens; }
98 Lens& lens() {
return mLens; }
104 const Pose& pose()
const {
return *mPose; }
105 Pose& pose() {
return *mPose; }
112 Matrix4f projMatrix(
float aspect_ratio)
const;
113 Matrix4f projMatrix(
float width,
float height)
const {
114 return projMatrix(width / height);
119 Pose* mPose =
nullptr;
A local coordinate frame.
Viewpoint within a scene.
Matrix4< float > Matrix4f
Single-precision 4-by-4 matrix.
Viewport(int w=640, int h=480)
void set(int l_, int b_, int w_, int h_)
Set dimensions.
Viewport(int l, int b, int w, int h)
float aspect() const
Get aspect ratio (width divided by height)
int h
left, bottom, width, height