| 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 26 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 62 of file material.cc.

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

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 27 of file material.cc.

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

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

## ◆ MakePhysicallyBased()

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

Definition at line 42 of file material.cc.

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

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

## ◆ MakeUnlit()

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

Definition at line 38 of file material.cc.

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

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

## ◆ SetBlendConfig()

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

Definition at line 50 of file material.cc.

50 {
51 blend_config_ = blend_config;
52 }

References blend_config_.

## ◆ SetStencilConfig()

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

Definition at line 54 of file material.cc.

54 {
55 stencil_config_ = stencil_config;
56 }

References stencil_config_.

## ◆ SetTranslucent()

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

Definition at line 58 of file material.cc.

58 {
59 is_translucent_ = is_translucent;
60 }

References is_translucent_.

## ◆ SetVertexColorWeight()

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

Definition at line 46 of file material.cc.

46 {
47 vertex_color_weight_ = weight;
48 }

References vertex_color_weight_.

## Member Data Documentation

## ◆ blend_config_

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

Definition at line 67 of file material.h.

Referenced by SetBlendConfig().

## ◆ is_translucent_

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

Definition at line 69 of file material.h.

Referenced by SetTranslucent().

## ◆ stencil_config_

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

Definition at line 68 of file material.h.

Referenced by SetStencilConfig().

## ◆ vertex_color_weight_

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

Definition at line 66 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:67
impeller::scene::Material::is_translucent_
bool is_translucent_
Definition: material.h:69
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:71
impeller::scene::Material::vertex_color_weight_
Scalar vertex_color_weight_
Definition: material.h:66
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:137
impeller::scene::Material::stencil_config_
StencilConfig stencil_config_
Definition: material.h:68