Ignition Rendering

API Reference

0.1.0
BaseGrid.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef IGNITION_RENDERING_BASE_BASEGRID_HH_
18 #define IGNITION_RENDERING_BASE_BASEGRID_HH_
19 
20 #include <string>
23 
24 namespace ignition
25 {
26  namespace rendering
27  {
29  template <class T>
30  class IGNITION_RENDERING_VISIBLE BaseGrid :
31  public virtual Grid,
32  public virtual T
33  {
35  protected: BaseGrid();
36 
38  public: virtual ~BaseGrid();
39 
40  // Documentation inherited.
41  public: virtual void PreRender();
42 
43  // Documentation inherited.
44  public: virtual void Destroy();
45 
46  // Documentation inherited.
47  public: virtual unsigned int CellCount() const;
48 
49  // Documentation inherited.
50  public: virtual void SetCellCount(const unsigned int _count);
51 
52  // Documentation inherited.
53  public: virtual double CellLength() const;
54 
55  // Documentation inherited.
56  public: virtual void SetCellLength(const double _len);
57 
58  // Documentation inherited.
59  public: virtual unsigned int VerticalCellCount() const;
60 
61  // Documentation inherited.
62  public: virtual void SetVerticalCellCount(const unsigned int _count);
63 
65  protected: unsigned int cellCount = 10u;
66 
68  protected: double cellLength = 1.0;
69 
71  protected: unsigned int verticalCellCount = 0;
72 
74  protected: double heightOffset = 0.0;
75 
77  protected: bool gridDirty = false;
78  };
79 
81  // BaseGrid
83  template <class T>
85  {
86  }
87 
89  template <class T>
91  {
92  }
93 
95  template <class T>
96  unsigned int BaseGrid<T>::CellCount() const
97  {
98  return this->cellCount;
99  }
100 
102  template <class T>
103  void BaseGrid<T>::SetCellCount(const unsigned int _count)
104  {
105  this->cellCount = _count;
106  this->gridDirty = true;
107  }
108 
110  template <class T>
111  double BaseGrid<T>::CellLength() const
112  {
113  return this->cellLength;
114  }
115 
117  template <class T>
118  void BaseGrid<T>::SetCellLength(const double _len)
119  {
120  this->cellLength = _len;
121  this->gridDirty = true;
122  }
123 
125  template <class T>
126  unsigned int BaseGrid<T>::VerticalCellCount() const
127  {
128  return this->verticalCellCount;
129  }
130 
132  template <class T>
133  void BaseGrid<T>::SetVerticalCellCount(const unsigned int _count)
134  {
135  this->verticalCellCount = _count;
136  this->gridDirty = true;
137  }
138 
140  template <class T>
142  {
143  T::PreRender();
144  }
145 
147  template <class T>
149  {
150  T::Destroy();
151  }
152  }
153 }
154 #endif
virtual void SetVerticalCellCount(const unsigned int _count)
Set the vertical cell count of the grid. This makes the grid 3D.
Definition: BaseGrid.hh:133
TextureUnitState::TextureAddressingMode u
virtual unsigned int VerticalCellCount() const
Get the vertical cell count.
Definition: BaseGrid.hh:126
virtual unsigned int CellCount() const
Get the number of cells on a planar grid.
Definition: BaseGrid.hh:96
virtual void SetCellLength(const double _len)
Set the cell length in one direction. The cells are assumed to be square.
Definition: BaseGrid.hh:118
virtual void PreRender()
Prepare this object and any of its children for rendering. This should be called for each object in a...
Definition: BaseGrid.hh:141
virtual void Destroy()
Destroy any resources associated with this object. Invoking any other functions after destroying an o...
Definition: BaseGrid.hh:148
virtual double CellLength() const
Get the cell length.
Definition: BaseGrid.hh:111
BaseGrid()
Constructor.
Definition: BaseGrid.hh:84
Base implementation of a grid geometry.
Definition: BaseGrid.hh:30
Represents a grid geometry drawn along the XY plane. If vertical cell count is specified then the gri...
Definition: Grid.hh:31
virtual ~BaseGrid()
Destructor.
Definition: BaseGrid.hh:90
Definition: ArrowVisual.hh:22
virtual void SetCellCount(const unsigned int _count)
Set the number of cells on a planar grid.
Definition: BaseGrid.hh:103