19 : point_count_(point_count),
30 if (radius_ < 0.0 || point_count_ == 0) {
39 Scalar min_size = 0.5f / max_basis;
40 Scalar radius = std::max(radius_, min_size);
43 size_t vertex_count = 0;
52 std::vector<Point> circle_vertices;
53 circle_vertices.reserve(generator.GetVertexCount());
54 generator.GenerateVertices([&circle_vertices](
const Point& p) {
55 circle_vertices.push_back(p);
57 FML_DCHECK(circle_vertices.size() == generator.GetVertexCount());
59 vertex_count = (circle_vertices.size() + 2) * point_count_ - 2;
65 Point center = points_[0];
66 for (
auto& vertex : circle_vertices) {
67 output[offset++] =
static_cast<Point>(center + vertex);
72 Point last_point = circle_vertices.back() + center;
73 for (
size_t i = 1; i < point_count_; i++) {
74 Point center = points_[i];
75 output[offset++] = last_point;
76 output[offset++] =
static_cast<Point>(center + circle_vertices[0]);
77 for (
const Point& vertex : circle_vertices) {
78 output[offset++] =
static_cast<Point>(center + vertex);
80 last_point = circle_vertices.back() + center;
84 vertex_count = 6 * point_count_ - 2;
90 Point point = points_[0];
91 Point first =
Point(point.x - radius, point.y - radius);
95 output[offset++] = first;
96 output[offset++] =
Point(point.x + radius, point.y - radius);
97 output[offset++] =
Point(point.x - radius, point.y + radius);
98 output[offset++] = last_point =
99 Point(point.x + radius, point.y + radius);
104 for (
size_t i = 1; i < point_count_; i++) {
105 Point point = points_[i];
106 Point first =
Point(point.x - radius, point.y - radius);
108 output[offset++] = last_point;
109 output[offset++] = first;
111 output[offset++] = first;
112 output[offset++] =
Point(point.x + radius, point.y - radius);
113 output[offset++] =
Point(point.x - radius, point.y + radius);
114 output[offset++] = last_point =
115 Point(point.x + radius, point.y + radius);
120 return GeometryResult{
126 .vertex_count = vertex_count,
136 if (point_count_ > 0) {
143 for (
auto i = 1u; i < point_count_; i++) {
144 const Point point = points_[i];
145 left = std::min(left, point.
x);
146 top = std::min(top, point.
y);
147 right = std::max(right, point.
x);
148 bottom = std::max(bottom, point.
y);
151 right + radius_, bottom + radius_);
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
Tessellator & GetTessellator() const
Matrix GetShaderTransform(const RenderPass &pass) const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
std::optional< Rect > GetCoverage(const Matrix &transform) const override
~PointFieldGeometry() override
PointFieldGeometry(const Point *points, size_t point_count, Scalar radius, bool round)
Render passes encode render commands directed as one specific render target into an underlying comman...
EllipticalVertexGenerator FilledCircle(const Matrix &view_transform, const Point ¢er, Scalar radius)
Create a |VertexGenerator| that can produce vertices for a filled circle of the given radius around t...
@ kNone
Does not use the index buffer.
Tessellator::EllipticalVertexGenerator EllipticalVertexGenerator
A 4x4 matrix using column-major storage.
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
std::vector< Point > points
std::shared_ptr< const fml::Mapping > data