| Flutter Impeller |

Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
impeller::scene::Material Class Referenceabstract

`#include <material.h>`

Inheritance diagram for impeller::scene::Material:

## Classes
struct | BlendConfig
struct | StencilConfig

## Public Member Functions
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, Command &command) const =0

## Static Public Member Functions
static std::unique_ptr< Material > | MakeFromFlatbuffer (const fb::Material &material, const std::vector< std::shared_ptr< Texture >> &textures)
static std::unique_ptr< UnlitMaterial > | MakeUnlit ()
static std::unique_ptr< PhysicallyBasedMaterial > | MakePhysicallyBased ()

## Protected Attributes
Scalar | vertex_color_weight_ = 1
BlendConfig | blend_config_
StencilConfig | stencil_config_
bool | is_translucent_ = false

## Detailed Description

Definition at line 27 of file material.h.

## Constructor & Destructor Documentation

## ◆ ~Material()

impeller::scene::Material::~Material | ( |  | ) |
| virtual default

Material

## Member Function Documentation

## ◆ BindToCommand()

virtual void impeller::scene::Material::BindToCommand | ( | const SceneContext & | scene_context,
|  | HostBuffer & | buffer,
|  | Command & | command
| ) |  | const
| pure virtual

Implemented in impeller::scene::PhysicallyBasedMaterial, and impeller::scene::UnlitMaterial.

Referenced by impeller::scene::EncodeCommand().

## ◆ GetContextOptions()

SceneContextOptions impeller::scene::Material::GetContextOptions | ( | const RenderPass & | pass | ) | const

Definition at line 61 of file material.cc.

61 {
62 // TODO(bdero): Pipeline blend and stencil config.
63 return {.sample_count = pass.GetRenderTarget().GetSampleCount()};
64 }

References impeller::RenderPass::GetRenderTarget(), impeller::RenderTarget::GetSampleCount(), and impeller::scene::SceneContextOptions::sample_count.

Referenced by impeller::scene::EncodeCommand().

## ◆ GetMaterialType()

virtual MaterialType impeller::scene::Material::GetMaterialType | ( |  | ) | const
| pure virtual

Implemented in impeller::scene::PhysicallyBasedMaterial, and impeller::scene::UnlitMaterial.

Referenced by impeller::scene::EncodeCommand().

## ◆ MakeFromFlatbuffer()

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

Definition at line 26 of file material.cc.

28 {
29 switch (material.type()) {
30 case fb::MaterialType::kUnlit:
31 return UnlitMaterial::MakeFromFlatbuffer(material, textures);
32 case fb::MaterialType::kPhysicallyBased:
33 return PhysicallyBasedMaterial::MakeFromFlatbuffer(material, textures);
34 }
35 }

References impeller::scene::UnlitMaterial::MakeFromFlatbuffer(), and impeller::scene::PhysicallyBasedMaterial::MakeFromFlatbuffer().

## ◆ MakePhysicallyBased()

std::unique_ptr< PhysicallyBasedMaterial > impeller::scene::Material::MakePhysicallyBased | ( |  | ) |
| static

Definition at line 41 of file material.cc.

41 {
42 return std::make_unique<PhysicallyBasedMaterial>();
43 }

Referenced by impeller::scene::PhysicallyBasedMaterial::MakeFromFlatbuffer().

## ◆ MakeUnlit()

std::unique_ptr< UnlitMaterial > impeller::scene::Material::MakeUnlit | ( |  | ) |
| static

Definition at line 37 of file material.cc.

37 {
38 return std::make_unique<UnlitMaterial>();
39 }

Referenced by impeller::scene::UnlitMaterial::MakeFromFlatbuffer(), and impeller::scene::testing::TEST_P().

## ◆ SetBlendConfig()

void impeller::scene::Material::SetBlendConfig | ( | BlendConfig | blend_config | ) |

Definition at line 49 of file material.cc.

49 {
50 blend_config_ = blend_config;
51 }

References blend_config_.

## ◆ SetStencilConfig()

void impeller::scene::Material::SetStencilConfig | ( | StencilConfig | stencil_config | ) |

Definition at line 53 of file material.cc.

53 {
54 stencil_config_ = stencil_config;
55 }

References stencil_config_.

## ◆ SetTranslucent()

void impeller::scene::Material::SetTranslucent | ( | bool | is_translucent | ) |

Definition at line 57 of file material.cc.

57 {
58 is_translucent_ = is_translucent;
59 }

References is_translucent_.

## ◆ SetVertexColorWeight()

void impeller::scene::Material::SetVertexColorWeight | ( | Scalar | weight | ) |

Definition at line 45 of file material.cc.

45 {
46 vertex_color_weight_ = weight;
47 }

References vertex_color_weight_.

## Member Data Documentation

## ◆ blend_config_

BlendConfig impeller::scene::Material::blend_config_
| protected

Definition at line 68 of file material.h.

Referenced by SetBlendConfig().

## ◆ is_translucent_

bool impeller::scene::Material::is_translucent_ = false
| protected

Definition at line 70 of file material.h.

Referenced by SetTranslucent().

## ◆ stencil_config_

StencilConfig impeller::scene::Material::stencil_config_
| protected

Definition at line 69 of file material.h.

Referenced by SetStencilConfig().

## ◆ vertex_color_weight_

Scalar impeller::scene::Material::vertex_color_weight_ = 1
| protected

Definition at line 67 of file material.h.

Referenced by impeller::scene::UnlitMaterial::BindToCommand(), and SetVertexColorWeight().

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

- impeller/scene/material.h
- impeller/scene/material.cc

impeller::scene::Material::blend_config_
BlendConfig blend_config_
Definition: material.h:68
impeller::scene::Material::is_translucent_
bool is_translucent_
Definition: material.h:70
impeller::scene::UnlitMaterial::MakeFromFlatbuffer
static std::unique_ptr< UnlitMaterial > MakeFromFlatbuffer(const fb::Material &material, const std::vector< std::shared_ptr< Texture >> &textures)
Definition: material.cc:70
impeller::scene::Material::vertex_color_weight_
Scalar vertex_color_weight_
Definition: material.h:67
impeller::scene::PhysicallyBasedMaterial::MakeFromFlatbuffer
static std::unique_ptr< PhysicallyBasedMaterial > MakeFromFlatbuffer(const fb::Material &material, const std::vector< std::shared_ptr< Texture >> &textures)
Definition: material.cc:136
impeller::scene::Material::stencil_config_
StencilConfig stencil_config_
Definition: material.h:69