Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
impeller::scene::Geometry Class Referenceabstract

#include <geometry.h>

Inheritance diagram for impeller::scene::Geometry:
impeller::scene::CuboidGeometry impeller::scene::SkinnedVertexBufferGeometry impeller::scene::UnskinnedVertexBufferGeometry

Public Member Functions

virtual ~Geometry ()
 
virtual GeometryType GetGeometryType () const =0
 
virtual VertexBuffer GetVertexBuffer (Allocator &allocator) const =0
 
virtual void BindToCommand (const SceneContext &scene_context, HostBuffer &buffer, const Matrix &transform, RenderPass &pass) const =0
 
virtual void SetJointsTexture (const std::shared_ptr< Texture > &texture)
 

Static Public Member Functions

static std::shared_ptr< CuboidGeometryMakeCuboid (Vector3 size)
 
static std::shared_ptr< GeometryMakeVertexBuffer (VertexBuffer vertex_buffer, bool is_skinned)
 
static std::shared_ptr< GeometryMakeFromFlatbuffer (const fb::MeshPrimitive &mesh, Allocator &allocator)
 

Detailed Description

Definition at line 26 of file geometry.h.

Constructor & Destructor Documentation

◆ ~Geometry()

impeller::scene::Geometry::~Geometry ( )
virtualdefault

Member Function Documentation

◆ BindToCommand()

virtual void impeller::scene::Geometry::BindToCommand ( const SceneContext scene_context,
HostBuffer buffer,
const Matrix transform,
RenderPass pass 
) const
pure virtual

◆ GetGeometryType()

virtual GeometryType impeller::scene::Geometry::GetGeometryType ( ) const
pure virtual

◆ GetVertexBuffer()

virtual VertexBuffer impeller::scene::Geometry::GetVertexBuffer ( Allocator allocator) const
pure virtual

◆ MakeCuboid()

std::shared_ptr< CuboidGeometry > impeller::scene::Geometry::MakeCuboid ( Vector3  size)
static

Definition at line 31 of file geometry.cc.

31 {
32 auto result = std::make_shared<CuboidGeometry>();
33 result->SetSize(size);
34 return result;
35}
GAsyncResult * result
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

◆ MakeFromFlatbuffer()

std::shared_ptr< Geometry > impeller::scene::Geometry::MakeFromFlatbuffer ( const fb::MeshPrimitive &  mesh,
Allocator allocator 
)
static

Definition at line 50 of file geometry.cc.

52 {
53 IndexType index_type;
54 switch (mesh.indices()->type()) {
55 case fb::IndexType::k16Bit:
56 index_type = IndexType::k16bit;
57 break;
58 case fb::IndexType::k32Bit:
59 index_type = IndexType::k32bit;
60 break;
61 }
62
63 const uint8_t* vertices_start;
64 size_t vertices_bytes;
65 bool is_skinned;
66
67 switch (mesh.vertices_type()) {
68 case fb::VertexBuffer::UnskinnedVertexBuffer: {
69 const auto* vertices =
70 mesh.vertices_as_UnskinnedVertexBuffer()->vertices();
71 vertices_start = reinterpret_cast<const uint8_t*>(vertices->Get(0));
72 vertices_bytes = vertices->size() * sizeof(fb::Vertex);
73 is_skinned = false;
74 break;
75 }
76 case fb::VertexBuffer::SkinnedVertexBuffer: {
77 const auto* vertices = mesh.vertices_as_SkinnedVertexBuffer()->vertices();
78 vertices_start = reinterpret_cast<const uint8_t*>(vertices->Get(0));
79 vertices_bytes = vertices->size() * sizeof(fb::SkinnedVertex);
80 is_skinned = true;
81 break;
82 }
83 case fb::VertexBuffer::NONE:
84 VALIDATION_LOG << "Invalid vertex buffer type.";
85 return nullptr;
86 }
87
88 const uint8_t* indices_start =
89 reinterpret_cast<const uint8_t*>(mesh.indices()->data()->Data());
90
91 const size_t indices_bytes = mesh.indices()->data()->size();
92 if (vertices_bytes == 0 || indices_bytes == 0) {
93 return nullptr;
94 }
95
96 DeviceBufferDescriptor buffer_desc;
97 buffer_desc.size = vertices_bytes + indices_bytes;
98 buffer_desc.storage_mode = StorageMode::kHostVisible;
99
100 auto buffer = allocator.CreateBuffer(buffer_desc);
101 buffer->SetLabel("Mesh vertices+indices");
102
103 if (!buffer->CopyHostBuffer(vertices_start, Range(0, vertices_bytes))) {
104 return nullptr;
105 }
106 if (!buffer->CopyHostBuffer(indices_start, Range(0, indices_bytes),
107 vertices_bytes)) {
108 return nullptr;
109 }
110
111 VertexBuffer vertex_buffer = {
112 .vertex_buffer = {.buffer = buffer, .range = Range(0, vertices_bytes)},
113 .index_buffer = {.buffer = buffer,
114 .range = Range(vertices_bytes, indices_bytes)},
115 .vertex_count = mesh.indices()->count(),
116 .index_type = index_type,
117 };
118 return MakeVertexBuffer(std::move(vertex_buffer), is_skinned);
119}
GrTriangulator::Vertex Vertex
static std::shared_ptr< Geometry > MakeVertexBuffer(VertexBuffer vertex_buffer, bool is_skinned)
Definition: geometry.cc:37
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
#define VALIDATION_LOG
Definition: validation.h:73

◆ MakeVertexBuffer()

std::shared_ptr< Geometry > impeller::scene::Geometry::MakeVertexBuffer ( VertexBuffer  vertex_buffer,
bool  is_skinned 
)
static

Definition at line 37 of file geometry.cc.

38 {
39 if (is_skinned) {
40 auto result = std::make_shared<SkinnedVertexBufferGeometry>();
41 result->SetVertexBuffer(std::move(vertex_buffer));
42 return result;
43 } else {
44 auto result = std::make_shared<UnskinnedVertexBufferGeometry>();
45 result->SetVertexBuffer(std::move(vertex_buffer));
46 return result;
47 }
48}

◆ SetJointsTexture()

void impeller::scene::Geometry::SetJointsTexture ( const std::shared_ptr< Texture > &  texture)
virtual

Reimplemented in impeller::scene::SkinnedVertexBufferGeometry.

Definition at line 121 of file geometry.cc.

121{}

The documentation for this class was generated from the following files: