Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlSphere.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_GLSPHERE_H
21 #define Tulip_GLSPHERE_H
22 
23 #include <tulip/tulipconf.h>
24 
25 #include <tulip/Coord.h>
26 #include <tulip/Color.h>
27 
28 #include <tulip/GlSimpleEntity.h>
29 
30 namespace tlp {
31 
32 /**
33  * @ingroup OpenGL
34  * @brief Class to create a sphere with GlEntity system
35  */
36 class TLP_GL_SCOPE GlSphere : public GlSimpleEntity {
37 
38 public:
39 
40  /**
41  * @brief Constructor
42  *
43  * @warning Don't use this constructor
44  */
45  GlSphere() {}
46 
47  /**
48  * @brief Create a sphere with a position, a radius a fill color and multiple rotation (if you want)
49  */
50  GlSphere(const Coord &position,float radius,const Color &color=Color(0,0,0,255),float rotX=0,float rotY=0,float rotZ=0);
51 
52  /**
53  * @brief Create a sphere with a position, a radius, a texture, an alphe and multiple rotation (if you want)
54  */
55  GlSphere(const Coord &position,float radius,const std::string& textureFile,int alpha=255,float rotX=0,float rotY=0,float rotZ=0);
56 
57  /**
58  * @brief Draw the sphere
59  */
60  virtual void draw(float lod,Camera *camera);
61 
62  /**
63  * @brief Translate entity
64  */
65  virtual void translate(const Coord& mouvement);
66 
67  /**
68  * @brief Get absolute position
69  */
70  const Coord& getPosition() const {
71  return position;
72  }
73 
74  /**
75  * @brief Set absolute position
76  */
77  void setPosition(const Coord& pos) {
78  position = pos;
79  }
80 
81  /**
82  * @brief Set the texture name
83  */
84  virtual void setTexture(const std::string &texture) {
85  textureFile=texture;
86  }
87 
88  /**
89  * @brief Get the color
90  */
91  const Color& getColor() const {
92  return color;
93  }
94 
95  /**
96  * @brief Set the color
97  */
98  void setColor(const Color &newColor) {
99  color = newColor;
100  }
101 
102  /**
103  * @brief Function to export data in outString (in XML format)
104  */
105  virtual void getXML(std::string &outString);
106 
107  /**
108  * @brief Function to set data with inString (in XML format)
109  */
110  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
111 
112 private:
113 
114  Coord position;
115  float radius;
116  Color color;
117  std::string textureFile;
118  Coord rot;
119 
120 };
121 
122 
123 }
124 
125 #endif // Tulip_GLSCENE_H