FastUIDraw
fastuidraw_unpack_unit_vector.glsl.hpp
Go to the documentation of this file.
1 /*!
2  * \file fastuidraw_unpack_unit_vector.glsl.hpp
3  * \brief file fastuidraw_unpack_unit_vector.glsl.hpp
4  *
5  * Copyright 2018 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 /*!\addtogroup GLSLVertFragCode
20  * @{
21  */
22 
23 /*!
24  * \brief unpack a unit vector
25  * \param x x-coordinate value of unit vector
26  * \param b if b is non-zero, indicates that y-coordinate is negative
27  */
28 vec2
30 {
31  vec2 return_value;
32  return_value.x = x;
33  return_value.y = sqrt(max(0.0, 1.0 - x * x));
34  if (b != 0u)
35  {
36  return_value.y = -return_value.y;
37  }
38  return return_value;
39 }
40 /*! @} */
vecN< float, 2 > vec2
Definition: vecN.hpp:1231
vec2 fastuidraw_unpack_unit_vector(float x, uint b)
unpack a unit vector
reference x(void)
Definition: vecN.hpp:435