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_GLBOX_H 00021 #define Tulip_GLBOX_H 00022 00023 #if defined(_MSC_VER) 00024 #include <Windows.h> 00025 #endif 00026 00027 #if defined(__APPLE__) 00028 #include <OpenGL/gl.h> 00029 #else 00030 #include <GL/gl.h> 00031 #endif 00032 00033 #include <tulip/Color.h> 00034 #include <tulip/Size.h> 00035 #include <tulip/GlSimpleEntity.h> 00036 00037 namespace tlp { 00038 /** 00039 * @ingroup OpenGL 00040 * @brief General class used to render boxes as GlSimpleEntity. 00041 */ 00042 class TLP_GL_SCOPE GlBox : public GlSimpleEntity { 00043 00044 public: 00045 00046 /** 00047 * @brief Don't use this constructor 00048 */ 00049 GlBox(); 00050 00051 /** 00052 * @brief Constructor 00053 * 00054 * @param position The center of the box. 00055 * @param size The length of each dimension of the box. 00056 * @param fillColor The fill color of the box. 00057 * @param outlineColor The outline color of the box 00058 * @param filled Fill the box ? 00059 * @param outlined outline the box ? 00060 * @param outlineSize The size of the outline 00061 */ 00062 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.); 00063 00064 /** 00065 * @brief Destructor. 00066 */ 00067 virtual ~GlBox(); 00068 00069 virtual void draw(float lod,Camera *camera); 00070 00071 /** 00072 * @brief Accessor in reading to the size. 00073 */ 00074 Size getSize() const; 00075 00076 /** 00077 * @brief Accessor in writing to the size of the box 00078 */ 00079 void setSize(const Size& size); 00080 00081 /** 00082 * @brief Accessor in reading to the position. 00083 */ 00084 Coord* getPosition() const; 00085 00086 /** 00087 * @brief Accessor in writing to the position. 00088 */ 00089 void setPosition(const Coord& position); 00090 00091 /** 00092 * @brief Accessor in reading to the fill color. 00093 */ 00094 Color getFillColor() const; 00095 00096 /** 00097 * @brief Accessor in writing to the fill color of the box 00098 */ 00099 void setFillColor(const Color& color); 00100 00101 /** 00102 * @brief Accessor in reading to the outline color. 00103 */ 00104 Color getOutlineColor() const; 00105 00106 /** 00107 * @brief Accessor in writing to the outline color of the box 00108 */ 00109 void setOutlineColor(const Color& color); 00110 00111 /** 00112 * @brief Accessor in reading to the outline size. 00113 */ 00114 float getOutlineSize() const; 00115 00116 /** 00117 * @brief Accessor in writing to the outline size of the box 00118 */ 00119 void setOutlineSize(float size); 00120 00121 /** 00122 * @brief Accessor in reading to the texture name. 00123 */ 00124 std::string getTextureName() const; 00125 00126 /** 00127 * @brief Accessor in writing to the texture name of the box 00128 */ 00129 void setTextureName(const std::string& textureName); 00130 00131 /** 00132 * @brief Translate entity 00133 */ 00134 virtual void translate(const Coord& mouvement); 00135 00136 /** 00137 * @brief Function to export data in outString (in XML format) 00138 */ 00139 virtual void getXML(std::string &outString); 00140 00141 /** 00142 * @brief Function to set data with inString (in XML format) 00143 */ 00144 virtual void setWithXML(const std::string &inString, unsigned int ¤tPosition); 00145 00146 protected: 00147 00148 virtual void clearGenerated(); 00149 00150 Coord position; /**< The position of the center of the box*/ 00151 Size size; /**< size is the "radius" of the box */ 00152 std::vector<Color> fillColors; /**< fillColor of the box */ 00153 std::vector<Color> outlineColors; /**< outlineColor of the box */ 00154 bool filled; /**< the box is filled ? */ 00155 bool outlined; /**< the box is outlined ? */ 00156 std::string textureName; 00157 float outlineSize; /**< size of the ouline */ 00158 00159 float *newCubeCoordArrays; 00160 bool generated; 00161 GLuint buffers[5]; 00162 }; 00163 00164 } 00165 #endif