2025-07-06 20:43:53 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include <Eigen/Dense>
|
|
|
|
|
#include <include/core/SkCanvas.h>
|
|
|
|
|
#include "DrawData.hpp"
|
|
|
|
|
#include <include/core/SkPath.h>
|
|
|
|
|
#include <include/effects/SkRuntimeEffect.h>
|
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
|
|
|
|
|
|
using namespace Eigen;
|
|
|
|
|
|
|
|
|
|
class MainProgram;
|
|
|
|
|
|
|
|
|
|
class GridManager {
|
|
|
|
|
public:
|
|
|
|
|
GridManager(MainProgram& initMain);
|
|
|
|
|
void draw(SkCanvas* canvas, const DrawData& drawData);
|
|
|
|
|
|
|
|
|
|
enum GridType : unsigned {
|
|
|
|
|
GRIDTYPE_NONE = 0,
|
|
|
|
|
GRIDTYPE_CIRCLEDOT,
|
|
|
|
|
GRIDTYPE_SQUAREDOT,
|
|
|
|
|
GRIDTYPE_LINE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GridType gridType = GRIDTYPE_CIRCLEDOT;
|
|
|
|
|
private:
|
2025-08-01 10:58:45 +03:00
|
|
|
sk_sp<SkShader> get_shader(const sk_sp<SkRuntimeEffect>& runtimeEffect, const SkColor4f& pointColor);
|
2025-07-06 20:43:53 +03:00
|
|
|
Vector2f oldWindowSize{0.0f, 0.0f};
|
|
|
|
|
WorldScalar size{50000000};
|
|
|
|
|
SkPath gridPath;
|
2025-08-01 10:58:45 +03:00
|
|
|
sk_sp<SkRuntimeEffect> circleDotEffect;
|
|
|
|
|
sk_sp<SkRuntimeEffect> squareDotEffect;
|
2025-07-06 20:43:53 +03:00
|
|
|
MainProgram& main;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NLOHMANN_JSON_SERIALIZE_ENUM(GridManager::GridType, {
|
|
|
|
|
{GridManager::GRIDTYPE_NONE, "None"},
|
|
|
|
|
{GridManager::GRIDTYPE_CIRCLEDOT, "Circle Dot"},
|
|
|
|
|
{GridManager::GRIDTYPE_SQUAREDOT, "Square Dot"},
|
|
|
|
|
{GridManager::GRIDTYPE_LINE, "Line"}
|
|
|
|
|
})
|