MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ resolve_scissor_rect()

vk::Rect2D MayaFlux::Buffers::RenderProcessor::resolve_scissor_rect ( uint32_t  width,
uint32_t  height 
) const
protectednoexcept

Resolve the active scissor against a live framebuffer size.

Full framebuffer when unset.

Definition at line 610 of file RenderProcessor.cpp.

611{
612 if (!m_scissor) {
613 return { { 0, 0 }, { width, height } };
614 }
615
616 const auto& bounds = m_scissor->bounds;
617 const auto fw = static_cast<float>(width);
618 const auto fh = static_cast<float>(height);
619
620 const float x0 = std::clamp((bounds.min.x * 0.5F + 0.5F) * fw, 0.F, fw);
621 const float x1 = std::clamp((bounds.max.x * 0.5F + 0.5F) * fw, 0.F, fw);
622 const float y0 = std::clamp((1.F - bounds.max.y) * 0.5F * fh, 0.F, fh);
623 const float y1 = std::clamp((1.F - bounds.min.y) * 0.5F * fh, 0.F, fh);
624
625 const auto px = static_cast<int32_t>(x0);
626 const auto py = static_cast<int32_t>(y0);
627 const auto pw = static_cast<uint32_t>(x1 - x0);
628 const auto ph = static_cast<uint32_t>(y1 - y0);
629
630 return { { px, py }, { pw, ph } };
631}
uint32_t ph
uint32_t py
uint32_t pw
uint32_t px
uint32_t width
uint32_t height
std::optional< Kinesis::Scissor > m_scissor

References height, ph, pw, px, py, and width.