Flutter Engine
The Flutter Engine
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_SCENE_GEOMETRY_H_
6#define FLUTTER_IMPELLER_SCENE_GEOMETRY_H_
7
8#include <memory>
9
16#include "impeller/scene/importer/scene_flatbuffers.h"
19
20namespace impeller {
21namespace scene {
22
23class CuboidGeometry;
24class UnskinnedVertexBufferGeometry;
25
26class Geometry {
27 public:
28 virtual ~Geometry();
29
30 static std::shared_ptr<CuboidGeometry> MakeCuboid(Vector3 size);
31
32 static std::shared_ptr<Geometry> MakeVertexBuffer(VertexBuffer vertex_buffer,
33 bool is_skinned);
34
35 static std::shared_ptr<Geometry> MakeFromFlatbuffer(
36 const fb::MeshPrimitive& mesh,
37 Allocator& allocator);
38
39 virtual GeometryType GetGeometryType() const = 0;
40
41 virtual VertexBuffer GetVertexBuffer(Allocator& allocator) const = 0;
42
43 virtual void BindToCommand(const SceneContext& scene_context,
45 const Matrix& transform,
46 RenderPass& pass) const = 0;
47
48 virtual void SetJointsTexture(const std::shared_ptr<Texture>& texture);
49};
50
51class CuboidGeometry final : public Geometry {
52 public:
54
55 ~CuboidGeometry() override;
56
57 void SetSize(Vector3 size);
58
59 // |Geometry|
60 GeometryType GetGeometryType() const override;
61
62 // |Geometry|
63 VertexBuffer GetVertexBuffer(Allocator& allocator) const override;
64
65 // |Geometry|
66 void BindToCommand(const SceneContext& scene_context,
68 const Matrix& transform,
69 RenderPass& pass) const override;
70
71 private:
72 Vector3 size_;
73
74 CuboidGeometry(const CuboidGeometry&) = delete;
75
76 CuboidGeometry& operator=(const CuboidGeometry&) = delete;
77};
78
80 public:
82
84
85 void SetVertexBuffer(VertexBuffer vertex_buffer);
86
87 // |Geometry|
88 GeometryType GetGeometryType() const override;
89
90 // |Geometry|
91 VertexBuffer GetVertexBuffer(Allocator& allocator) const override;
92
93 // |Geometry|
94 void BindToCommand(const SceneContext& scene_context,
96 const Matrix& transform,
97 RenderPass& pass) const override;
98
99 private:
100 VertexBuffer vertex_buffer_;
101
103
105 const UnskinnedVertexBufferGeometry&) = delete;
106};
107
109 public:
111
113
114 void SetVertexBuffer(VertexBuffer vertex_buffer);
115
116 // |Geometry|
117 GeometryType GetGeometryType() const override;
118
119 // |Geometry|
120 VertexBuffer GetVertexBuffer(Allocator& allocator) const override;
121
122 // |Geometry|
123 void BindToCommand(const SceneContext& scene_context,
125 const Matrix& transform,
126 RenderPass& pass) const override;
127
128 // |Geometry|
129 void SetJointsTexture(const std::shared_ptr<Texture>& texture) override;
130
131 private:
132 VertexBuffer vertex_buffer_;
133 std::shared_ptr<Texture> joints_texture_;
134
136
138 delete;
139};
140
141} // namespace scene
142} // namespace impeller
143
144#endif // FLUTTER_IMPELLER_SCENE_GEOMETRY_H_
An object that allocates device memory.
Definition: allocator.h:22
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
GeometryType GetGeometryType() const override
Definition: geometry.cc:136
void SetSize(Vector3 size)
Definition: geometry.cc:131
void BindToCommand(const SceneContext &scene_context, HostBuffer &buffer, const Matrix &transform, RenderPass &pass) const override
Definition: geometry.cc:163
VertexBuffer GetVertexBuffer(Allocator &allocator) const override
Definition: geometry.cc:141
static std::shared_ptr< Geometry > MakeFromFlatbuffer(const fb::MeshPrimitive &mesh, Allocator &allocator)
Definition: geometry.cc:50
static std::shared_ptr< Geometry > MakeVertexBuffer(VertexBuffer vertex_buffer, bool is_skinned)
Definition: geometry.cc:37
virtual void BindToCommand(const SceneContext &scene_context, HostBuffer &buffer, const Matrix &transform, RenderPass &pass) const =0
virtual VertexBuffer GetVertexBuffer(Allocator &allocator) const =0
virtual void SetJointsTexture(const std::shared_ptr< Texture > &texture)
Definition: geometry.cc:121
static std::shared_ptr< CuboidGeometry > MakeCuboid(Vector3 size)
Definition: geometry.cc:31
virtual GeometryType GetGeometryType() const =0
void BindToCommand(const SceneContext &scene_context, HostBuffer &buffer, const Matrix &transform, RenderPass &pass) const override
Definition: geometry.cc:237
VertexBuffer GetVertexBuffer(Allocator &allocator) const override
Definition: geometry.cc:231
void SetJointsTexture(const std::shared_ptr< Texture > &texture) override
Definition: geometry.cc:267
GeometryType GetGeometryType() const override
Definition: geometry.cc:226
void SetVertexBuffer(VertexBuffer vertex_buffer)
Definition: geometry.cc:221
void SetVertexBuffer(VertexBuffer vertex_buffer)
Definition: geometry.cc:183
GeometryType GetGeometryType() const override
Definition: geometry.cc:189
void BindToCommand(const SceneContext &scene_context, HostBuffer &buffer, const Matrix &transform, RenderPass &pass) const override
Definition: geometry.cc:200
VertexBuffer GetVertexBuffer(Allocator &allocator) const override
Definition: geometry.cc:194
FlTexture * texture
SkMesh mesh
Definition: SkRecords.h:345
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47
A 4x4 matrix using column-major storage.
Definition: matrix.h:37