13template <
typename T, cgv::type::u
int32_type N>
31 return origin + t * direction;
65 fvec<T, 4> world_coord(window_coord.
x(), window_coord.
y(), T(1), T(1));
66 world_coord = inv(view_projection_matrix) * world_coord;
67 world_coord /= world_coord.
w();
69 origin = eye_position;
70 direction = normalize(
fvec<T, 3>(world_coord) - eye_position);
76 return origin + t * direction;
81typedef ray<unsigned, 2> uray2;
82typedef ray<unsigned, 3> uray3;
83typedef ray<unsigned, 3> uray4;
84typedef ray<int, 2> iray2;
85typedef ray<int, 3> iray3;
86typedef ray<int, 3> iray4;
87typedef ray<float, 2> ray2;
88typedef ray<float, 3> ray3;
89typedef ray<float, 3> ray4;
90typedef ray<double, 2> dray2;
91typedef ray<double, 3> dray3;
92typedef ray<double, 3> dray4;
matrix of fixed size dimensions
A vector with zero based index.
fvec< T, 3 > position(float t) const
Returns the position of the ray at the given distance (ray parameter t) from its origin.
ray()
Construct an invalid ray with origin at zero and undefined direction.
ray(const fvec< T, 2 > &screen_coord, const fvec< unsigned, 2 > &viewport_size, const fvec< T, 3 > &eye_position, const fmat< T, 4, 4 > &view_projection_matrix)
Construct a ray from a given screen coordinate and view parameters.
ray(const fvec< T, 3 > &origin, const fvec< T, 3 > &direction)
Construct a ray with given origin and direction.
This class defines a template for n-dimensional rays with arbitrary data type defined by origin and d...
fvec< T, N > position(float t) const
Returns the position of the ray at the given distance (ray parameter t) from its origin.
ray(const fvec< T, N > &origin, const fvec< T, N > &direction)
Construct a ray with given origin and direction.
ray()
Construct an invalid ray with origin at zero and undefined direction.