Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 00020 #ifndef Tulip_GLSPHERE_H 00021 #define Tulip_GLSPHERE_H 00022 00023 #include <tulip/tulipconf.h> 00024 00025 #include <tulip/Coord.h> 00026 #include <tulip/Color.h> 00027 00028 #include <tulip/GlSimpleEntity.h> 00029 00030 namespace tlp { 00031 00032 /** 00033 * @ingroup OpenGL 00034 * @brief Class to create a sphere with GlEntity system 00035 */ 00036 class TLP_GL_SCOPE GlSphere : public GlSimpleEntity { 00037 00038 public: 00039 00040 /** 00041 * @brief Constructor 00042 * 00043 * @warning Don't use this constructor 00044 */ 00045 GlSphere() {} 00046 00047 /** 00048 * @brief Create a sphere with a position, a radius a fill color and multiple rotation (if you want) 00049 */ 00050 GlSphere(const Coord &position,float radius,const Color &color=Color(0,0,0,255),float rotX=0,float rotY=0,float rotZ=0); 00051 00052 /** 00053 * @brief Create a sphere with a position, a radius, a texture, an alphe and multiple rotation (if you want) 00054 */ 00055 GlSphere(const Coord &position,float radius,const std::string& textureFile,int alpha=255,float rotX=0,float rotY=0,float rotZ=0); 00056 00057 /** 00058 * @brief Draw the sphere 00059 */ 00060 virtual void draw(float lod,Camera *camera); 00061 00062 /** 00063 * @brief Translate entity 00064 */ 00065 virtual void translate(const Coord& mouvement); 00066 00067 /** 00068 * @brief Get absolute position 00069 */ 00070 const Coord& getPosition() const { 00071 return position; 00072 } 00073 00074 /** 00075 * @brief Set absolute position 00076 */ 00077 void setPosition(const Coord& pos) { 00078 position = pos; 00079 } 00080 00081 /** 00082 * @brief Set the texture name 00083 */ 00084 virtual void setTexture(const std::string &texture) { 00085 textureFile=texture; 00086 } 00087 00088 /** 00089 * @brief Get the color 00090 */ 00091 const Color& getColor() const { 00092 return color; 00093 } 00094 00095 /** 00096 * @brief Set the color 00097 */ 00098 void setColor(const Color &newColor) { 00099 color = newColor; 00100 } 00101 00102 /** 00103 * @brief Function to export data in outString (in XML format) 00104 */ 00105 virtual void getXML(std::string &outString); 00106 00107 /** 00108 * @brief Function to set data with inString (in XML format) 00109 */ 00110 virtual void setWithXML(const std::string &inString, unsigned int ¤tPosition); 00111 00112 private: 00113 00114 Coord position; 00115 float radius; 00116 Color color; 00117 std::string textureFile; 00118 Coord rot; 00119 00120 }; 00121 00122 00123 } 00124 00125 #endif // Tulip_GLSCENE_H