 |
Flutter Impeller
|
|
Go to the documentation of this file.
8 #include "fml/logging.h"
49 const std::optional<Rect>& current_clip_coverage)
const {
50 if (!current_clip_coverage.has_value()) {
51 return {.
type = ClipCoverage::Type::kAppend, .coverage = std::nullopt};
58 .type = ClipCoverage::Type::kAppend,
59 .is_difference_or_non_square =
true,
60 .coverage = current_clip_coverage
64 return {.type = ClipCoverage::Type::kAppend, .coverage = std::nullopt};
67 if (!coverage.has_value() || !current_clip_coverage.has_value()) {
68 return {.type = ClipCoverage::Type::kAppend, .coverage = std::nullopt};
71 .type = ClipCoverage::Type::kAppend,
73 .coverage = current_clip_coverage->Intersection(coverage.value()),
101 options.depth_write_enabled =
false;
102 options.primitive_type = geometry_result.type;
104 switch (geometry_result.mode) {
107 options.stencil_mode =
112 options.stencil_mode =
118 options.stencil_mode =
124 info.mvp = geometry_result.transform;
127 if (!pass.
Draw().ok()) {
133 options.depth_write_enabled =
true;
139 options.stencil_mode =
146 std::optional<Rect> maybe_cover_area =
148 if (!maybe_cover_area.has_value()) {
151 cover_area = maybe_cover_area.value();
163 return pass.
Draw().ok();
175 restore_height_ = clip_height;
179 return restore_height_;
183 std::optional<Rect> restore_coverage) {
184 restore_coverage_ = restore_coverage;
188 const Entity& entity)
const {
194 const std::optional<Rect>& current_clip_coverage)
const {
195 return {.
type = ClipCoverage::Type::kRestore, .coverage = std::nullopt};
208 options.stencil_mode =
220 std::array<VS::PerVertexData, 4> vertices = {
221 VS::PerVertexData{
Point(ltrb[0], ltrb[1])},
222 VS::PerVertexData{
Point(ltrb[2], ltrb[1])},
223 VS::PerVertexData{
Point(ltrb[0], ltrb[3])},
224 VS::PerVertexData{
Point(ltrb[2], ltrb[3])},
234 return pass.
Draw().ok();
@ kNormal
The geometry has no overlapping triangles.
ContentContextOptions OptionsFromPass(const RenderPass &pass)
float GetShaderClipDepth() const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
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.
@ kOverdrawPreventionIncrement
virtual std::optional< Rect > GetCoverage(const Matrix &transform) const =0
std::shared_ptr< Pipeline< PipelineDescriptor > > GetClipPipeline(ContentContextOptions opts) const
void SetClipOperation(Entity::ClipOperation clip_op)
virtual bool SetVertexBuffer(VertexBuffer buffer)
Specify the vertex and index buffer to use for this command.
void SetRestoreCoverage(std::optional< Rect > coverage)
The area on the pass texture where this clip restore will be applied. If unset, the entire pass textu...
size_t GetRestoreHeight() const
virtual bool IsAxisAlignedRect() const
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
const Matrix & GetOrthographicTransform() const
constexpr std::array< TPoint< T >, 4 > GetPoints() const
Get the points that represent the 4 corners of this rectangle in a Z order that is compatible with tr...
ClipCoverage GetClipCoverage(const Entity &entity, const std::optional< Rect > ¤t_clip_coverage) const override
Given the current pass space bounding rectangle of the clip buffer, return the expected clip coverage...
virtual fml::Status Draw()
Record the currently pending command.
static Scalar GetShaderClipDepth(const Entity &entity)
ISize GetRenderTargetSize() const
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
virtual GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const =0
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.
VertexBuffer CreateVertexBuffer(std::array< VertexType, size > input, HostBuffer &host_buffer)
Create an index-less vertex buffer from a fixed size array.
void SetGeometry(const Geometry *geometry)
VertexShader_ VertexShader
void SetInheritedOpacity(Scalar opacity) override
Inherit the provided opacity.
virtual void SetStencilReference(uint32_t value)
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Render passes encode render commands directed as one specific render target into an underlying comman...
uint32_t GetClipDepth() const
constexpr static TRect MakeSize(const TSize< U > &size)
ClipCoverage GetClipCoverage(const Entity &entity, const std::optional< Rect > ¤t_clip_coverage) const override
Given the current pass space bounding rectangle of the clip buffer, return the expected clip coverage...
BufferView EmplaceUniform(const UniformType &uniform)
Emplace uniform data onto the host buffer. Ensure that backend specific uniform alignment requirement...
void SetInheritedOpacity(Scalar opacity) override
Inherit the provided opacity.
void SetRestoreHeight(size_t clip_height)
@ kOverdrawPreventionRestore
virtual void SetPipeline(const std::shared_ptr< Pipeline< PipelineDescriptor >> &pipeline)
The pipeline to use for this command.
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.