Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
Gl2DRect.h
1/*
2 *
3 * This file is part of Tulip (https://tulip.labri.fr)
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_GL2DRECT_H
21#define Tulip_GL2DRECT_H
22
23#include <string>
24
25#include <tulip/GlRect.h>
26
27namespace tlp {
28/**
29 * @ingroup OpenGL
30 *
31 * @brief Create a 2D rectangle
32 *
33 * This rect add screen percentage system (for example you can create a rectangle that start on
34 * (10%,10%) and finish on (90%90%)
35 * If you when a simple 2D rectangle with normal coordinates use GlRect class
36 * @see GlRect
37 */
38class TLP_GL_SCOPE Gl2DRect : public GlRect {
39
40public:
41 /**
42 * @brief Don't use this constructor
43 */
45
46 /**
47 * @brief Constructor
48 *
49 * @param top coordinate
50 * @param bottom coordinate
51 * @param left coordinate
52 * @param right coordinate
53 * @param textureName path to a texture
54 * @param inPercent if true : top/bottom/left/right is used as in percent parameters
55 */
56 Gl2DRect(float top, float bottom, float left, float right, const std::string &textureName,
57 bool inPercent = false);
58
59 /**
60 * @brief Constructor
61 *
62 * @param top coordinate
63 * @param bottom coordinate
64 * @param left coordinate
65 * @param right coordinate
66 * @param textureName path to a texture
67 * @param xInv if true : use viewportX - left and viewportX - right
68 * @param yInv if true : use viewportY - top and viewportY - bottom
69 */
70 Gl2DRect(float bottom, float left, float height, float width, const std::string &textureName,
71 bool xInv, bool yInv);
72
73 /**
74 * @brief Destructor
75 */
76 ~Gl2DRect() override {}
77
79
80 void draw(float lod, Camera *camera) override;
81
82 void translate(const Coord &mouvement) override;
83
84 /**
85 * @brief Set texture
86 */
87 virtual void setTexture(const std::string &name);
88
89 /**
90 * @brief Get texture
91 */
92 virtual std::string getTexture();
93
94 /**
95 * @brief Set coordinates of rectangle
96 */
97 virtual void setCoordinates(float bottom, float left, float width, float height);
98
99 void getXML(std::string &outString) override;
100
101 void setWithXML(const std::string &inString, unsigned int &currentPosition) override;
102
103protected:
104 float top;
105 float bottom;
106 float left;
107 float right;
108 bool inPercent;
109 bool xInv;
110 bool yInv;
111};
112} // namespace tlp
113#endif
Tulip OpenGL camera object.
Definition: Camera.h:47
Create a 2D rectangle.
Definition: Gl2DRect.h:38
virtual void setCoordinates(float bottom, float left, float width, float height)
Set coordinates of rectangle.
Gl2DRect()
Don't use this constructor.
void setWithXML(const std::string &inString, unsigned int &currentPosition) override
Load entity with inString (in XML format)
virtual void setTexture(const std::string &name)
Set texture.
~Gl2DRect() override
Destructor.
Definition: Gl2DRect.h:76
Gl2DRect(float top, float bottom, float left, float right, const std::string &textureName, bool inPercent=false)
Constructor.
void draw(float lod, Camera *camera) override
Draw function.
BoundingBox getBoundingBox() override
Return the entity boundingbox.
virtual std::string getTexture()
Get texture.
Gl2DRect(float bottom, float left, float height, float width, const std::string &textureName, bool xInv, bool yInv)
Constructor.
void getXML(std::string &outString) override
Save the entity in outString (in XML format)
This is a general class for the rendering of 2D rectangles.
Definition: GlRect.h:35
This class represents the 3D bounding box of an object. It is mostly used to determine whether or not...
Definition: BoundingBox.h:67