 |
Flutter Impeller
|
|
Go to the documentation of this file.
27 using VT = SolidFillVertexShader::PerVertexData;
36 count *
sizeof(VT),
alignof(VT),
37 [&generator](uint8_t* buffer) {
38 auto vertices =
reinterpret_cast<VT*
>(buffer);
44 FML_DCHECK(vertices ==
reinterpret_cast<VT*
>(buffer) +
47 .vertex_count = count,
51 .prevent_overdraw =
false,
57 const Matrix& uv_transform,
60 using VT = TextureFillVertexShader::PerVertexData;
69 count *
sizeof(VT),
alignof(VT),
70 [&generator, &uv_transform](uint8_t* buffer) {
71 auto vertices =
reinterpret_cast<VT*
>(buffer);
73 [&vertices, &uv_transform](
const Point& p) {
76 .texture_coords = uv_transform * p,
79 FML_DCHECK(vertices ==
reinterpret_cast<VT*
>(buffer) +
82 .vertex_count = count,
86 .prevent_overdraw =
false,
94 Size texture_coverage,
99 [&vertex_builder, &texture_coverage, &effect_transform,
100 &texture_origin](SolidFillVertexShader::PerVertexData old_vtx) {
101 TextureFillVertexShader::PerVertexData data;
102 data.position = old_vtx.position;
103 data.texture_coords = effect_transform *
104 (old_vtx.position - texture_origin) /
108 return vertex_builder;
112 Rect texture_coverage,
121 std::vector<Point> data(8);
123 for (
auto i = 0u, j = 0u; i < 8; i += 2, j++) {
125 data[i + 1] = uv_transform * points[j];
132 .vertex_buffer = host_buffer.Emplace(
133 data.data(), 16 *
sizeof(
float),
alignof(
float)),
138 .prevent_overdraw =
false,
152 std::optional<Rect> inner_rect) {
153 return std::make_shared<FillPathGeometry>(std::move(path), inner_rect);
159 return std::make_shared<PointFieldGeometry>(std::move(points), radius, round);
168 if (miter_limit < 0) {
171 return std::make_shared<StrokePathGeometry>(
172 std::move(path), stroke_width, miter_limit, stroke_cap, stroke_join);
176 return std::make_shared<CoverGeometry>();
180 return std::make_shared<RectGeometry>(rect);
184 return std::make_shared<EllipseGeometry>(rect);
191 return std::make_shared<LineGeometry>(p0, p1, width, cap);
196 return std::make_shared<CircleGeometry>(center, radius);
202 return std::make_shared<CircleGeometry>(center, radius, stroke_width);
207 return std::make_shared<RoundRectGeometry>(rect, radii);
static std::shared_ptr< Geometry > MakePointField(std::vector< Point > points, Scalar radius, bool round)
static std::shared_ptr< Geometry > MakeStrokedCircle(const Point ¢er, Scalar radius, Scalar stroke_width)
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
static std::shared_ptr< Geometry > MakeRoundRect(const Rect &rect, const Size &radii)
size_t GetVertexCount() const
BufferView Emplace(const BufferType &buffer)
Emplace non-uniform data (like contiguous vertices) onto the host buffer.
constexpr Matrix GetNormalizingTransform() const
Constructs a Matrix that will map all points in the coordinate space of the rectangle into a new norm...
virtual bool IsAxisAlignedRect() const
virtual bool CoversArea(const Matrix &transform, const Rect &rect) const
Determines if this geometry, transformed by the given transform, will completely cover all surface ar...
virtual void GenerateVertices(const TessellatedVertexProc &proc) const =0
Generate the vertices and deliver them in the necessary order (as required by the PrimitiveType) to t...
const Matrix & GetOrthographicTransform() const
VertexBufferBuilder< TextureFillVertexShader::PerVertexData > ComputeUVGeometryCPU(VertexBufferBuilder< SolidFillVertexShader::PerVertexData > &input, Point texture_origin, Size texture_coverage, Matrix effect_transform)
Compute UV geometry for a VBB that contains only position geometry.
static std::shared_ptr< Geometry > MakeStrokePath(Path path, Scalar stroke_width=0.0, Scalar miter_limit=4.0, Cap stroke_cap=Cap::kButt, Join stroke_join=Join::kMiter)
constexpr std::array< TPoint< T >, 4 > GetPoints() const
Get the points that represent the 4 corners of this rectangle. The order is: Top left,...
static std::shared_ptr< Geometry > MakeOval(const Rect &rect)
An object which produces a list of vertices as |Point|s that tessellate a previously provided shape a...
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
virtual GeometryResult GetPositionUVBuffer(Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass) const =0
@ kNone
Does not use the index buffer.
static GeometryResult ComputePositionGeometry(const Tessellator::VertexGenerator &generator, const Entity &entity, RenderPass &pass)
void IterateVertices(const std::function< void(VertexType &)> &iterator)
static std::shared_ptr< Geometry > MakeFillPath(Path path, std::optional< Rect > inner_rect=std::nullopt)
Render passes encode render commands directed as one specific render target into an underlying comman...
static std::shared_ptr< Geometry > MakeRect(const Rect &rect)
virtual PrimitiveType GetTriangleType() const =0
Returns the |PrimitiveType| that describes the relationship among the list of vertices produced by th...
VertexBufferBuilder & AppendVertex(VertexType_ vertex)
virtual size_t GetVertexCount() const =0
Returns the number of vertices that the generator plans to produce, if known.
static std::shared_ptr< Geometry > MakeCircle(const Point ¢er, Scalar radius)
void Reserve(size_t count)
GeometryResult ComputeUVGeometryForRect(Rect source_rect, Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass)
static GeometryResult ComputePositionUVGeometry(const Tessellator::VertexGenerator &generator, const Matrix &uv_transform, const Entity &entity, RenderPass &pass)
A 4x4 matrix using column-major storage.
HostBuffer & GetTransientsBuffer()
static std::shared_ptr< Geometry > MakeCover()
static std::shared_ptr< Geometry > MakeLine(const Point &p0, const Point &p1, Scalar width, Cap cap)