Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Friends | List of all members
SpriteRenderer Class Reference

#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

Applicationm_app
 
Shaderm_shader
 
GLuint m_verticesBuffer
 
GLuint m_vao
 

Friends

class Font
 

Detailed Description

SpriteRenderer helps you rendering sprites to the current frame-buffer.

Definition at line 33 of file Sprite.hpp.

Constructor & Destructor Documentation

Constructs a SpriteRenderer. Creates the unit-quad resources. Loades the shader.

Parameters
appThe global application

Definition at line 3 of file Sprite.cpp.

~SpriteRenderer ( )
virtual

Destructs the SpriteRenderer

Definition at line 37 of file Sprite.cpp.

Member Function Documentation

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.

Parameters
colorThe color of the sprite (multiply)
positionThe position of the sprite
scaleThe scale of the sprite
uv_scaleThe uv-scale of the sprite
hAlignThe horizonal align of the spirte
vAlignThe 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.

Friends And Related Function Documentation

friend class Font
friend

Definition at line 41 of file Sprite.hpp.

Member Data Documentation

Application* m_app
private

The global application

Definition at line 35 of file Sprite.hpp.

Shader* m_shader
private

The shader used for sprite-rendering

Definition at line 36 of file Sprite.hpp.

GLuint m_vao
private

The VAO used for rendering the unit-quad

Definition at line 39 of file Sprite.hpp.

GLuint m_verticesBuffer
private

A a VBO containing a unit-quad

Definition at line 38 of file Sprite.hpp.


The documentation for this class was generated from the following files: