|
| Legend (Scene *_scene, MouseSemantics *_mouse, Texture *_texture, float upperleftx, float upperlefty, float xstep, float ystep) |
|
virtual | ~Legend () |
|
void | setShader (Shader *shader) |
|
void | draw () |
|
void | update (double deltaT) |
|
void | prepareText () |
|
void | setActiveSelector (std::string _sText) |
|
| SceneObject (std::shared_ptr< SceneObject > &effectParent, const glm::mat4 &modelMatrix=glm::mat4(1)) |
|
| SceneObject (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1)) |
|
virtual | ~SceneObject () |
|
Model * | getModel () const |
|
Shader * | getShader () const |
|
glm::mat4 | getModelMatrix () const |
|
glm::mat4 | getGlobalModelMatrix () const |
|
std::string | getName () const |
|
std::shared_ptr< SceneObject > | getParent () const |
|
void | setAnimationTime (double time) |
|
bool | setAnimation (const Animation &anim) |
|
bool | delChild (size_t idx) |
|
bool | getChild (size_t idx, std::shared_ptr< SceneObject > &child) const |
|
bool | addChild (std::shared_ptr< SceneObject > &child) |
|
bool | remEffect (const std::string &name) |
|
SceneObject * | getEffect (const std::string &name) const |
|
bool | addEffect (const std::string &name, std::unique_ptr< SceneObject > &effect) |
|
bool | doNotRender () |
|
bool | getIsVolSun () |
|
virtual void | reset () |
|
virtual void | draw () const |
|
virtual bool | animate (double time) |
|
Displays a Legend that contains text.
- Design
- The Legend uses the freetype class in order to support rendering of text. The freetype library allows loading of characters as textures that can be rendered. An additional class LegendBackground is defined and used by the legend in order to render the background. Since different shaders are needed for rendering textures and background, the background rendering is encapsulated in a seperate class.
- Implementation
- In the constructor of legend, images of all ascii characters are loaded and saved as textures on the gpu. This allows for selection of corresponding textures during the runtime instead of loading them at runtime, suffering hughe performance losses. Textures of characters are loaded with the FT_Library ft and are stored as FT_Face face. Each face defines the parameters with which a texture should be rendered. These parameters specify the offset from the base, its with and height. These parameters are contained in a FT_GlyphSlot. Therefore, the struct Glyph that corresponds to such a slot has been created. Here, the parameters are inserted and for each character a entry in the std::map<char,Glyph> charGlyphMap will be created. This map will be used together with std::map<char, GLuint charTexHandleMap to find corresponding glyphs and texture handles for each character during the runtime. If one want's to render additional lines of text, the draw function in legend.cpp must be modified. Currently, following crucial information is displayed:
- Cursor speed: this is the computed scaling of the mouse that lies in the range [m,M] as defined in MouseSemantics
- Scale factor: a scalar that is multiplied with the scale factor from above. The user can adjust this value if the mouse is too slow/fast
- Scale function: the standard or inverse scale function from the paper can be used.
- Selection mode: defines if a compute shader or a quad tree is used for calculating the distance.
- Distance: the current distance between the mouse and the nearest object is displayed.
- FPS: frames per second
- Author
- Felix