Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
10#include "flutter/fml/macros.h"
19#include "impeller/scene/importer/scene_flatbuffers.h"
22
23namespace impeller {
24namespace scene {
25
26class CuboidGeometry;
27class UnskinnedVertexBufferGeometry;
28
29class Geometry {
30 public:
31 virtual ~Geometry();
32
33 static std::shared_ptr<CuboidGeometry> MakeCuboid(Vector3 size);
34
35 static std::shared_ptr<Geometry> MakeVertexBuffer(VertexBuffer vertex_buffer,
36 bool is_skinned);
37
38 static std::shared_ptr<Geometry> MakeFromFlatbuffer(
39 const fb::MeshPrimitive& mesh,
40 Allocator& allocator);
41
42 virtual GeometryType GetGeometryType() const = 0;
43
44 virtual VertexBuffer GetVertexBuffer(Allocator& allocator) const = 0;
45
46 virtual void BindToCommand(const SceneContext& scene_context,
48 const Matrix& transform,
49 RenderPass& pass) const = 0;
50
51 virtual void SetJointsTexture(const std::shared_ptr<Texture>& texture);
52};
53
54class CuboidGeometry final : public Geometry {
55 public:
57
58 ~CuboidGeometry() override;
59
60 void SetSize(Vector3 size);
61
62 // |Geometry|
63 GeometryType GetGeometryType() const override;
64
65 // |Geometry|
66 VertexBuffer GetVertexBuffer(Allocator& allocator) const override;
67
68 // |Geometry|
69 void BindToCommand(const SceneContext& scene_context,
71 const Matrix& transform,
72 RenderPass& pass) const override;
73
74 private:
75 Vector3 size_;
76
77 CuboidGeometry(const CuboidGeometry&) = delete;
78
79 CuboidGeometry& operator=(const CuboidGeometry&) = delete;
80};
81
83 public:
85
87
88 void SetVertexBuffer(VertexBuffer vertex_buffer);
89
90 // |Geometry|
91 GeometryType GetGeometryType() const override;
92
93 // |Geometry|
94 VertexBuffer GetVertexBuffer(Allocator& allocator) const override;
95
96 // |Geometry|
97 void BindToCommand(const SceneContext& scene_context,
99 const Matrix& transform,
100 RenderPass& pass) const override;
101
102 private:
103 VertexBuffer vertex_buffer_;
104
106
108 const UnskinnedVertexBufferGeometry&) = delete;
109};
110
112 public:
114
116
117 void SetVertexBuffer(VertexBuffer vertex_buffer);
118
119 // |Geometry|
120 GeometryType GetGeometryType() const override;
121
122 // |Geometry|
123 VertexBuffer GetVertexBuffer(Allocator& allocator) const override;
124
125 // |Geometry|
126 void BindToCommand(const SceneContext& scene_context,
128 const Matrix& transform,
129 RenderPass& pass) const override;
130
131 // |Geometry|
132 void SetJointsTexture(const std::shared_ptr<Texture>& texture) override;
133
134 private:
135 VertexBuffer vertex_buffer_;
136 std::shared_ptr<Texture> joints_texture_;
137
139
141 delete;
142};
143
144} // namespace scene
145} // namespace impeller
146
147#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
static const uint8_t buffer[]
FlTexture * texture
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition p3.cpp:47
A 4x4 matrix using column-major storage.
Definition matrix.h:37