|
|
|
@ -29,6 +29,7 @@ namespace lunarium
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
struct FrameStats
|
|
|
|
struct FrameStats
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int NumVerts = 0;
|
|
|
|
int NumTris = 0;
|
|
|
|
int NumTris = 0;
|
|
|
|
int DrawCalls = 0;
|
|
|
|
int DrawCalls = 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
@ -44,11 +45,15 @@ namespace lunarium
|
|
|
|
|
|
|
|
|
|
|
|
// Draw methods
|
|
|
|
// Draw methods
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// sub_texture_area is the area of the texture to draw
|
|
|
|
|
|
|
|
/// position is the top-left corner of the quad
|
|
|
|
|
|
|
|
void DrawSprite(Texture* texture, glm::vec2 position, Rectangle sub_texture_area, Color color = Color::White(), float angle = 0.0f);
|
|
|
|
|
|
|
|
|
|
|
|
/// sub_texture_area is the area of the texture to draw
|
|
|
|
/// sub_texture_area is the area of the texture to draw
|
|
|
|
void DrawQuad(Rectangle quad, Color color, Texture* texture = nullptr, float angle = 0.0f, Rectangle sub_texture_area = Rectangle(-1, -1, -1, -1));
|
|
|
|
void DrawQuad(Rectangle quad, Color color, Texture* texture = nullptr, float angle = 0.0f, Rectangle sub_texture_area = Rectangle(-1, -1, -1, -1));
|
|
|
|
void DrawQuads(Rectangle* quads, u32 num_quads, Color* pColors);
|
|
|
|
void DrawLine(glm::vec2 point_a, glm::vec2 point_b, Color color, float thickness = 1.0f, float angle = 0.0f);
|
|
|
|
void DrawSprite(Texture& image, glm::vec2 position, Color color = {1.0f, 1.0f, 1.0f, 1.0f}, float angle = 0);
|
|
|
|
void DrawBox(Rectangle box, Color color, float thickness = 1.0f, float angle = 0.0f);
|
|
|
|
void DrawSprite(Texture& image, Rectangle source, Rectangle destination, Color color = {1.0f, 1.0f, 1.0f, 1.0f}, float angle = 0);
|
|
|
|
void DrawEllipse(glm::vec2 center_point, glm::vec2 radii, Color color, bool filled = false, float thickness = 1.0f, float angle = 0.0f);
|
|
|
|
void DrawString(const char* string, Rectangle bounding_box, Color color = {1.0f, 1.0f, 1.0f, 1.0f}, float scale = 1.0f, int font = -1);
|
|
|
|
void DrawString(const char* string, Rectangle bounding_box, Color color = {1.0f, 1.0f, 1.0f, 1.0f}, float scale = 1.0f, int font = -1);
|
|
|
|
|
|
|
|
|
|
|
|
// DEBUG:
|
|
|
|
// DEBUG:
|
|
|
|
@ -76,13 +81,6 @@ namespace lunarium
|
|
|
|
const int MaxIndices = MaxQuads * 6;
|
|
|
|
const int MaxIndices = MaxQuads * 6;
|
|
|
|
const int TextureSlots = 32;
|
|
|
|
const int TextureSlots = 32;
|
|
|
|
|
|
|
|
|
|
|
|
// const glm::vec4 vert_pos[4] = {
|
|
|
|
|
|
|
|
// { -0.5f, 0.5f, 0.0f, 1.0f }, // TOP LEFT
|
|
|
|
|
|
|
|
// { 0.5f, 0.5f, 0.0f, 1.0f }, // TOP RIGHT
|
|
|
|
|
|
|
|
// { 0.5f, -0.5f, 0.0f, 1.0f }, // BOTTOM RIGHT
|
|
|
|
|
|
|
|
// { -0.5f, -0.5f, 0.0f, 1.0f } // BOTTOM LEFT
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const glm::vec4 vert_pos[4] = {
|
|
|
|
const glm::vec4 vert_pos[4] = {
|
|
|
|
{ -0.5f, -0.5f, 0.0f, 1.0f },
|
|
|
|
{ -0.5f, -0.5f, 0.0f, 1.0f },
|
|
|
|
{ 0.5f, -0.5f, 0.0f, 1.0f },
|
|
|
|
{ 0.5f, -0.5f, 0.0f, 1.0f },
|
|
|
|
@ -109,7 +107,6 @@ namespace lunarium
|
|
|
|
float tex_is_grey_scale; // 0 or 1, this is mostly used for text rendering
|
|
|
|
float tex_is_grey_scale; // 0 or 1, this is mostly used for text rendering
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//const u32 indices[6] = { 0, 1, 2, 0, 2, 3 };
|
|
|
|
|
|
|
|
const u32 indices[6] = { 0, 1, 2, 2, 3, 0 };
|
|
|
|
const u32 indices[6] = { 0, 1, 2, 2, 3, 0 };
|
|
|
|
|
|
|
|
|
|
|
|
Vertex* mRawVertexBuffer;
|
|
|
|
Vertex* mRawVertexBuffer;
|
|
|
|
@ -117,10 +114,32 @@ namespace lunarium
|
|
|
|
|
|
|
|
|
|
|
|
BufferLayout mBufferLayout;
|
|
|
|
BufferLayout mBufferLayout;
|
|
|
|
VertexBuffer* mVertexBuffer;
|
|
|
|
VertexBuffer* mVertexBuffer;
|
|
|
|
//IndexBuffer* mIndexBuffer;
|
|
|
|
|
|
|
|
Shader* mQuadShader;
|
|
|
|
Shader* mQuadShader;
|
|
|
|
} mQuadData;
|
|
|
|
} mQuadData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct EllipseData
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} mEllipseData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct LineData
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Vertex
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
glm::vec2 pos;
|
|
|
|
|
|
|
|
glm::vec4 color;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vertex* mRawVertexBuffer;
|
|
|
|
|
|
|
|
int mRawBufferIndex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BufferLayout mBufferLayout;
|
|
|
|
|
|
|
|
VertexBuffer* mVertexBuffer;
|
|
|
|
|
|
|
|
Shader* mShader;
|
|
|
|
|
|
|
|
} mLineData;
|
|
|
|
|
|
|
|
|
|
|
|
TextRenderer mTextAPI;
|
|
|
|
TextRenderer mTextAPI;
|
|
|
|
int mDefaultFont;
|
|
|
|
int mDefaultFont;
|
|
|
|
|
|
|
|
|
|
|
|
|