Add camera::direction()
This commit is contained in:
parent
86785a5923
commit
2dd9ebae76
2 changed files with 7 additions and 0 deletions
|
|
@ -24,6 +24,8 @@ namespace psemek::geom
|
||||||
virtual vector<float, 3> axis_y() const;
|
virtual vector<float, 3> axis_y() const;
|
||||||
virtual vector<float, 3> axis_z() const;
|
virtual vector<float, 3> axis_z() const;
|
||||||
|
|
||||||
|
virtual vector<float, 3> direction() const;
|
||||||
|
|
||||||
// x, y are in clip-space [-1, 1]
|
// x, y are in clip-space [-1, 1]
|
||||||
// NB: this vector is not necessarily normalized
|
// NB: this vector is not necessarily normalized
|
||||||
virtual vector<float, 3> direction(float x, float y) const;
|
virtual vector<float, 3> direction(float x, float y) const;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,11 @@ namespace psemek::geom
|
||||||
return { b[0], b[1], b[2] };
|
return { b[0], b[1], b[2] };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<float, 3> camera::direction() const
|
||||||
|
{
|
||||||
|
return -axis_z();
|
||||||
|
}
|
||||||
|
|
||||||
vector<float, 3> camera::direction(float x, float y) const
|
vector<float, 3> camera::direction(float x, float y) const
|
||||||
{
|
{
|
||||||
vector<float, 4> b{ x, y, -1.f, 1.f};
|
vector<float, 4> b{ x, y, -1.f, 1.f};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue