| Flutter Impeller |

vertices_geometry.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_ENTITY_GEOMETRY_VERTICES_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_VERTICES_GEOMETRY_H_
7
8 #include "impeller/entity/geometry/geometry.h"
9
10 namespace impeller {
11
12 /// @brief A geometry that is created from a vertices object.
13 class VerticesGeometry final : public Geometry {
14 public:
15 enum class VertexMode {
16 kTriangles,
17 kTriangleStrip,
18 kTriangleFan,
19 };
20
21 VerticesGeometry(std::vector<Point> vertices,
22 std::vector<uint16_t> indices,
23 std::vector<Point> texture_coordinates,
24 std::vector<Color> colors,
25 Rect bounds,
26 VerticesGeometry::VertexMode vertex_mode);
27
28 ~VerticesGeometry() = default;
29
30 GeometryResult GetPositionUVColorBuffer(Rect texture_coverage,
31 Matrix effect_transform,
32 const ContentContext& renderer,
33 const Entity& entity,
34 RenderPass& pass) const;
35
36 // |Geometry|
37 GeometryResult GetPositionBuffer(const ContentContext& renderer,
38 const Entity& entity,
39 RenderPass& pass) const override;
40
41 // |Geometry|
42 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
43
44 bool HasVertexColors() const;
45
46 bool HasTextureCoordinates() const;
47
48 std::optional<Rect> GetTextureCoordinateCoverge() const;
49
50 private:
51 void NormalizeIndices();
52
53 PrimitiveType GetPrimitiveType() const;
54
55 std::vector<Point> vertices_;
56 std::vector<Color> colors_;
57 std::vector<Point> texture_coordinates_;
58 std::vector<uint16_t> indices_;
59 Rect bounds_;
60 VerticesGeometry::VertexMode vertex_mode_ =
61 VerticesGeometry::VertexMode::kTriangles;
62 };
63
64 } // namespace impeller
65
66 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_VERTICES_GEOMETRY_H_
impeller::VerticesGeometry
A geometry that is created from a vertices object.
Definition: vertices_geometry.h:13
impeller::VerticesGeometry::VerticesGeometry
VerticesGeometry(std::vector< Point > vertices, std::vector< uint16_t > indices, std::vector< Point > texture_coordinates, std::vector< Color > colors, Rect bounds, VerticesGeometry::VertexMode vertex_mode)
Definition: vertices_geometry.cc:57
impeller::VerticesGeometry::GetPositionUVColorBuffer
GeometryResult GetPositionUVColorBuffer(Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass) const
Definition: vertices_geometry.cc:147
impeller::Entity
Definition: entity.h:20
impeller::PrimitiveType
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:352
impeller::VerticesGeometry::VertexMode
VertexMode
Definition: vertices_geometry.h:15
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:231
impeller::VerticesGeometry::HasVertexColors
bool HasVertexColors() const
Definition: vertices_geometry.cc:92
impeller::VerticesGeometry::VertexMode::kTriangleStrip
@ kTriangleStrip
geometry.h
impeller::GeometryResult
Definition: geometry.h:19
impeller::VerticesGeometry::GetCoverage
std::optional< Rect > GetCoverage(const Matrix &transform) const override
Definition: vertices_geometry.cc:202
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::Geometry
Definition: geometry.h:48
impeller::VerticesGeometry::GetPositionBuffer
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: vertices_geometry.cc:113
impeller::VerticesGeometry::VertexMode::kTriangles
@ kTriangles
impeller::VerticesGeometry::HasTextureCoordinates
bool HasTextureCoordinates() const
Definition: vertices_geometry.cc:96
impeller
Definition: aiks_blend_unittests.cc:18
impeller::VerticesGeometry::VertexMode::kTriangleFan
@ kTriangleFan
impeller::ContentContext
Definition: content_context.h:366
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::VerticesGeometry::GetTextureCoordinateCoverge
std::optional< Rect > GetTextureCoordinateCoverge() const
Definition: vertices_geometry.cc:100
impeller::VerticesGeometry::~VerticesGeometry
~VerticesGeometry()=default