22 contents->SetTexture(snapshot.
texture);
24 contents->SetSourceRect(texture_rect);
25 contents->SetOpacity(snapshot.
opacity);
56 {0, 0, shader_clip_depth}) *
69 return contents_->GetCoverage(*
this);
73 contents_ = std::move(contents);
81 clip_depth_ = clip_depth;
98 blend_mode_ = blend_mode;
112 contents_->SetInheritedOpacity(alpha);
117 return contents_->AsBackgroundColor(*
this, target_size);
128 switch (blend_mode) {
150 if (!contents_->GetCoverageHint().has_value()) {
151 contents_->SetCoverageHint(
155 return contents_->Render(renderer, *
this, parent_pass);
void SetTransform(const Matrix &transform)
Set the global transform matrix for this Entity.
std::optional< Rect > GetCoverage() const
bool SetInheritedOpacity(Scalar alpha)
const std::shared_ptr< Contents > & GetContents() const
Matrix GetShaderTransform(const RenderPass &pass) const
void SetClipDepth(uint32_t clip_depth)
BlendMode GetBlendMode() const
void SetContents(std::shared_ptr< Contents > contents)
void SetBlendMode(BlendMode blend_mode)
static constexpr Scalar kDepthEpsilon
bool Render(const ContentContext &renderer, RenderPass &parent_pass) const
std::optional< Color > AsBackgroundColor(ISize target_size) const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
uint32_t GetClipDepth() const
static bool IsBlendModeDestructive(BlendMode blend_mode)
Returns true if the blend mode is "destructive", meaning that even fully transparent source colors wo...
static Entity FromSnapshot(const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSrcOver)
Create an entity that can be used to render a given snapshot.
Entity & operator=(Entity &&)
float GetShaderClipDepth() const
Render passes encode render commands directed as one specific render target into an underlying comman...
const Matrix & GetOrthographicTransform() const
ISize GetRenderTargetSize() const
static std::shared_ptr< TextureContents > MakeRect(Rect destination)
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslateScale(const Vector3 &s, const Vector3 &t)
Represents a texture and its intended draw transform/sampler configuration.
Matrix transform
The transform that should be applied to this texture for rendering.
std::shared_ptr< Texture > texture
SamplerDescriptor sampler_descriptor
constexpr static TRect MakeSize(const TSize< U > &size)