Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
mesh.cc
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
6
7#include <memory>
8#include <optional>
9
14
15namespace impeller {
16namespace scene {
17
18Mesh::Mesh() = default;
19Mesh::~Mesh() = default;
20
22 if (mesh.geometry == nullptr) {
23 VALIDATION_LOG << "Mesh geometry cannot be null.";
24 }
25 if (mesh.material == nullptr) {
26 VALIDATION_LOG << "Mesh material cannot be null.";
27 }
28
29 primitives_.push_back(std::move(mesh));
30}
31
32std::vector<Mesh::Primitive>& Mesh::GetPrimitives() {
33 return primitives_;
34}
35
37 const Matrix& transform,
38 const std::shared_ptr<Texture>& joints) const {
39 for (const auto& mesh : primitives_) {
40 mesh.geometry->SetJointsTexture(joints);
41 SceneCommand command = {
42 .label = "Mesh Primitive",
43 .transform = transform,
44 .geometry = mesh.geometry.get(),
45 .material = mesh.material.get(),
46 };
47 encoder.Add(command);
48 }
49 return true;
50}
51
52} // namespace scene
53} // namespace impeller
bool Render(SceneEncoder &encoder, const Matrix &transform, const std::shared_ptr< Texture > &joints) const
Definition mesh.cc:36
std::vector< Primitive > & GetPrimitives()
Definition mesh.cc:32
void AddPrimitive(Primitive mesh_)
Definition mesh.cc:21
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition p3.cpp:47
A 4x4 matrix using column-major storage.
Definition matrix.h:37
#define VALIDATION_LOG
Definition validation.h:73