Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
impeller
scene
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
5
#include "
impeller/scene/mesh.h
"
6
7
#include <memory>
8
#include <optional>
9
10
#include "
impeller/base/validation.h
"
11
#include "
impeller/scene/material.h
"
12
#include "
impeller/scene/pipeline_key.h
"
13
#include "
impeller/scene/scene_encoder.h
"
14
15
namespace
impeller
{
16
namespace
scene {
17
18
Mesh::Mesh
() =
default
;
19
Mesh::~Mesh
() =
default
;
20
21
void
Mesh::AddPrimitive
(
Primitive
mesh) {
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
32
std::vector<Mesh::Primitive>&
Mesh::GetPrimitives
() {
33
return
primitives_;
34
}
35
36
bool
Mesh::Render
(
SceneEncoder
&
encoder
,
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
impeller::scene::Mesh::Render
bool Render(SceneEncoder &encoder, const Matrix &transform, const std::shared_ptr< Texture > &joints) const
Definition
mesh.cc:36
impeller::scene::Mesh::~Mesh
~Mesh()
impeller::scene::Mesh::Mesh
Mesh()
impeller::scene::Mesh::GetPrimitives
std::vector< Primitive > & GetPrimitives()
Definition
mesh.cc:32
impeller::scene::Mesh::AddPrimitive
void AddPrimitive(Primitive mesh_)
Definition
mesh.cc:21
impeller::scene::SceneEncoder
Definition
scene_encoder.h:30
material.h
mesh.h
encoder
Definition
encoder.py:1
impeller
Definition
texture.h:18
transform
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition
p3.cpp:47
pipeline_key.h
scene_encoder.h
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition
matrix.h:37
impeller::scene::Mesh::Primitive
Definition
mesh.h:23
impeller::scene::SceneCommand
Definition
scene_encoder.h:23
validation.h
VALIDATION_LOG
#define VALIDATION_LOG
Definition
validation.h:73
Generated on Fri Apr 26 2024 06:14:14 for Flutter Engine by
1.9.8