Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
 

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
static const uint8_t buffer[]
SK_API GrDirectContext * GetContext(const SkImage *src)

◆ 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
std::vector< std::shared_ptr< FakeTexture > > textures
GAsyncResult * result
Color ToColor(const fb::Color &c)
#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}
SkColor4f 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: