buncha slop

This commit is contained in:
shweet committed 2026-07-01 20:04:12 -04:00
1 parent f00396bdfe
commit 80ef3f8597
16 files changed
+405 -43

No files matched your search

+23
View File
@@ -2,6 +2,8 @@
#include <cmath>
#include <glad/glad.h>
namespace anm2ed::imgui
{
constexpr ImU32 DROP_LINE_COLOR = IM_COL32(255, 255, 0, 255);
@@ -42,6 +44,27 @@ namespace anm2ed::imgui
drawList->AddLine(ImVec2(min.x, y), ImVec2(max.x, y), DROP_LINE_COLOR, DROP_LINE_THICKNESS);
}
void image_premultiplied_blend_set(const ImDrawList*, const ImDrawCmd*)
{
glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
void image_premultiplied_draw(ImTextureID texture, ImVec2 size)
{
auto drawList = ImGui::GetWindowDrawList();
drawList->AddCallback(image_premultiplied_blend_set, nullptr);
ImGui::Image(texture, size);
drawList->AddCallback(ImDrawCallback_ResetRenderState, nullptr);
}
void image_premultiplied_draw(ImDrawList* drawList, ImTextureID texture, ImVec2 min, ImVec2 max)
{
if (!drawList) return;
drawList->AddCallback(image_premultiplied_blend_set, nullptr);
drawList->AddImage(texture, min, max);
drawList->AddCallback(ImDrawCallback_ResetRenderState, nullptr);
}
void render_checker_background(ImDrawList* drawList, ImVec2 min, ImVec2 max, glm::vec2 offset, float step)
{
if (!drawList || step <= 0.0f) return;
+2
View File
@@ -8,5 +8,7 @@ namespace anm2ed::imgui
bool is_drop_after(ImVec2, ImVec2);
void drop_box_draw(ImDrawList*, ImVec2, ImVec2);
void drop_line_draw(ImDrawList*, ImVec2, ImVec2, bool);
void image_premultiplied_draw(ImTextureID, ImVec2);
void image_premultiplied_draw(ImDrawList*, ImTextureID, ImVec2, ImVec2);
void render_checker_background(ImDrawList*, ImVec2, ImVec2, glm::vec2, float);
}