|
2D_Game_Engine
|
#include <renderer.hpp>
Public Member Functions | |
| Renderer () | |
| ~Renderer () | |
| void | StartScene () |
| void | DrawScene () |
| void | Clear (bool ambient_light=false) const |
| void | Clear (Vec4 color) const |
| void | DrawTexture (Vec2 pos, Vec2 size, int layer, float texID) |
| void | DrawTexture (Vec2 pos, Vec2 size, Vec2 texture_pos, Vec2 texture_size, Vec2 texture_total_size, int layer, float texID) |
| void | DrawTexture (Vec2 pos, Vec2 size, bool reverse_x, bool reverse_y, int layer, Texture &texture) |
| void | DrawSpriteSheet (Vec2 pos, Vec2 size, float row, float col, int layer, SpriteSheet &s) |
| void | DrawAnimatedTexture (Vec2 pos, Vec2 size, int layer, SpriteSheet &s, bool &play_animation, bool loop_animation, float animation_delay, float &last_animation_time, int &animation_index) |
| void | DrawTriangle (Vec2 pos1, Vec2 pos2, Vec2 pos3, Vec4 color, int layer) |
| void | DrawSolidQuad (Vec2 pos, Vec2 size, Vec4 color, int layer) |
| void | DrawPoint (Vec2 pos, Vec4 color, int layer) |
| void | DrawCircle (Vec2 pos, Vec4 color, float border, int layer) |
| void | DrawLine (Vec2 pos1, Vec2 pos2, Vec4 color, int layer) |
| void | DrawLight (Vec2 pos, Vec4 color, LightType light_type, float radius=0.0f, float blurAmount=0.0f) |
| void | Render (bool post_processing=false) |
| void | RenderTextures (bool post_processing, float max_layer) |
| void | RenderTriangles (float max_layer) |
| void | RenderLines (float max_layer) |
| void | RenderPoints (float max_layer) |
| void | SetPostProcessing (const char *uniform_name) |
| void | PostProcessing () |
| void | SetLineWidth (float new_size) |
| void | UpdateLineWidth () |
| void | SetPointSize (float new_size) |
| float | GetPointSize () |
| float | GetLineWidth () |
| void | SetAmbientLight (Vec3 color) |
| void | SetClearColor (Vec3 color) |
| void | AddSegment (Vec2 start_point, Vec2 end_point) |
| void | UpdateScreenSegments () |
| void | ClearSegments () |
| std::vector< std::pair< Vec2, Vec2 > > & | GetSegments () |
| void | ApplyLight () |
| void | ApplyLight (Framebuffer *framebuffer) |
| void | KeepCircle (Vec2 pos, float radius, float blurAmount) |
| std::pair< Vec2, float > | GetIntersection (const std::pair< Vec2, Vec2 > &ray, const std::pair< Vec2, Vec2 > &seg) |
| RendererData * | GetLightsData () |
| unsigned int | GetFramebufferID () |
| void | SetTonemapType (TonemapType type) |
| void | SetGamma (float gamma) |
| void | SetExposure (float exposure) |
| TonemapType | GetTonemapType () |
| float | GetGamma () |
| float | GetExposure () |
| void | CreateShaders () |
| void | ReloadShaders () |
| void | SetProjMat (glm::mat4 proj) |
| void | SetViewMat (glm::mat4 view) |
| void | SetViewProjMat (glm::mat4 view_proj) |
Static Public Member Functions | |
| static void | ImGui_Init () |
| static void | ImGui_Theme () |
| static void | ImGui_Start_Frame () |
| static void | ImGui_Content () |
| static void | ImGui_End_Frame () |
| static void | ImGui_Close () |
Friends | |
| class | Camera |
Definition at line 40 of file renderer.hpp.
| Renderer::Renderer | ( | ) |
Definition at line 12 of file renderer.cpp.
| Renderer::~Renderer | ( | ) |
Definition at line 116 of file renderer.cpp.
Definition at line 754 of file renderer.cpp.
| void Renderer::ApplyLight | ( | ) |
Apply the lighting framebuffer to the main framebuffer
Definition at line 916 of file renderer.cpp.
| void Renderer::ApplyLight | ( | Framebuffer * | framebuffer | ) |
Merge the lighting framebuffer with the framebuffer
| framebuffer | the framebuffer to merge with |
Definition at line 920 of file renderer.cpp.
| void Renderer::Clear | ( | bool | ambient_light = false | ) | const |
Clear the screen
| ambient_light | if true, the ambient light will be applied, else the clear color will be applied |
Definition at line 732 of file renderer.cpp.
| void Renderer::Clear | ( | Vec4 | color | ) | const |
Clear the screen
| color | the color to clear the screen |
Definition at line 740 of file renderer.cpp.
| void Renderer::ClearSegments | ( | ) |
Definition at line 765 of file renderer.cpp.
| void Renderer::CreateShaders | ( | ) |
Definition at line 171 of file renderer.cpp.
| void Renderer::DrawAnimatedTexture | ( | Vec2 | pos, |
| Vec2 | size, | ||
| int | layer, | ||
| SpriteSheet & | s, | ||
| bool & | play_animation, | ||
| bool | loop_animation, | ||
| float | animation_delay, | ||
| float & | last_animation_time, | ||
| int & | animation_index ) |
Draw an animated texture
| pos | Position of the texture |
| size | Size of the texture |
| layer | Layer of the texture (higher layers are drawn on top of lower layers) |
| s | the sprite sheet to use |
| play_animation | if true, the animation will be played |
| loop_animation | if true, the animation will be looped |
| animation_delay | the delay between two frames |
| last_animation_time | the last time the animation was updated |
| animation_index | the current animation index |
Definition at line 321 of file renderer.cpp.
Draw an empty point. Use SetPointSize to change the size of the point
| pos | Position of the point |
| color | Color of the point |
| border | Border of the point (in range [0,1]) |
| layer | Layer of the point (higher layers are drawn on top of lower layers) |
Definition at line 382 of file renderer.cpp.
| void Renderer::DrawLight | ( | Vec2 | pos, |
| Vec4 | color, | ||
| LightType | light_type, | ||
| float | radius = 0.0f, | ||
| float | blurAmount = 0.0f ) |
Draw a light
| pos | Position of the light |
| color | Color of the light |
| light_type | Type of the light |
| radius | Radius of the light |
| blurAmount | Amount of blur starting from the edge of the light |
Definition at line 802 of file renderer.cpp.
Draw a line. Use SetLineWidth to change the size of the line
| pos1 | Position of the first vertex |
| pos2 | Position of the second vertex |
| color | Color of the line |
| layer | Layer of the line (higher layers are drawn on top of lower layers) |
Definition at line 396 of file renderer.cpp.
Draw a round point. Use SetPointSize to change the size of the point
| pos | Position of the point |
| color | Color of the point |
| layer | Layer of the point (higher layers are drawn on top of lower layers) |
Definition at line 368 of file renderer.cpp.
| void Renderer::DrawScene | ( | ) |
Definition at line 481 of file renderer.cpp.
Draw a solid quad
| pos | Position of the quad |
| size | Size of the quad |
| color | Color of the quad |
| layer | Layer of the quad (higher layers are drawn on top of lower layers) |
Definition at line 361 of file renderer.cpp.
| void Renderer::DrawSpriteSheet | ( | Vec2 | pos, |
| Vec2 | size, | ||
| float | row, | ||
| float | col, | ||
| int | layer, | ||
| SpriteSheet & | s ) |
Draw a part of a sprite sheet
| pos | Position of the texture |
| size | Size of the texture |
| row | row in the sprite sheet |
| col | column in the sprite sheet |
| layer | Layer of the texture (higher layers are drawn on top of lower layers) |
| s | the sprite sheet to use |
Definition at line 303 of file renderer.cpp.
| void Renderer::DrawTexture | ( | Vec2 | pos, |
| Vec2 | size, | ||
| bool | reverse_x, | ||
| bool | reverse_y, | ||
| int | layer, | ||
| Texture & | texture ) |
Draw a texture
| pos | Position of the texture |
| size | Size of the texture |
| reverse_x | if true, the texture will be reversed on the x axis |
| reverse_y | if true, the texture will be reversed on the y axis |
| layer | Layer of the texture (higher layers are drawn on top of lower layers) |
| texture | the texture to draw |
Definition at line 290 of file renderer.cpp.
Draw a texture
| pos | Position of the texture |
| size | Size of the texture |
| layer | Layer of the texture (higher layers are drawn on top of lower layers) |
| texID | ID of the texture |
Definition at line 254 of file renderer.cpp.
| void Renderer::DrawTexture | ( | Vec2 | pos, |
| Vec2 | size, | ||
| Vec2 | texture_pos, | ||
| Vec2 | texture_size, | ||
| Vec2 | texture_total_size, | ||
| int | layer, | ||
| float | texID ) |
Render a portion of a texture
| pos | Position of the texture |
| size | Size of the texture |
| texture_pos | Position of the portion of the texture |
| texture_size | Size of the portion of the texture |
| texture_total_size | Size of the whole texture |
| layer | Layer of the texture (higher layers are drawn on top of lower layers) |
Definition at line 272 of file renderer.cpp.
Draw a triangle
| pos1 | Position of the first vertex |
| pos2 | Position of the second vertex |
| pos3 | Position of the third vertex |
| color | Color of the triangle |
| layer | Layer of the triangle (higher layers are drawn on top of lower layers) |
Definition at line 345 of file renderer.cpp.
| float Renderer::GetExposure | ( | ) |
Definition at line 250 of file renderer.cpp.
|
inline |
Definition at line 237 of file renderer.hpp.
| float Renderer::GetGamma | ( | ) |
Definition at line 242 of file renderer.cpp.
| std::pair< Vec2, float > Renderer::GetIntersection | ( | const std::pair< Vec2, Vec2 > & | ray, |
| const std::pair< Vec2, Vec2 > & | seg ) |
Get the intersection between a ray and a segment
| ray | the ray |
| seg | the segment |
Definition at line 774 of file renderer.cpp.
|
inline |
Definition at line 236 of file renderer.hpp.
| float Renderer::GetLineWidth | ( | ) |
Definition at line 434 of file renderer.cpp.
| float Renderer::GetPointSize | ( | ) |
Definition at line 430 of file renderer.cpp.
Definition at line 770 of file renderer.cpp.
| TonemapType Renderer::GetTonemapType | ( | ) |
Definition at line 234 of file renderer.cpp.
|
static |
Definition at line 1118 of file renderer.cpp.
|
static |
Definition at line 1095 of file renderer.cpp.
|
static |
Definition at line 1112 of file renderer.cpp.
|
static |
Definition at line 1007 of file renderer.cpp.
|
static |
Definition at line 1089 of file renderer.cpp.
|
static |
Definition at line 1016 of file renderer.cpp.
| void Renderer::KeepCircle | ( | Vec2 | pos, |
| float | radius, | ||
| float | blurAmount ) |
Keep a circle of light. Used for point lights with walls collisions
| pos | Position of the light |
| radius | Radius of the light |
| blurAmount | Amount of blur starting from the edge of the light |
Definition at line 893 of file renderer.cpp.
| void Renderer::PostProcessing | ( | ) |
Apply the post processing function
Definition at line 749 of file renderer.cpp.
| void Renderer::ReloadShaders | ( | ) |
Definition at line 947 of file renderer.cpp.
| void Renderer::Render | ( | bool | post_processing = false | ) |
Render all the elements stored in buffers
Definition at line 565 of file renderer.cpp.
| void Renderer::RenderLines | ( | float | max_layer | ) |
Render all the lines stored in the buffer
Definition at line 707 of file renderer.cpp.
| void Renderer::RenderPoints | ( | float | max_layer | ) |
Render all the points stored in the buffer
Definition at line 682 of file renderer.cpp.
| void Renderer::RenderTextures | ( | bool | post_processing, |
| float | max_layer ) |
Render all the textures stored in the buffer
Definition at line 602 of file renderer.cpp.
| void Renderer::RenderTriangles | ( | float | max_layer | ) |
Render all the triangles stored in the buffer
Definition at line 657 of file renderer.cpp.
| void Renderer::SetAmbientLight | ( | Vec3 | color | ) |
Definition at line 438 of file renderer.cpp.
| void Renderer::SetClearColor | ( | Vec3 | color | ) |
Definition at line 442 of file renderer.cpp.
| void Renderer::SetExposure | ( | float | exposure | ) |
Definition at line 246 of file renderer.cpp.
| void Renderer::SetGamma | ( | float | gamma | ) |
Definition at line 238 of file renderer.cpp.
| void Renderer::SetLineWidth | ( | float | new_size | ) |
Definition at line 411 of file renderer.cpp.
| void Renderer::SetPointSize | ( | float | new_size | ) |
| new_size | the new diameter |
Definition at line 423 of file renderer.cpp.
| void Renderer::SetPostProcessing | ( | const char * | uniform_name | ) |
Set the post processing function name in the shader
Definition at line 745 of file renderer.cpp.
|
inline |
Definition at line 249 of file renderer.hpp.
| void Renderer::SetTonemapType | ( | TonemapType | type | ) |
Definition at line 230 of file renderer.cpp.
|
inline |
Definition at line 252 of file renderer.hpp.
|
inline |
Definition at line 255 of file renderer.hpp.
| void Renderer::StartScene | ( | ) |
Definition at line 446 of file renderer.cpp.
| void Renderer::UpdateLineWidth | ( | ) |
Definition at line 416 of file renderer.cpp.
| void Renderer::UpdateScreenSegments | ( | ) |
Definition at line 758 of file renderer.cpp.
|
friend |
Definition at line 267 of file renderer.hpp.