Fireworks Engine  v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
ShotRenderer2D.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../renderables/renderable2d.h"
4 #include "renderer2d.h"
5 #include "../../components/component.h"
6 
7 namespace fireworks { namespace graphics {
8 
9 #define SHOT_RENDERER_MAX_SPRITES 1
10 #define SHOT_RENDERER_VERTEX_SIZE sizeof(VertexData)
11 #define SHOT_RENDERER_SPRITE_SIZE SHOT_RENDERER_VERTEX_SIZE * 4
12 #define SHOT_RENDERER_BUFFER_SIZE SHOT_RENDERER_SPRITE_SIZE * SHOT_RENDERER_MAX_SPRITES
13 #define SHOT_RENDERER_INDICES_SIZE SHOT_RENDERER_MAX_SPRITES * 6
14 
18  class ShotRenderer2D : public Renderer2D
19  {
20  private:
21  GLuint m_VAO;
22  GLuint m_VBO;
23  VertexData* m_Buffer;
24  IndexBuffer* m_IBO;
25  GLsizei m_IndicesCount;
26  GLuint m_Texture;
27  public:
31  ShotRenderer2D(Camera2D* camera);
33 
35  void begin() override;
37  void submit(const Renderable2D* renderable) override;
39  void end() override;
41  void flush() override;
42 private:
43  void init();
44 
45  };
46 
47 } }
Creates Index Buffers.
Definition: indexbuffer.h:11
The Class responsible for drawing the basic Renderable objects onto the screen.
Definition: renderable2d.h:36
The structure of the Vertex Data.
Definition: renderable2d.h:17
void flush() override
Draws the data processed onto the screen.
Definition: ShotRenderer2D.cpp:147
Definition: audioclip.cpp:3
void end() override
Ends the submission and prepares the renderer to start drawing.
Definition: ShotRenderer2D.cpp:141
void submit(const Renderable2D *renderable) override
Begins to submit the renderables to render queue.
Definition: ShotRenderer2D.cpp:60
Forward declaration of the graphics::Renderable2D.
Definition: renderer2d.h:15
ShotRenderer2D(Camera2D *camera)
Creates the renderer from the camera.
Definition: ShotRenderer2D.cpp:6
Renders the renderables on a per draw call basis.
Definition: ShotRenderer2D.h:18
The eye of the 2D world.
Definition: camera2d.h:11
~ShotRenderer2D()
Definition: ShotRenderer2D.cpp:12
void begin() override
Begins the rendering process.
Definition: ShotRenderer2D.cpp:54