39 lines
671 B
C
39 lines
671 B
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <extra2d/core/types.h>
|
||
|
|
#include <extra2d/core/math_types.h>
|
||
|
|
#include <extra2d/core/color.h>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
namespace extra2d {
|
||
|
|
namespace sdf {
|
||
|
|
|
||
|
|
enum class Shape {
|
||
|
|
Circle,
|
||
|
|
Rect,
|
||
|
|
RoundedRect,
|
||
|
|
Triangle,
|
||
|
|
Polygon,
|
||
|
|
Custom
|
||
|
|
};
|
||
|
|
|
||
|
|
struct Mat {
|
||
|
|
Shape shape = Shape::Circle;
|
||
|
|
Vec2 size = Vec2(1, 1);
|
||
|
|
f32 radius = 0.5f;
|
||
|
|
f32 edgeSoftness = 0.01f;
|
||
|
|
f32 outlineWidth = 0.0f;
|
||
|
|
Color outlineColor = Colors::Black;
|
||
|
|
bool antiAlias = true;
|
||
|
|
std::string customSdfFunc;
|
||
|
|
};
|
||
|
|
|
||
|
|
std::string genFragSrc(const Mat& mat);
|
||
|
|
|
||
|
|
extern const char* kCircleSdf;
|
||
|
|
extern const char* kRectSdf;
|
||
|
|
extern const char* kRoundedRectSdf;
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|