Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlBox.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 #ifndef Tulip_GLBOX_H
21 #define Tulip_GLBOX_H
22 
23 #if defined(_MSC_VER)
24 #include <Windows.h>
25 #endif
26 
27 #if defined(__APPLE__)
28 #include <OpenGL/gl.h>
29 #else
30 #include <GL/gl.h>
31 #endif
32 
33 #include <tulip/Color.h>
34 #include <tulip/Size.h>
35 #include <tulip/GlSimpleEntity.h>
36 
37 namespace tlp {
38 /**
39  * @ingroup OpenGL
40  * @brief General class used to render boxes as GlSimpleEntity.
41  */
42 class TLP_GL_SCOPE GlBox : public GlSimpleEntity {
43 
44 public:
45 
46  /**
47  * @brief Don't use this constructor
48  */
49  GlBox();
50 
51  /**
52  * @brief Constructor
53  *
54  * @param position The center of the box.
55  * @param size The length of each dimension of the box.
56  * @param fillColor The fill color of the box.
57  * @param outlineColor The outline color of the box
58  * @param filled Fill the box ?
59  * @param outlined outline the box ?
60  * @param outlineSize The size of the outline
61  */
62  GlBox(const Coord& position, const Size &size, const Color& fillColor, const Color &outlineColor,bool filled=true, bool outlined=true, const std::string &textureName="",float outlineSize=1.);
63 
64  /**
65  * @brief Destructor.
66  */
67  virtual ~GlBox();
68 
69  virtual void draw(float lod,Camera *camera);
70 
71  /**
72  * @brief Accessor in reading to the size.
73  */
74  Size getSize() const;
75 
76  /**
77  * @brief Accessor in writing to the size of the box
78  */
79  void setSize(const Size& size);
80 
81  /**
82  * @brief Accessor in reading to the position.
83  */
84  Coord* getPosition() const;
85 
86  /**
87  * @brief Accessor in writing to the position.
88  */
89  void setPosition(const Coord& position);
90 
91  /**
92  * @brief Accessor in reading to the fill color.
93  */
94  Color getFillColor() const;
95 
96  /**
97  * @brief Accessor in writing to the fill color of the box
98  */
99  void setFillColor(const Color& color);
100 
101  /**
102  * @brief Accessor in reading to the outline color.
103  */
104  Color getOutlineColor() const;
105 
106  /**
107  * @brief Accessor in writing to the outline color of the box
108  */
109  void setOutlineColor(const Color& color);
110 
111  /**
112  * @brief Accessor in reading to the outline size.
113  */
114  float getOutlineSize() const;
115 
116  /**
117  * @brief Accessor in writing to the outline size of the box
118  */
119  void setOutlineSize(float size);
120 
121  /**
122  * @brief Accessor in reading to the texture name.
123  */
124  std::string getTextureName() const;
125 
126  /**
127  * @brief Accessor in writing to the texture name of the box
128  */
129  void setTextureName(const std::string& textureName);
130 
131  /**
132  * @brief Translate entity
133  */
134  virtual void translate(const Coord& mouvement);
135 
136  /**
137  * @brief Function to export data in outString (in XML format)
138  */
139  virtual void getXML(std::string &outString);
140 
141  /**
142  * @brief Function to set data with inString (in XML format)
143  */
144  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
145 
146 protected:
147 
148  virtual void clearGenerated();
149 
150  Coord position; /**< The position of the center of the box*/
151  Size size; /**< size is the "radius" of the box */
152  std::vector<Color> fillColors; /**< fillColor of the box */
153  std::vector<Color> outlineColors; /**< outlineColor of the box */
154  bool filled; /**< the box is filled ? */
155  bool outlined; /**< the box is outlined ? */
156  std::string textureName;
157  float outlineSize; /**< size of the ouline */
158 
159  float *newCubeCoordArrays;
160  bool generated;
161  GLuint buffers[5];
162 };
163 
164 }
165 #endif
General class used to render boxes as GlSimpleEntity.
Definition: GlBox.h:42
Base class for all Tulip OpenGL entities.
float outlineSize
Definition: GlBox.h:157
Size size
Definition: GlBox.h:151
std::vector< Color > outlineColors
Definition: GlBox.h:153
Tulip OpenGL camera object.
Definition: Camera.h:45
bool outlined
Definition: GlBox.h:155
Coord position
Definition: GlBox.h:150
std::vector< Color > fillColors
Definition: GlBox.h:152
bool filled
Definition: GlBox.h:154