Graphite  Version 3
An experimental 3D geometry processing program
checker_sphere.h
Go to the documentation of this file.
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 
38 #ifndef H_OGF_SCENE_GRAPH_GFX_SYMBOLS_CHECKER_SPHERE_H
39 #define H_OGF_SCENE_GRAPH_GFX_SYMBOLS_CHECKER_SPHERE_H
40 
41 #include <OGF/scene_graph_gfx/common/common.h>
42 #include <OGF/gom/types/object.h>
44 #include <geogram/image/color.h>
45 
51 namespace OGF {
52 
53  class RenderingContext;
54 
55 //_________________________________________________________
56 
60  gom_class SCENE_GRAPH_GFX_API CheckerSphere : public Object {
61  public:
62 
67 
71  ~CheckerSphere() override;
72 
73  gom_properties:
74 
79  index_t get_nb_segments() const {
80  return nb_segments_;
81  }
82 
88  void set_nb_segments(index_t value) {
89  nb_segments_ = value;
90  }
91 
98  return checker_size_;
99  }
100 
106  void set_checker_size(index_t value) {
107  checker_size_ = value;
108  }
109 
116  return rendering_context_;
117  }
118 
125  rendering_context_ = value;
126  }
127 
133  bool get_wireframe() const {
134  return wireframe_;
135  }
136 
142  void set_wireframe(bool value) {
143  wireframe_ = value;
144  }
145 
150  const Color& get_mesh_color() const {
151  return mesh_color_;
152  }
153 
158  void set_mesh_color(const Color& value) {
159  mesh_color_ = value;
160  }
161 
166  const Color& get_color1() const {
167  return color1_;
168  }
169 
174  void set_color1(const Color& value) {
175  color1_ = value;
176  }
177 
182  const Color& get_color2() const {
183  return color2_;
184  }
185 
190  void set_color2(const Color& value) {
191  color2_ = value;
192  }
193 
199  bool get_lighting() const {
200  return lighting_;
201  }
202 
208  void set_lighting(bool value) {
209  lighting_ = value;
210  }
211 
212  gom_slots:
218  void draw(RenderingContext* rendering_context = nullptr);
219 
220  private:
221  RenderingContext* rendering_context_;
222  index_t nb_segments_;
223  index_t checker_size_;
224  bool wireframe_;
225  Color mesh_color_;
226  Color color1_;
227  Color color2_;
228  bool lighting_;
229  vec3 lighting_vector_;
230  };
231 
232 //_________________________________________________________
233 
234 }
235 #endif
236 
Draws a sphere with a colored checkerboard.
void set_lighting(bool value)
Sets whether lighting is used.
void set_rendering_context(RenderingContext *value)
Sets the rendering context.
void set_color2(const Color &value)
Sets the other color used to draw the checkerboard.
void set_mesh_color(const Color &value)
Sets the mesh color.
const Color & get_mesh_color() const
Gets the mesh color.
void set_wireframe(bool value)
Sets wireframe mode.
CheckerSphere()
CheckerSphere constructor.
const Color & get_color2() const
Gets the other color used to draw the checkerboard.
void set_color1(const Color &value)
Sets one of the colors used to draw the checkerboard.
index_t get_checker_size() const
void set_checker_size(index_t value)
bool get_lighting() const
Tests whether lighting is used.
void set_nb_segments(index_t value)
Sets the number of segments.
~CheckerSphere() override
CheckerShpere destructor.
bool get_wireframe() const
Tests whether wireframe mode is active.
RenderingContext * get_rendering_context() const
Gets the rendering context.
const Color & get_color1() const
Gets one of the colors used to draw the checkerboard.
Base class for all objects in the GOM system.
Definition: object.h:65
Helper class for OpenGL context management.
Color types.
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
Global Graphite namespace.
Definition: common.h:76
The base class for all objects in the GOM system.
Simple geometric objects and manipulations.