| 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 #pragma once
6
7 #include "impeller/entity/geometry/geometry.h"
8
9 namespace impeller {
10
11 /// @brief A geometry that is created from a vertices object.
12 class VerticesGeometry : public Geometry {
13 public:
14 enum class VertexMode {
15 kTriangles,
16 kTriangleStrip,
17 kTriangleFan,
18 };
19
20 VerticesGeometry(std::vector<Point> vertices,
21 std::vector<uint16_t> indices,
22 std::vector<Point> texture_coordinates,
23 std::vector<Color> colors,
24 Rect bounds,
25 VerticesGeometry::VertexMode vertex_mode);
26
27 ~VerticesGeometry();
28
29 GeometryResult GetPositionColorBuffer(const ContentContext& renderer,
30 const Entity& entity,
31 RenderPass& pass);
32
33 // |Geometry|
34 GeometryResult GetPositionUVBuffer(Rect texture_coverage,
35 Matrix effect_transform,
36 const ContentContext& renderer,
37 const Entity& entity,
38 RenderPass& pass) override;
39
40 // |Geometry|
41 GeometryResult GetPositionBuffer(const ContentContext& renderer,
42 const Entity& entity,
43 RenderPass& pass) override;
44
45 // |Geometry|
46 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
47
48 // |Geometry|
49 GeometryVertexType GetVertexType() const override;
50
51 bool HasVertexColors() const;
52
53 bool HasTextureCoordinates() const;
54
55 std::optional<Rect> GetTextureCoordinateCoverge() const;
56
57 private:
58 void NormalizeIndices();
59
60 PrimitiveType GetPrimitiveType() const;
61
62 std::vector<Point> vertices_;
63 std::vector<Color> colors_;
64 std::vector<Point> texture_coordinates_;
65 std::vector<uint16_t> indices_;
66 Rect bounds_;
67 VerticesGeometry::VertexMode vertex_mode_ =
68 VerticesGeometry::VertexMode::kTriangles;
69 };
70
71 } // namespace impeller
impeller::VerticesGeometry
A geometry that is created from a vertices object.
Definition: vertices_geometry.h:12
impeller::PrimitiveType
PrimitiveType
Definition: formats.h:328
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:55
impeller::GeometryVertexType
GeometryVertexType
Definition: geometry.h:25
impeller::Entity
Definition: entity.h:21
impeller::VerticesGeometry::VertexMode
VertexMode
Definition: vertices_geometry.h:14
impeller::VerticesGeometry::HasVertexColors
bool HasVertexColors() const
Definition: vertices_geometry.cc:92
impeller::VerticesGeometry::VertexMode::kTriangleStrip
@ kTriangleStrip
impeller::VerticesGeometry::GetPositionColorBuffer
GeometryResult GetPositionColorBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass)
Definition: vertices_geometry.cc:161
geometry.h
impeller::GeometryResult
Definition: geometry.h:18
impeller::VerticesGeometry::GetVertexType
GeometryVertexType GetVertexType() const override
Definition: vertices_geometry.cc:293
impeller::VerticesGeometry::GetCoverage
std::optional< Rect > GetCoverage(const Matrix &transform) const override
Definition: vertices_geometry.cc:304
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:27
impeller::VerticesGeometry::GetPositionBuffer
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) override
Definition: vertices_geometry.cc:113
impeller::Geometry
Definition: geometry.h:54
impeller::VerticesGeometry::GetPositionUVBuffer
GeometryResult GetPositionUVBuffer(Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass) override
Definition: vertices_geometry.cc:220
impeller::VerticesGeometry::VertexMode::kTriangles
@ kTriangles
impeller::VerticesGeometry::HasTextureCoordinates
bool HasTextureCoordinates() const
Definition: vertices_geometry.cc:96
impeller::VerticesGeometry::~VerticesGeometry
~VerticesGeometry()
impeller
Definition: aiks_context.cc:10
impeller::VerticesGeometry::VertexMode::kTriangleFan
@ kTriangleFan
impeller::ContentContext
Definition: content_context.h:344
impeller::TRect
Definition: rect.h:20
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:36
impeller::VerticesGeometry::GetTextureCoordinateCoverge
std::optional< Rect > GetTextureCoordinateCoverge() const
Definition: vertices_geometry.cc:100