FastUIDraw
painter_clip_equations.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_clip_equations.hpp
3  * \brief file painter_clip_equations.hpp
4  *
5  * Copyright 2016 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 
20 #ifndef FASTUIDRAW_PAINTER_CLIP_EQUATIONS_HPP
21 #define FASTUIDRAW_PAINTER_CLIP_EQUATIONS_HPP
22 
23 #include <fastuidraw/util/util.hpp>
24 #include <fastuidraw/util/vecN.hpp>
26 
27 namespace fastuidraw
28 {
29 /*!\addtogroup PainterBackend
30  * @{
31  */
32 
33  /*!
34  * \brief
35  * A PainterClipEquations stores the clip equation for
36  * Painter.
37  *
38  * Each vec3 gives a clip equation in 3D API clip coordinats
39  * (i.e. after PainterItemMatrix transformation is applied) as
40  * dot(clip_vector, p) >= 0.
41  */
43  {
44  public:
45  /*!
46  * \brief
47  * Enumeration that provides offsets for the
48  * elements of the clip equation offsets
49  * in units of uint32_t.
50  */
52  {
53  clip0_coeff_x, /*!< offset to x-coefficient for clip equation 0 (i.e. m_clip_equations[0].x) */
54  clip0_coeff_y, /*!< offset to y-coefficient for clip equation 0 (i.e. m_clip_equations[0].y) */
55  clip0_coeff_w, /*!< offset to w-coefficient for clip equation 0 (i.e. m_clip_equations[0].z) */
56 
57  clip1_coeff_x, /*!< offset to x-coefficient for clip equation 1 (i.e. m_clip_equations[1].x) */
58  clip1_coeff_y, /*!< offset to y-coefficient for clip equation 1 (i.e. m_clip_equations[1].y) */
59  clip1_coeff_w, /*!< offset to w-coefficient for clip equation 1 (i.e. m_clip_equations[1].z) */
60 
61  clip2_coeff_x, /*!< offset to x-coefficient for clip equation 2 (i.e. m_clip_equations[2].x) */
62  clip2_coeff_y, /*!< offset to y-coefficient for clip equation 2 (i.e. m_clip_equations[2].y) */
63  clip2_coeff_w, /*!< offset to w-coefficient for clip equation 2 (i.e. m_clip_equations[2].z) */
64 
65  clip3_coeff_x, /*!< offset to x-coefficient for clip equation 3 (i.e. m_clip_equations[3].x) */
66  clip3_coeff_y, /*!< offset to y-coefficient for clip equation 3 (i.e. m_clip_equations[3].y) */
67  clip3_coeff_w, /*!< offset to w-coefficient for clip equation 3 (i.e. m_clip_equations[3].z) */
68 
69  clip_data_size /*!< number of elements for clip equations */
70  };
71 
72  /*!
73  * Ctor, initializes all clip equations as \f$ z \geq 0\f$
74  */
76  m_clip_equations(vec3(0.0f, 0.0f, 1.0f))
77  {}
78 
79  /*!
80  * Pack the values as according to \ref clip_equations_data_offset_t
81  * \param dst place to which to pack data
82  */
83  void
84  pack_data(c_array<uvec4> dst) const;
85 
86  /*!
87  * Returns the length of the data needed to encode the data.
88  * Data is padded to be multiple of 4.
89  */
90  unsigned int
91  data_size(void) const
92  {
94  }
95 
96  /*!
97  * Each element of m_clip_equations specifies a
98  * clipping plane in 3D API clip-space as
99  * \code
100  * dot(m_clip_equations[i], p) >= 0
101  * \endcode
102  */
104  };
105 
106 /*! @} */
107 
108 } //namespace fastuidraw
109 
110 #endif
#define FASTUIDRAW_NUMBER_BLOCK4_NEEDED(X)
Definition: util.hpp:42
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
vecN is a simple static array class with no virtual functions and no memory overhead. Supports runtim array index checking and STL style iterators via pointer iterators.
Definition: vecN.hpp:42
file c_array.hpp
file util.hpp
clip_equations_data_offset_t
Enumeration that provides offsets for the elements of the clip equation offsets in units of uint32_t...
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provi...
Definition: c_array.hpp:43
A PainterClipEquations stores the clip equation for Painter.
file vecN.hpp
void pack_data(c_array< uvec4 > dst) const