BARE2D
BumpyRenderer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "BasicRenderer.hpp"
4 
5 namespace BARE2D {
6 
7  /**
8  * @class BumpyGlyph
9  * @brief This is a glyph, but with bumpmap (for lighting etc.).
10  */
11  class BumpyGlyph : public Glyph {
12  public:
13  BumpyGlyph(glm::vec4& destRect, glm::vec4& uvRect, GLuint& Texture, GLuint& Bumpmap, float& Depth, Colour& colour, float& angle, glm::vec2& COR);
14 
15  // Bumpmap texture handle
16  GLuint bumpmap;
17  };
18 
19  /**
20  * @class BumpyRenderer
21  * @brief This is a BasicRenderer, but it includes the usage of bumpmaps. This can be useful for lighting. Has an additional uniform bumpmapSampler (sampler2D).
22  */
23  class BumpyRenderer : public BasicRenderer {
24  public:
25  BumpyRenderer(std::string& fragShader, std::string& vertShader, unsigned int perspectiveWidth = 2, unsigned int perspectiveHeight = 2);
27 
28  virtual void initUniforms() override;
29 
30  virtual void preRender() override;
31 
32  virtual void render() override;
33 
34  // We need to delete this function, as it is no longer valid - we require a bumpmap.
35  virtual void draw(glm::vec4 destRect, glm::vec4 uvRect, GLuint texture, float depth, Colour colour = Colour(255, 255, 255, 255), float angle = 0.0f, glm::vec2 COR = glm::vec2(0.5f));
36  virtual void draw(glm::vec4 destRect, glm::vec4 uvRect, GLuint texture, GLuint bumpmap, float depth, Colour colour = Colour(255, 255, 255, 255), float angle = 0.0f, glm::vec2 COR = glm::vec2(0.5f));
37 
38  protected:
39  virtual void createRenderBatches() override;
40 
41  // The bumpmaps that correspond to each render batch.
42  std::vector<GLuint> m_batchBumpmaps;
43 
44  };
45 
46 }
BARE2D
Definition: App.cpp:13
BasicRenderer.hpp
A simple renderer. Has the GLSL VAOs vertexPosition (vec3), vertexColour (vec4), and vertexUV (vec2)....
BARE2D::BumpyRenderer::initUniforms
virtual void initUniforms() override
Initializes all uniforms, such as colour attachments, depth attachments, etc.
Definition: BumpyRenderer.cpp:19
BARE2D::BumpyRenderer::createRenderBatches
virtual void createRenderBatches() override
Constructs all of the render batches from data given by, say, draw() calls.
Definition: BumpyRenderer.cpp:86
BARE2D::BumpyRenderer::preRender
virtual void preRender() override
Does stuff inside of the render function, within the shader's use.
Definition: BumpyRenderer.cpp:27
BARE2D::Texture
The texture struct holds very basic stuff - the filepath, width, height, and ID,.
Definition: Texture.hpp:13
BARE2D::BumpyRenderer::draw
virtual void draw(glm::vec4 destRect, glm::vec4 uvRect, GLuint texture, float depth, Colour colour=Colour(255, 255, 255, 255), float angle=0.0f, glm::vec2 COR=glm::vec2(0.5f))
Definition: BumpyRenderer.cpp:73
BARE2D::BumpyRenderer::m_batchBumpmaps
std::vector< GLuint > m_batchBumpmaps
Definition: BumpyRenderer.hpp:42
BARE2D::BumpyRenderer
This is a BasicRenderer, but it includes the usage of bumpmaps. This can be useful for lighting....
Definition: BumpyRenderer.hpp:23
BARE2D::Glyph
The glyph represents a renderbatch's primitive data, which is created from each draw call in the basi...
Definition: Vertex.hpp:87
BARE2D::BumpyRenderer::~BumpyRenderer
~BumpyRenderer()
Definition: BumpyRenderer.cpp:16
BARE2D::BumpyRenderer::BumpyRenderer
BumpyRenderer(std::string &fragShader, std::string &vertShader, unsigned int perspectiveWidth=2, unsigned int perspectiveHeight=2)
Definition: BumpyRenderer.cpp:12
BARE2D::BasicRenderer
Definition: BasicRenderer.hpp:18
BARE2D::BumpyRenderer::render
virtual void render() override
Actually renders the contents to the screen!
Definition: BumpyRenderer.cpp:35
BARE2D::BumpyGlyph::bumpmap
GLuint bumpmap
Definition: BumpyRenderer.hpp:16
BARE2D::BumpyGlyph::BumpyGlyph
BumpyGlyph(glm::vec4 &destRect, glm::vec4 &uvRect, GLuint &Texture, GLuint &Bumpmap, float &Depth, Colour &colour, float &angle, glm::vec2 &COR)
Definition: BumpyRenderer.cpp:7
BARE2D::BumpyGlyph
This is a glyph, but with bumpmap (for lighting etc.).
Definition: BumpyRenderer.hpp:11
BARE2D::Colour
An RGBA 8-bit colour value.
Definition: Vertex.hpp:20