Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | List of all members
impeller::scene::UnlitMaterial Class Referencefinal

#include <material.h>

Inheritance diagram for impeller::scene::UnlitMaterial:
impeller::scene::Material

Public Member Functions

 ~UnlitMaterial ()
 
void SetColor (Color color)
 
void SetColorTexture (std::shared_ptr< Texture > color_texture)
 
MaterialType GetMaterialType () const override
 
void BindToCommand (const SceneContext &scene_context, HostBuffer &buffer, RenderPass &pass) const override
 
- Public Member Functions inherited from impeller::scene::Material
virtual ~Material ()
 
void SetVertexColorWeight (Scalar weight)
 
void SetBlendConfig (BlendConfig blend_config)
 
void SetStencilConfig (StencilConfig stencil_config)
 
void SetTranslucent (bool is_translucent)
 
SceneContextOptions GetContextOptions (const RenderPass &pass) const
 
virtual MaterialType GetMaterialType () const =0
 
virtual void BindToCommand (const SceneContext &scene_context, HostBuffer &buffer, RenderPass &pass) const =0
 

Static Public Member Functions

static std::unique_ptr< UnlitMaterialMakeFromFlatbuffer (const fb::Material &material, const std::vector< std::shared_ptr< Texture > > &textures)
 
- Static Public Member Functions inherited from impeller::scene::Material
static std::unique_ptr< MaterialMakeFromFlatbuffer (const fb::Material &material, const std::vector< std::shared_ptr< Texture > > &textures)
 
static std::unique_ptr< UnlitMaterialMakeUnlit ()
 
static std::unique_ptr< PhysicallyBasedMaterialMakePhysicallyBased ()
 

Additional Inherited Members

- Protected Attributes inherited from impeller::scene::Material
Scalar vertex_color_weight_ = 1
 
BlendConfig blend_config_
 
StencilConfig stencil_config_
 
bool is_translucent_ = false
 

Detailed Description

Definition at line 73 of file material.h.

Constructor & Destructor Documentation

◆ ~UnlitMaterial()

impeller::scene::UnlitMaterial::~UnlitMaterial ( )
default

Member Function Documentation

◆ BindToCommand()

void impeller::scene::UnlitMaterial::BindToCommand ( const SceneContext scene_context,
HostBuffer buffer,
RenderPass pass 
) const
overridevirtual

Implements impeller::scene::Material.

Definition at line 110 of file material.cc.

112 {
113 // Uniform buffer.
114 UnlitFragmentShader::FragInfo info;
115 info.color = color_;
116 info.vertex_color_weight = vertex_color_weight_;
117 UnlitFragmentShader::BindFragInfo(pass, buffer.EmplaceUniform(info));
118
119 // Textures.
120 SamplerDescriptor sampler_descriptor;
121 sampler_descriptor.label = "Trilinear";
122 sampler_descriptor.min_filter = MinMagFilter::kLinear;
123 sampler_descriptor.mag_filter = MinMagFilter::kLinear;
124 sampler_descriptor.mip_filter = MipFilter::kLinear;
125 UnlitFragmentShader::BindBaseColorTexture(
126 pass,
127 color_texture_ ? color_texture_ : scene_context.GetPlaceholderTexture(),
128 scene_context.GetContext()->GetSamplerLibrary()->GetSampler(
129 sampler_descriptor));
130}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
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
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.

◆ GetMaterialType()

MaterialType impeller::scene::UnlitMaterial::GetMaterialType ( ) const
overridevirtual

Implements impeller::scene::Material.

Definition at line 105 of file material.cc.

◆ MakeFromFlatbuffer()

std::unique_ptr< UnlitMaterial > impeller::scene::UnlitMaterial::MakeFromFlatbuffer ( const fb::Material &  material,
const std::vector< std::shared_ptr< Texture > > &  textures 
)
static

UnlitMaterial

Definition at line 71 of file material.cc.

73 {
74 if (material.type() != fb::MaterialType::kUnlit) {
75 VALIDATION_LOG << "Cannot unpack unlit material because the ipscene "
76 "material type is not unlit.";
77 return nullptr;
78 }
79
81
82 if (material.base_color_factor()) {
83 result->SetColor(importer::ToColor(*material.base_color_factor()));
84 }
85
86 if (material.base_color_texture() >= 0 &&
87 material.base_color_texture() < static_cast<int32_t>(textures.size())) {
88 result->SetColorTexture(textures[material.base_color_texture()]);
89 }
90
91 return result;
92}
static std::unique_ptr< UnlitMaterial > MakeUnlit()
Definition: material.cc:38
GAsyncResult * result
Color ToColor(const fb::Color &c)
Definition: conversions.cc:46
#define VALIDATION_LOG
Definition: validation.h:73

◆ SetColor()

void impeller::scene::UnlitMaterial::SetColor ( Color  color)

Definition at line 96 of file material.cc.

96 {
97 color_ = color;
98}
DlColor color

◆ SetColorTexture()

void impeller::scene::UnlitMaterial::SetColorTexture ( std::shared_ptr< Texture color_texture)

Definition at line 100 of file material.cc.

100 {
101 color_texture_ = std::move(color_texture);
102}

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