20 #ifndef Tulip_GLLABEL_H
21 #define Tulip_GLLABEL_H
23 #include <tulip/Coord.h>
24 #include <tulip/Color.h>
25 #include <tulip/Size.h>
26 #include <tulip/Camera.h>
27 #include <tulip/GlSimpleEntity.h>
29 class FTGLPolygonFont;
67 GlLabel(
const Coord ¢erPosition,
const Size &size, Color fontColor,
bool leftAlign =
false);
91 centerPosition = position;
98 centerPosition.set(x, y, z);
105 return centerPosition;
113 void setTranslationAfterRotation(
const Coord &translation) {
114 translationAfterRotation = translation;
120 const Coord &getTranslationAfterRotation()
const {
121 return translationAfterRotation;
135 this->alignment = alignment;
147 return textBoundingBox;
154 this->sizeForOutAlign = this->size = size;
173 sizeForOutAlign = size;
181 return sizeForOutAlign;
202 depthTestEnabled = state;
236 void rotate(
float xRot,
float yRot,
float zRot);
241 void getXML(std::string &outString)
override;
246 void setWithXML(
const std::string &inString,
unsigned int ¤tPosition)
override;
272 void setRenderingMode(
int mode) {
273 renderingMode = mode;
282 occlusionTester = tester;
310 labelsDensity = -100;
311 else if (density > 100)
314 labelsDensity = density;
322 return labelsDensity;
361 useMinMaxSize = state;
368 return useMinMaxSize;
396 outlineColor = color;
438 this->billboarded = billboarded;
443 std::string fontName;
446 FTGLPolygonFont *font;
447 FTOutlineFont *borderFont;
448 Coord centerPosition;
449 Coord translationAfterRotation;
451 Size sizeForOutAlign;
455 std::string textureName;
461 bool depthTestEnabled;
470 OcclusionTest *occlusionTester;
476 std::vector<std::string> textVector;
477 std::vector<float> textWidthVector;
Tulip OpenGL camera object.
Create a label into Tulip 3D engine.
const Color & getColor() const
Get color use to render the label.
void setOcclusionTester(OcclusionTest *tester)
Set the occlusion tester If occlusionTester is nullptr : deactivate occlusion test.
void setBoldFont()
Switch to bold font.
void setText(const std::string &text)
Set the text of the label.
void setUseMinMaxSize(bool state)
Set if the label use min/max screen size in not scaled mode.
int getFontSize() const
Return the font size.
void setTextureName(const std::string &name)
Sets the texture name used when rendering the label.
void setOutlineColor(const Color &color)
Sets the outline color used when rendering the label.
const BoundingBox & getTextBoundingBox()
Return the bounding box of the text of the label after transformations.
bool getUseLODOptimisation() const
Return if the label is otimized with the lod.
void setColor(const Color &color)
Set color of label.
void setPosition(float x, float y, float z)
Set the position used to render the label.
bool isBillboarded() const
Return if the label is billboarded.
BoundingBox getBoundingBox() override
Return the bounding box of the label.
void setUseLODOptimisation(bool state, const BoundingBox &bb=BoundingBox())
Set if the label is optimized with the lod.
void setAlignment(int alignment)
Set the alignment of the label : LabelPosition::Center, LabelPosition::Top, LabelPosition::Bottom,...
const Coord & getPosition() const
Return the position of the label.
void translate(const Coord &mouvement) override
Translate entity.
void drawWithStencil(float lod, Camera *camera=nullptr)
Set the stencil and draw the Label, this function is useful when we directly call draw without tulip ...
void getXML(std::string &outString) override
Function to export data in outString (in XML format)
void setSizeForOutAlign(const Size &size)
Set the size for alignment outside (left/right/top/bottom)
bool isUsingMinMaxSize() const
Return if the label using min/max screen size in not scaled mode.
~GlLabel() override
Destructor.
const std::string & getText() const
getText gets the text of this label.
void enableDepthTest(bool state)
Enable/disable the OpenGL depth test for the label (default depth test is enable)
void setBillboarded(bool billboarded)
Set if the label is billboarded.
void setFontSize(int size)
Sets the font size used when rendering the label.
void setFontName(const std::string &name)
Change font name.
const std::string & getTextureName() const
Return the texture name used to render the label.
const Color & getOutlineColor() const
Return the outline color.
void setSize(const Size &size)
Set the size of the label.
const Size & getSize() const
return the size of the text
void rotate(float xRot, float yRot, float zRot)
Rotate Label.
void setPosition(const Coord &position)
Set the position used to render the label.
void setMinSize(int size)
Set min screen size (in pixel) of the label : this size is used in not scaled mode.
int getMaxSize() const
Get max screen size (in pixel) of the label : this size is used in not scaled mode.
int getLabelDensity() const
Return label density of occlusion test This density will be in interval -100 100.
void setScaleToSize(bool state)
Enable/disable if label is scaled to size.
const Size & getSizeForOutAlign() const
return the size for alignment outside (left/right/top/bottom)
float getOutlineSize() const
Return the outline size.
void setPlainFont()
Switch to plain font.
void draw(float, Camera *camera=nullptr) override
Draw the Label.
int getMinSize() const
Get min screen size (in pixel) of the label : this size is used in not scaled mode.
void setWithXML(const std::string &inString, unsigned int ¤tPosition) override
Function to set data with inString (in XML format)
void setOutlineSize(float size)
Sets the outline size used when rendering the label.
void setLabelsDensity(int density)
Set labels density of occlusion test This density must be in interval -100 100.
GlLabel(const Coord ¢erPosition, const Size &size, Color fontColor, bool leftAlign=false)
Constructor.
void setMaxSize(int size)
Set max screen size (in pixel) of the label : this size is used in not scaled mode.
float getHeightAfterScale()
Return the height of the label after scaling in size box.
void setFontNameSizeAndColor(const std::string &name, const int &size, const Color &color)
Change font name, size and color of the text.
Base class for all Tulip OpenGL entities.
This class represents the 3D bounding box of an object. It is mostly used to determine whether or not...