98 if (!geometry_->HasVertexColors()) {
102 std::shared_ptr<Texture>
texture;
105 texture = lazy_texture_(renderer);
110 texture = renderer.GetEmptyTexture();
113 auto dst_sampler_descriptor = descriptor_;
117 dst_sampler_descriptor.height_address_mode =
121 const std::unique_ptr<const Sampler>& dst_sampler =
122 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
123 dst_sampler_descriptor);
125 GeometryResult geometry_result = geometry_->GetPositionUVColorBuffer(
128 inverse_matrix_, renderer, entity, pass);
148 FS::BindTextureSamplerDst(pass,
texture, dst_sampler);
150 VS::FrameInfo frame_info;
151 FS::FragInfo frag_info;
153 frame_info.texture_sampler_y_coord_scale =
texture->GetYCoordScale();
154 frame_info.mvp = geometry_result.
transform;
156 frag_info.output_alpha = alpha_;
157 frag_info.input_alpha = 1.0;
159 auto inverted_blend_mode =
161 auto blend_coefficients =
163 frag_info.src_coeff = blend_coefficients[0];
164 frag_info.src_coeff_dst_alpha = blend_coefficients[1];
165 frag_info.dst_coeff = blend_coefficients[2];
166 frag_info.dst_coeff_src_alpha = blend_coefficients[3];
167 frag_info.dst_coeff_src_color = blend_coefficients[4];
170 frag_info.tmx =
static_cast<int>(tile_mode_x_);
171 frag_info.tmy =
static_cast<int>(tile_mode_y_);
173 auto& host_buffer = renderer.GetTransientsBuffer();
174 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
175 VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info));
193 FS::BindTextureSampler(pass,
texture, dst_sampler);
195 VS::FrameInfo frame_info;
196 FS::FragInfo frag_info;
198 frame_info.texture_sampler_y_coord_scale =
texture->GetYCoordScale();
199 frame_info.mvp = geometry_result.
transform;
200 frag_info.alpha = alpha_;
201 frag_info.blend_mode =
static_cast<int>(blend_mode);
204 frag_info.tmx =
static_cast<int>(tile_mode_x_);
205 frag_info.tmy =
static_cast<int>(tile_mode_y_);
207 auto& host_buffer = renderer.GetTransientsBuffer();
208 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
209 VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info));
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
void SetBlendMode(BlendMode blend_mode)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
void SetTileMode(Entity::TileMode tile_mode_x, Entity::TileMode tile_mode_y)
void SetLazyTexture(const LazyTexture &lazy_texture)
~VerticesSimpleBlendContents() override
std::function< std::shared_ptr< Texture >(const ContentContext &renderer)> LazyTexture
void SetEffectTransform(Matrix transform)
void SetTexture(std::shared_ptr< Texture > texture)
void SetGeometry(std::shared_ptr< VerticesGeometry > geometry)
void SetSamplerDescriptor(SamplerDescriptor descriptor)
void SetAlpha(Scalar alpha)
VerticesSimpleBlendContents()