Text component added and Text render queue
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "../GLM.h"
|
||||
#include "../Core/Util/Rectangle.h"
|
||||
#include "../Core/Entity.h"
|
||||
#include "Font.h"
|
||||
|
||||
class Model;
|
||||
class Skeleton;
|
||||
@@ -80,6 +81,19 @@ struct SpriteJob : RenderJob
|
||||
}
|
||||
};
|
||||
|
||||
struct TextJob : RenderJob
|
||||
{
|
||||
glm::mat4 ModelMatrix;
|
||||
glm::vec4 Color;
|
||||
std::string Content;
|
||||
Font* Resource;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct PointLightJob : RenderJob
|
||||
{
|
||||
glm::vec3 Position;
|
||||
@@ -137,17 +151,20 @@ struct RenderQueueCollection
|
||||
{
|
||||
RenderQueue Forward;
|
||||
RenderQueue Lights;
|
||||
RenderQueue Text;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
Forward.Clear();
|
||||
Lights.Clear();
|
||||
Text.Clear();
|
||||
}
|
||||
|
||||
void Sort()
|
||||
{
|
||||
Forward.Sort();
|
||||
Lights.Sort();
|
||||
Text.Sort();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ private:
|
||||
|
||||
void FillModels(World* world, RenderQueue* renderQueue);
|
||||
void FillLights(World* world, RenderQueue* renderQueue);
|
||||
void FillText(World* world, RenderQueue* renderQueue);
|
||||
|
||||
glm::mat4 ModelMatrix(World* world, EntityID entity);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "ShaderProgram.h"
|
||||
#include "Font.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "RenderQueue.h"
|
||||
|
||||
class TextRenderer
|
||||
{
|
||||
@@ -16,14 +17,14 @@ public:
|
||||
TextRenderer();
|
||||
void Initialize();
|
||||
void Update();
|
||||
void Draw(glm::mat4 projection, glm::mat4 view);
|
||||
void Draw(RenderQueue &rq, glm::mat4 projection, glm::mat4 view);
|
||||
|
||||
private:
|
||||
Font* font;
|
||||
|
||||
GLuint VAO, VBO;
|
||||
|
||||
void RenderText(std::string text, GLfloat x, GLfloat y, GLfloat scale, glm::vec3 color, glm::mat4 projection, glm::mat4 view);
|
||||
void RenderText(std::string text, Font* font, GLfloat scale, glm::vec4 color, glm::mat4 modelMatrix, glm::mat4 projectionMatrix, glm::mat4 viewMatrix);
|
||||
|
||||
ShaderProgram m_TextProgram;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user