![]() |
Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
|
#include <Sprite.hpp>
Public Member Functions | |
SpriteRenderer (Application *app) | |
virtual | ~SpriteRenderer () |
void | begin2D () |
void | end2D () |
void | begin () |
void | end () |
void | draw (vec4 const &color, vec2 position, vec2 const &scale, vec2 const &uv_scale, HAlign hAlign=HAlign::Left, VAlign vAlign=VAlign::Bottom) |
Private Attributes | |
Application * | m_app |
Shader * | m_shader |
GLuint | m_verticesBuffer |
GLuint | m_vao |
Friends | |
class | Font |
SpriteRenderer helps you rendering sprites to the current frame-buffer.
Definition at line 33 of file Sprite.hpp.
SpriteRenderer | ( | Application * | app | ) |
Constructs a SpriteRenderer. Creates the unit-quad resources. Loades the shader.
app | The global application |
Definition at line 3 of file Sprite.cpp.
|
virtual |
Destructs the SpriteRenderer
Definition at line 37 of file Sprite.cpp.
void begin | ( | ) |
Sets states to enable sprite-drawing (Shader, VAO)
Definition at line 56 of file Sprite.cpp.
void begin2D | ( | ) |
Sets states to enable 2D-drawing. (disable depth-test, enable blending)
Definition at line 43 of file Sprite.cpp.
void draw | ( | vec4 const & | color, |
vec2 | position, | ||
vec2 const & | scale, | ||
vec2 const & | uv_scale, | ||
HAlign | hAlign = HAlign::Left , |
||
VAlign | vAlign = VAlign::Bottom |
||
) |
Draws a sprite. The texutre which is currently bound to target 0 is used.
color | The color of the sprite (multiply) |
position | The position of the sprite |
scale | The scale of the sprite |
uv_scale | The uv-scale of the sprite |
hAlign | The horizonal align of the spirte |
vAlign | The vertical align of the spirte |
Definition at line 66 of file Sprite.cpp.
void end | ( | ) |
Resets all states that were set by begin()
Definition at line 61 of file Sprite.cpp.
void end2D | ( | ) |
Sets states to enable 3D-drawing. (enable depth-test, disable blending)
Definition at line 49 of file Sprite.cpp.
|
friend |
Definition at line 41 of file Sprite.hpp.
|
private |
The global application
Definition at line 35 of file Sprite.hpp.
|
private |
The shader used for sprite-rendering
Definition at line 36 of file Sprite.hpp.
|
private |
The VAO used for rendering the unit-quad
Definition at line 39 of file Sprite.hpp.
|
private |
A a VBO containing a unit-quad
Definition at line 38 of file Sprite.hpp.