make square shader accessable
parent
ac79aa80df
commit
f60ce3dc0b
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
include(FetchContent)
|
||||
|
||||
set(BLT_GRAPHICS_VERSION 1.1.7)
|
||||
set(BLT_GRAPHICS_VERSION 1.1.8)
|
||||
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
|
||||
|
||||
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace blt::gfx
|
|||
private:
|
||||
std::unique_ptr<pp_engine_t> engine;
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
struct render_object_t
|
||||
{
|
||||
f32 z_index;
|
||||
|
@ -151,7 +151,7 @@ namespace blt::gfx
|
|||
using point2d_obj_t = render_object_t<point2d_t>;
|
||||
using line2d_obj_t = render_object_t<line2d_t>;
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
using object_container = hashmap_t<std::string, std::vector<std::pair<render_info_t, T>>>;
|
||||
|
||||
private:
|
||||
|
@ -161,6 +161,7 @@ namespace blt::gfx
|
|||
std::unique_ptr<shader_t> point_shader;
|
||||
resource_manager& resources;
|
||||
matrix_state_manager& state;
|
||||
|
||||
// texture name -> draw info
|
||||
struct
|
||||
{
|
||||
|
@ -172,7 +173,7 @@ namespace blt::gfx
|
|||
f32 z_max = std::numeric_limits<f32>::min();
|
||||
} draw;
|
||||
|
||||
template<typename E>
|
||||
template <typename E>
|
||||
static void insert_obj(object_container<E>& map, const render_info_t& info, const E& obj)
|
||||
{
|
||||
map[info.texture_name].emplace_back(info, obj);
|
||||
|
@ -231,36 +232,55 @@ namespace blt::gfx
|
|||
|
||||
void drawPointInternal(const render_info_t& draw_info, const point2d_t& point, f32 z_index = 0);
|
||||
|
||||
template<typename T, typename... P>
|
||||
template <typename T, typename... P>
|
||||
void drawRectangle(const T& render_info, P... p)
|
||||
{ drawRectangleInternal(render_info, {p...}); }
|
||||
{
|
||||
drawRectangleInternal(render_info, {p...});
|
||||
}
|
||||
|
||||
template<typename T, typename... P>
|
||||
template <typename T, typename... P>
|
||||
void drawPoint(const T& render_info, P... p)
|
||||
{ drawPointInternal(render_info, {p...}); }
|
||||
{
|
||||
drawPointInternal(render_info, {p...});
|
||||
}
|
||||
|
||||
template<typename T, typename... P>
|
||||
template <typename T, typename... P>
|
||||
void drawLine(const T& render_info, P... p)
|
||||
{ drawLineInternal(render_info, {p...}); }
|
||||
{
|
||||
drawLineInternal(render_info, {p...});
|
||||
}
|
||||
|
||||
template<typename T, typename... P>
|
||||
template <typename T, typename... P>
|
||||
void drawRectangle(const T& render_info, f32 z_index, P... p)
|
||||
{ drawRectangleInternal(render_info, {p...}, z_index); }
|
||||
{
|
||||
drawRectangleInternal(render_info, {p...}, z_index);
|
||||
}
|
||||
|
||||
template<typename T, typename... P>
|
||||
template <typename T, typename... P>
|
||||
void drawPoint(const T& render_info, f32 z_index, P... p)
|
||||
{ drawPointInternal(render_info, {p...}, z_index); }
|
||||
{
|
||||
drawPointInternal(render_info, {p...}, z_index);
|
||||
}
|
||||
|
||||
template<typename T, typename... P>
|
||||
template <typename T, typename... P>
|
||||
void drawLine(const T& render_info, f32 z_index, P... p)
|
||||
{ drawLineInternal(render_info, {p...}, z_index); }
|
||||
{
|
||||
drawLineInternal(render_info, {p...}, z_index);
|
||||
}
|
||||
|
||||
void render(i32 width, i32 height, bool transparency = true);
|
||||
|
||||
void cleanup();
|
||||
|
||||
[[nodiscard]] shader_t& get_square_shader() const
|
||||
{
|
||||
return *square_shader;
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t draw_count() const
|
||||
{ return draw.draw_count; }
|
||||
{
|
||||
return draw.draw_count;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue