Graphite  Version 3
An experimental 3D geometry processing program
properties.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_TYPES_SHADER_PROPERTIES_H
39 #define H_OGF_SCENE_GRAPH_TYPES_SHADER_PROPERTIES_H
40 
42 #include <OGF/gom/types/arg_list.h>
43 #include <geogram/image/color.h>
44 
45 #include <iostream>
46 #include <string>
47 
53 namespace GEO {
54  class Image;
55 }
56 
57 namespace OGF {
58 
59  //________________________________________________________
60 
64  struct PointStyle {
70  visible(false),
71  color(0.0,0.0,0.0,1.0),
72  size(4) {
73  }
77  bool visible;
78 
83 
88  };
89 
96  SCENE_GRAPH_API std::ostream& operator<<(
97  std::ostream& out, const PointStyle& ps
98  );
99 
106  SCENE_GRAPH_API std::istream& operator>>(
107  std::istream& in, PointStyle& ps
108  );
109 
110  //________________________________________________________
111 
115  struct EdgeStyle {
121  visible(false),
122  color(0.0,0.0,0.0,1.0),
123  width(1) {
124  }
125 
129  bool visible;
130 
135 
140  };
141 
148  SCENE_GRAPH_API std::ostream& operator<<(
149  std::ostream& out, const EdgeStyle& es
150  );
151 
158  SCENE_GRAPH_API std::istream& operator>>(
159  std::istream& in, EdgeStyle& es
160  );
161 
162  //________________________________________________________
163 
167  struct SurfaceStyle {
174  visible(false),
175  color(0.0,0.0,0.0,1.0) {
176  }
180  bool visible;
181 
186  };
187 
194  SCENE_GRAPH_API std::ostream& operator<<(
195  std::ostream& out, const SurfaceStyle& ss
196  );
197 
204  SCENE_GRAPH_API std::istream& operator>>(
205  std::istream& in, SurfaceStyle& ss
206  );
207 
208  /***********************************************************************/
209 
218  template <class T, bool create=false> class Name : public NameBase {
219  public:
224 
230  Name() {
231  }
232 
237  Name(const thisclass& rhs) : val_(rhs.val_) {
238  }
239 
244  Name(const std::string& rhs) : val_(rhs) {
245  }
246 
251  Name(const char* rhs) : val_(rhs) {
252  }
253 
260  val_ = rhs.val_;
261  return *this;
262  }
263 
269  thisclass& operator=(const std::string& rhs) {
270  val_ = rhs;
271  return *this;
272  }
273 
279  thisclass& operator=(const char* rhs) {
280  val_ = std::string(rhs);
281  return *this;
282  }
283 
288  operator const std::string&() const {
289  return val_;
290  }
291 
296  operator std::string&() {
297  return val_;
298  }
299 
307  bool operator==(const std::string& rhs) const {
308  return val_ == rhs;
309  }
310 
318  bool operator!=(const std::string& rhs) const {
319  return val_ != rhs;
320  }
321 
322  private:
323  std::string val_;
324  };
325 
326  //________________________________________________________
327 
334  template <class T, bool B> inline std::ostream& operator<< (
335  std::ostream& out, const Name<T,B>& name
336  ) {
337  return (out << (const std::string&)(name)) ;
338  }
339 
346  template <class T, bool B> std::istream& operator>> (
347  std::istream& in, Name<T,B>& name
348  ) {
349  // Note: we use "std::getline(in, name)" instead of "in >> name" since
350  // "in >> name" would truncate the string if it contains whitespace
351  // (and under Windows, "My documents" directory contains a
352  // whitespace !)
353 
354  std::getline(in, (std::string&)name) ;
355  return in ;
356  }
357 
358  //________________________________________________________
359 
364  template <class T> class File {
365  public:
366  };
367 
377 
387 
388  //________________________________________________________
389 
400 
411 
412  //________________________________________________________
413 
414  class Grob;
415 
424 
435 
436  //________________________________________________________
437 
448 
459 
460  //________________________________________________________
461 
462  class GrobClass;
463 
473 
474  //_______________________________________________________
475 
476  class Colormap;
477 
487 
488  //________________________________________________________
489 
493  struct ColormapStyle {
494 
499  colormap_name("rainbow"),
500  smooth(true),
501  repeat(0),
502  show(false),
503  flip(false) {
504  }
505 
510 
515  bool smooth;
516 
523 
529  bool show;
530 
534  bool flip;
535  };
536 
537 
544  SCENE_GRAPH_API std::ostream& operator<<(
545  std::ostream& out, const ColormapStyle& cms
546  );
547 
554  SCENE_GRAPH_API std::istream& operator>>(
555  std::istream& in, ColormapStyle& cms
556  );
557 
558  //________________________________________________________
559 
560  class FullScreenEffect;
561 
570 
571 }
572 
573 #endif
Generic arguments and argument lists.
A Colormap.
Definition: colormap.h:61
Just a placeholder template to create new Name<> types for file names.
Definition: properties.h:364
A Full screen effect.
Base class for all 3D Graphite objects.
Definition: grob.h:68
Base class for all Names in Graphite (GrobName ...).
Definition: arg_list.h:59
A template class for strings that need to have a specific type in the GOM system.
Definition: properties.h:218
bool operator!=(const std::string &rhs) const
Tests whether this Name differs from a given string.
Definition: properties.h:318
thisclass & operator=(const std::string &rhs)
Assignment operator from std::string.
Definition: properties.h:269
Name()
Name constructor.
Definition: properties.h:230
thisclass & operator=(const char *rhs)
Assignment operator from a C string.
Definition: properties.h:279
Name< T > thisclass
This class type.
Definition: properties.h:223
Name(const std::string &rhs)
Name copy constructor from std::string.
Definition: properties.h:244
bool operator==(const std::string &rhs) const
Tests whether this Name corresponds to a given string.
Definition: properties.h:307
Name(const thisclass &rhs)
Name copy constructor.
Definition: properties.h:237
Name(const char *rhs)
Name copy constructor from const char*.
Definition: properties.h:251
thisclass & operator=(const thisclass &rhs)
Assignment operator.
Definition: properties.h:259
Color types.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
Global Graphite namespace.
Definition: common.h:76
Name< Colormap * > ColormapName
The name of a colormap.
Definition: properties.h:476
std::ostream & operator<<(std::ostream &out, const ArgList &args)
Prints an ArgList into a stream.
Definition: arg_list.h:527
Name< File< Image * >, true > NewImageFileName
The name of an (existing or not) file that contains an Image.
Definition: properties.h:410
Name< Grob *, true > NewGrobName
The name of an (existing or not) Grob in the SceneGraph.
Definition: properties.h:434
Name< File< Memory::byte >, true > NewFileName
The name of a new file.
Definition: properties.h:386
Name< File< Grob * >, true > NewGrobFileName
The name of an (existing or not) file that contains an object.
Definition: properties.h:458
Name< Grob * > GrobName
The name of an existing Grob in the SceneGraph.
Definition: properties.h:414
Name< File< Grob * > > GrobFileName
The name of an existing file that contains an object.
Definition: properties.h:447
Name< GrobClass * > GrobClassName
The name of a Grob class.
Definition: properties.h:462
Name< File< Memory::byte > > FileName
The name of an existing file.
Definition: properties.h:376
Name< FullScreenEffect * > FullScreenEffectName
The name of a full screen effect.
Definition: properties.h:560
Name< File< Image * > > ImageFileName
The name of an existing file that contains an Image.
Definition: properties.h:399
std::istream & operator>>(std::istream &in, PointStyle &ps)
Reads a PointStyle from a stream.
Definitions common to all include files in the scene_graph library.
The style used to display colormapped colors.
Definition: properties.h:493
ColormapName colormap_name
Name of the colormap file, in "lib/colormaps".
Definition: properties.h:509
bool show
If true, show the colormap and mapped minimum and maximum value on the top left corner of the renderi...
Definition: properties.h:529
bool flip
If true, flip the colormap.
Definition: properties.h:534
bool smooth
If true, then colormap is smoothed (using linear interpolation and mipmaps, else GL_NEAREST is used.
Definition: properties.h:515
ColormapStyle()
ColormapStyle constructor.
Definition: properties.h:498
index_t repeat
Number of times the colormap should be repeated within the [0,1] range of color indices....
Definition: properties.h:522
Drawing style for mesh edges.
Definition: properties.h:115
Color color
Color of the edges.
Definition: properties.h:134
EdgeStyle()
EdgeStyle constructor.
Definition: properties.h:120
index_t width
width of the edges.
Definition: properties.h:139
bool visible
true if edges are visible, false otherwise.
Definition: properties.h:129
Drawing style for points.
Definition: properties.h:64
index_t size
Size of the points.
Definition: properties.h:87
bool visible
true if points are visible, false otherwise.
Definition: properties.h:77
Color color
Color of the points.
Definition: properties.h:82
PointStyle()
PointStyle constructor.
Definition: properties.h:69
Drawing style for polygons.
Definition: properties.h:167
Color color
The Color used to draw the polygons.
Definition: properties.h:185
bool visible
true if polygons are visible, false otherwise.
Definition: properties.h:180
SurfaceStyle()
SurfaceStyle constructor.
Definition: properties.h:173