mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Cleanup vertex buffer builder API.
This commit is contained in:
parent
d279337bdb
commit
e11c3e756c
@ -31,10 +31,18 @@ class VertexBufferBuilder {
|
||||
|
||||
void SetLabel(std::string label) { label_ = std::move(label); }
|
||||
|
||||
void Reserve(size_t count) { return vertices_.reserve(count); }
|
||||
|
||||
VertexBufferBuilder& AppendVertex(VertexType_ vertex) {
|
||||
vertices_.emplace_back(std::move(vertex));
|
||||
return *this;
|
||||
}
|
||||
|
||||
VertexBufferBuilder& AddVertices(
|
||||
std::initializer_list<VertexType_> vertices) {
|
||||
for (const auto& vertex : vertices) {
|
||||
vertices_.push_back(vertex);
|
||||
vertices_.reserve(vertices.size());
|
||||
for (auto& vertex : vertices) {
|
||||
vertices_.emplace_back(std::move(vertex));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "impeller/entity/entity_renderer_impl.h"
|
||||
#include "impeller/compositor/vertex_buffer_builder.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
@ -39,6 +40,8 @@ bool EntityRendererImpl::RenderEntity(const Surface& surface,
|
||||
return false;
|
||||
}
|
||||
|
||||
VertexBufferBuilder<VS::PerVertexData> builder;
|
||||
|
||||
VS::FrameInfo frame_info;
|
||||
frame_info.mvp = Matrix::MakeOrthographic(surface.GetSize()) *
|
||||
entity.GetTransformation();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user