2022-03-08 21:19:19 +03:30
|
|
|
#pragma once
|
|
|
|
|
2025-07-05 13:28:41 +03:30
|
|
|
#include <engine/base/base.hpp>
|
|
|
|
#include <engine/graphics/renderer_programs/renderer_program.hpp>
|
2022-03-08 21:19:19 +03:30
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
|
|
|
namespace Light {
|
|
|
|
|
|
|
|
class Shader;
|
|
|
|
class VertexBuffer;
|
|
|
|
class IndexBuffer;
|
|
|
|
class VertexLayout;
|
|
|
|
class OrthographicCamera;
|
|
|
|
class SharedContext;
|
|
|
|
|
|
|
|
class TintedTextureRendererProgram: RendererProgram
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct TintedTextureVertexData
|
|
|
|
{
|
|
|
|
glm::vec4 position;
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2022-03-08 21:19:19 +03:30
|
|
|
glm::vec4 tint;
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2022-03-08 21:19:19 +03:30
|
|
|
glm::vec2 texcoord;
|
|
|
|
};
|
|
|
|
|
|
|
|
TintedTextureRendererProgram(unsigned int maxVertices, Ref<SharedContext> sharedContext);
|
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto advance() -> bool;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void map() override;
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void un_map() override;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void bind() override;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto get_map_current() -> TintedTextureVertexData *
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 14:23:01 +03:30
|
|
|
return m_map_current;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto get_quad_count() const -> unsigned int
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 14:23:01 +03:30
|
|
|
return m_quad_count;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
constexpr auto get_vertex_size() const -> unsigned int
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
|
|
|
return sizeof(TintedTextureVertexData);
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
|
|
|
private:
|
|
|
|
Ref<Shader> m_shader;
|
|
|
|
|
|
|
|
Ref<VertexBuffer> m_vertex_buffer;
|
|
|
|
|
|
|
|
Ref<IndexBuffer> m_index_buffer;
|
|
|
|
|
|
|
|
Ref<VertexLayout> m_vertex_layout;
|
|
|
|
|
|
|
|
TintedTextureVertexData *m_map_current = nullptr;
|
|
|
|
|
|
|
|
TintedTextureVertexData *m_map_end = nullptr;
|
|
|
|
|
|
|
|
unsigned int m_quad_count;
|
|
|
|
|
|
|
|
unsigned int m_max_vertices;
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
2025-07-05 13:28:41 +03:30
|
|
|
} // namespace Light
|