Tulip  4.2.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 1 and Inria Bordeaux - Sud Ouest
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 #include <tulip/Coord.h>
24 #include <tulip/Color.h>
25 #include <tulip/Size.h>
26 
27 #include <tulip/GlSimpleEntity.h>
28 #include <tulip/GlTextureManager.h>
29 
30 namespace tlp {
31 /**
32  * @ingroup OpenGL
33  * @brief General class used to render boxes as GlSimpleEntity.
34  */
35 class TLP_GL_SCOPE GlBox : public GlSimpleEntity {
36 
37 public:
38 
39  /**
40  * @brief Don't use this constructor
41  */
42  GlBox();
43 
44  /**
45  * @brief Constructor
46  *
47  * @param position The center of the box.
48  * @param size The length of each dimension of the box.
49  * @param fillColor The fill color of the box.
50  * @param outlineColor The outline color of the box
51  * @param filled Fill the box ?
52  * @param outlined outline the box ?
53  * @param outlineSize The size of the outline
54  */
55  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.);
56 
57  /**
58  * @brief Destructor.
59  */
60  virtual ~GlBox();
61 
62  virtual void draw(float lod,Camera *camera);
63 
64  /**
65  * @brief Accessor in reading to the size.
66  */
67  Size getSize() const;
68 
69  /**
70  * @brief Accessor in writing to the size of the box
71  */
72  void setSize(const Size& size);
73 
74  /**
75  * @brief Accessor in reading to the position.
76  */
77  Coord* getPosition() const;
78 
79  /**
80  * @brief Accessor in writing to the position.
81  */
82  void setPosition(const Coord& position);
83 
84  /**
85  * @brief Accessor in reading to the fill color.
86  */
87  Color getFillColor() const;
88 
89  /**
90  * @brief Accessor in writing to the fill color of the box
91  */
92  void setFillColor(const Color& color);
93 
94  /**
95  * @brief Accessor in reading to the outline color.
96  */
97  Color getOutlineColor() const;
98 
99  /**
100  * @brief Accessor in writing to the outline color of the box
101  */
102  void setOutlineColor(const Color& color);
103 
104  /**
105  * @brief Accessor in reading to the outline size.
106  */
107  float getOutlineSize() const;
108 
109  /**
110  * @brief Accessor in writing to the outline size of the box
111  */
112  void setOutlineSize(float size);
113 
114  /**
115  * @brief Accessor in reading to the texture name.
116  */
117  std::string getTextureName() const;
118 
119  /**
120  * @brief Accessor in writing to the texture name of the box
121  */
122  void setTextureName(const std::string& textureName);
123 
124  /**
125  * @brief Translate entity
126  */
127  virtual void translate(const Coord& mouvement);
128 
129  /**
130  * @brief Function to export data in outString (in XML format)
131  */
132  virtual void getXML(std::string &outString);
133 
134  /**
135  * @brief Function to set data with inString (in XML format)
136  */
137  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
138 
139 protected:
140 
141  virtual void clearGenerated();
142 
143  Coord position; /**< The position of the center of the box*/
144  Size size; /**< size is the "radius" of the box */
145  std::vector<Color> fillColors; /**< fillColor of the box */
146  std::vector<Color> outlineColors; /**< outlineColor of the box */
147  bool filled; /**< the box is filled ? */
148  bool outlined; /**< the box is outlined ? */
149  std::string textureName;
150  float outlineSize; /**< size of the ouline */
151 
152  float *newCubeCoordArrays;
153  bool generated;
154  GLuint buffers[5];
155 };
156 
157 }
158 #endif