6#include "qml_material/core.hpp"
8namespace qml_material::sg
22 void set_point(
float x,
float y)
noexcept {
26 void set_point(QVector2D v)
noexcept {
30 void set_color(QRgb c)
noexcept {
32 g = qGreen(c) / 255.0f;
33 b = qBlue(c) / 255.0f;
34 a = qAlpha(c) / 255.0f;
36 void set_color(
const QColor& c)
noexcept { set_color(c.rgb()); }
39struct RectangleVertex : BasicVertex {
43 float ce_distance_to_outter;
44 float ce_distance_to_inner;
46 operator QVector2D()
const {
return { x, y }; }
47 operator QColor()
const {
return QColor::fromRgbF(r, g, b, a); }
49auto create_rectangle_geometry() -> up<QSGGeometry>;
51void update_rectangle_geometry(RectangleVertex* vertexs, QVector2D size, QRgb color,
54auto create_blur_mask_geometry() -> up<QSGGeometry>;
55float blur_mask_margin(
float sigma)
noexcept;
60void update_blur_mask_geometry(BasicVertex* v, QVector2D rect_size,
float sigma, QRgb color,
63struct ShadowVertex : BasicVertex {
67 float distance_correction;
71 float occluder_height;
72 float occluder_radii[4];
74 void set_offset(QVector2D v)
noexcept {
79auto create_shadow_geometry() -> up<QSGGeometry>;
83 None_ShadowFlag = 0x00,
86 TransparentOccluder_ShadowFlag = 0x01,
88 GeometricOnly_ShadowFlag = 0x02,
90 DirectionalLight_ShadowFlag = 0x04,
92 ConcaveBlurOnly_ShadowFlag = 0x08,
97 QVector3D z_plane_params;
99 float light_radius { 0 };
100 QRgb ambient_color { 0 };
101 QRgb spot_color { 0 };
102 uint32_t flags { 0 };
105void update_shadow_geometry(QSGGeometry* geo,
const ShadowParams& params,
const QRectF& rect);
106QRectF shadow_bounds(
const ShadowParams& params,
const QRectF& rect);