8 template <
typename T, precision P,
template <
typename, precision>
class vecType>
9 inline vecType<bool, P> in_interval(vecType<T, P>
const& Value, vecType<T, P>
const& Min, vecType<T, P>
const& Max)
11 return greaterThanEqual(Value, Min) && lessThanEqual(Value, Max);
14 template <
typename extent_type,
typename normalized_type>
18 typename extent_type::bool_type UseTexel;
21 template <
typename extent_type,
typename normalized_type>
22 inline coord_nearest<extent_type, normalized_type> make_coord_nearest(extent_type
const& TexelExtent, normalized_type
const& SampleCoord)
24 normalized_type
const TexelLast(normalized_type(TexelExtent) - normalized_type(1));
26 coord_nearest<extent_type, normalized_type> Coord;
27 Coord.Texel = extent_type(round(SampleCoord * TexelLast));
28 Coord.UseTexel = in_interval(Coord.Texel, extent_type(0), TexelExtent - 1);
32 template <
typename extent_type,
typename normalized_type>
35 extent_type TexelFloor;
36 extent_type TexelCeil;
37 normalized_type Blend;
40 template <
typename extent_type,
typename normalized_type>
41 struct coord_linear_border :
public coord_linear<extent_type, normalized_type>
43 typename extent_type::bool_type UseTexelFloor;
44 typename extent_type::bool_type UseTexelCeil;
47 template <
typename extent_type,
typename normalized_type>
48 GLI_FORCE_INLINE coord_linear<extent_type, normalized_type> make_coord_linear(extent_type
const& TexelExtent, normalized_type
const& SampleCoord)
50 coord_linear<extent_type, normalized_type> Coord;
52 normalized_type
const TexelExtentF(TexelExtent);
53 normalized_type
const TexelLast = TexelExtentF - normalized_type(1);
54 normalized_type
const ScaledCoord(SampleCoord * TexelLast);
55 normalized_type
const ScaledCoordFloor = normalized_type(extent_type(ScaledCoord));
56 normalized_type
const ScaledCoordCeil = normalized_type(extent_type(ScaledCoord + normalized_type(0.5)));
60 Coord.Blend = ScaledCoord - ScaledCoordFloor;
61 Coord.TexelFloor = extent_type(ScaledCoordFloor);
62 Coord.TexelCeil = extent_type(ScaledCoordCeil);
67 template <
typename extent_type,
typename normalized_type>
68 GLI_FORCE_INLINE coord_linear_border<extent_type, normalized_type> make_coord_linear_border(extent_type
const& TexelExtent, normalized_type
const& SampleCoord)
70 coord_linear_border<extent_type, normalized_type> Coord;
72 normalized_type
const TexelExtentF(TexelExtent);
73 normalized_type
const TexelLast = TexelExtentF - normalized_type(1);
74 normalized_type
const ScaledCoord(SampleCoord * TexelLast);
75 normalized_type
const ScaledCoordFloor(floor(ScaledCoord));
76 normalized_type
const ScaledCoordCeil(ceil(ScaledCoord));
78 Coord.Blend = ScaledCoord - ScaledCoordFloor;
79 Coord.TexelFloor = extent_type(ScaledCoordFloor);
80 Coord.TexelCeil = extent_type(ScaledCoordCeil);
81 Coord.UseTexelFloor = in_interval(Coord.TexelFloor, extent_type(0), TexelExtent - 1);
82 Coord.UseTexelCeil = in_interval(Coord.TexelCeil, extent_type(0), TexelExtent - 1);
Namespace where all the classes and functions provided by GLI are exposed.