Refactor + render animation tweaks + updated frame properties + bug fixes

This commit is contained in:
shweet committed 2025-12-17 23:02:00 -05:00
1 parent b4b4fe3714
commit 119bbc4081
63 files changed
+1964 -1701

No files matched your search

+27 -26
View File
@@ -6,35 +6,37 @@
#include "framebuffer.h"
#include "shader.h"
namespace anm2ed::canvas
{
constexpr float TEXTURE_VERTICES[] = {0, 0, 0.0f, 0.0f, 1, 0, 1.0f, 0.0f, 1, 1, 1.0f, 1.0f, 0, 1, 0.0f, 1.0f};
constexpr auto PIVOT_SIZE = glm::vec2(8, 8);
constexpr auto ZOOM_MIN = 1.0f;
constexpr auto ZOOM_MAX = 2000.0f;
constexpr auto DASH_LENGTH = 4.0f;
constexpr auto DASH_GAP = 1.0f;
constexpr auto DASH_OFFSET = 1.0f;
constexpr auto STEP = 1.0f;
constexpr auto STEP_FAST = 5.0f;
constexpr auto GRID_SIZE_MIN = 1;
constexpr auto GRID_SIZE_MAX = 10000;
constexpr auto GRID_OFFSET_MIN = 0;
constexpr auto GRID_OFFSET_MAX = 10000;
constexpr auto CHECKER_SIZE = 32.0f;
}
#include "types.h"
namespace anm2ed
{
class Canvas : public Framebuffer
{
public:
static constexpr float TEXTURE_VERTICES[] = {0, 0, 0.0f, 0.0f, 1, 0, 1.0f, 0.0f,
1, 1, 1.0f, 1.0f, 0, 1, 0.0f, 1.0f};
static constexpr auto PIVOT_SIZE = glm::vec2(8, 8);
static constexpr auto ZOOM_MIN = 1.0f;
static constexpr auto ZOOM_MAX = 2000.0f;
static constexpr auto DASH_LENGTH = 4.0f;
static constexpr auto DASH_GAP = 1.0f;
static constexpr auto DASH_OFFSET = 1.0f;
static constexpr auto STEP = 1.0f;
static constexpr auto STEP_FAST = 5.0f;
static constexpr auto GRID_SIZE_MIN = 1;
static constexpr auto GRID_SIZE_MAX = 10000;
static constexpr auto GRID_OFFSET_MIN = 0;
static constexpr auto GRID_OFFSET_MAX = 10000;
static constexpr auto CHECKER_SIZE = 32.0f;
static constexpr float AXIS_VERTICES[] = {-1.0f, 0.0f, 1.0f, 0.0f};
static constexpr float GRID_VERTICES[] = {-1.f, -1.f, 0.f, 0.f, 3.f, -1.f, 2.f, 0.f, -1.f, 3.f, 0.f, 2.f};
static constexpr float RECT_VERTICES[] = {0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f};
static constexpr GLuint TEXTURE_INDICES[] = {0, 1, 2, 2, 3, 0};
static constexpr auto BORDER_DASH_LENGTH = 1.0f;
static constexpr auto BORDER_DASH_GAP = 0.5f;
static constexpr auto BORDER_DASH_OFFSET = 0.0f;
static constexpr auto PIVOT_COLOR = types::color::PINK;
GLuint axisVAO{};
GLuint axisVBO{};
GLuint rectVAO{};
@@ -53,10 +55,9 @@ namespace anm2ed
void grid_render(resource::Shader&, float, glm::vec2, glm::ivec2 = glm::ivec2(32, 32), glm::ivec2 = {},
glm::vec4 = glm::vec4(1.0f)) const;
void texture_render(resource::Shader&, GLuint&, glm::mat4 = {1.0f}, glm::vec4 = glm::vec4(1.0f), glm::vec3 = {},
float* = (float*)canvas::TEXTURE_VERTICES) const;
float* = (float*)TEXTURE_VERTICES) const;
void rect_render(resource::Shader&, const glm::mat4&, const glm::mat4&, glm::vec4 = glm::vec4(1.0f),
float dashLength = canvas::DASH_LENGTH, float dashGap = canvas::DASH_GAP,
float dashOffset = canvas::DASH_OFFSET) const;
float dashLength = DASH_LENGTH, float dashGap = DASH_GAP, float dashOffset = DASH_OFFSET) const;
void zoom_set(float&, glm::vec2&, glm::vec2, float) const;
glm::vec2 position_translate(float&, glm::vec2&, glm::vec2) const;
void set_to_rect(float& zoom, glm::vec2& pan, glm::vec4 rect) const;