0.8.0 API documentation
index.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "type.hpp"
7 
8 namespace gli
9 {
11  template <typename T, precision P>
12  inline size_t linear_index(tvec1<T, P> const & Coord, tvec1<T, P> const & Dimensions)
13  {
14  GLI_ASSERT(glm::all(glm::lessThan(Coord, Dimensions)));
15  return static_cast<size_t>(Coord.x);
16  }
17 
19  template <typename T, precision P>
20  inline size_t linear_index(tvec2<T, P> const & Coord, tvec2<T, P> const & Dimensions)
21  {
22  GLI_ASSERT(glm::all(glm::lessThan(Coord, Dimensions)));
23  return static_cast<size_t>(Coord.x + Coord.y * Dimensions.x);
24  }
25 
27  template <typename T, precision P>
28  inline size_t linear_index(tvec3<T, P> const & Coord, tvec3<T, P> const & Dimensions)
29  {
30  GLI_ASSERT(glm::all(glm::lessThan(Coord, Dimensions)));
31  return static_cast<size_t>(Coord.x + Coord.y * Dimensions.x + Coord.z * Dimensions.x * Dimensions.y);
32  }
33 }//namespace gli
34 
Namespace where all the classes and functions provided by GLI are exposed.
Definition: comparison.hpp:15
Include to use basic GLI types.
size_t linear_index(tvec1< T, P > const &Coord, tvec1< T, P > const &Dimensions)
Compute an offset from the beginning of a storage to a specific texel stored in linear order...
Definition: index.hpp:12