2 #ifndef __PICKABLEMANAGER_HPP__
3 #define __PICKABLEMANAGER_HPP__
8 #include "al/graphics/al_Graphics.hpp"
9 #include "al/io/al_Window.hpp"
10 #include "al/math/al_Ray.hpp"
11 #include "al/ui/al_Pickable.hpp"
25 std::vector<Pickable *> pickables() {
return mPickables; }
31 void unhighlightAll();
41 Hit lastPoint() {
return mLastPoint; }
42 Hit lastPick() {
return mLastPick; }
45 std::vector<Pickable *> mPickables;
60 auto mvp = g.projMatrix() * v * g.modelMatrix();
63 return worldPos4.
sub<3>(0) / worldPos4.w;
66 Rayd getPickRay(
Graphics &g,
int screenX,
int screenY,
int width,
int height,
70 screenPos.x = (screenX * 1. / width) * 2. - 1.;
71 screenPos.y = ((height - screenY) * 1. / height) * 2. - 1.;
73 Vec3d worldPos = unproject(g, screenPos, view);
74 r.origin().
set(worldPos);
77 worldPos = unproject(g, screenPos, view);
78 r.direction().
set(worldPos);
79 r.direction() -= r.origin();
Interface for loading fonts and rendering text.
static Mat identity()
Get identity matrix.
static Matrix4 inverse(const Mat< 4, T > &m)
Get the inverse of a matrix.
Vec< 4, T > transform(const Vec< 4, T > &vCol) const
Computes product of matrix multiplied by column vector, r = m * vCol.
Vec & normalize(T scale=T(1))
Set magnitude to one without changing direction.
Vec & set(const Vec< N, T2 > &v)
Set elements from another vector.
Vec< M, T > sub(int begin=0) const
Get a subvector.