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

◆ scroll_view_transform()

MAYAFLUX_API ViewTransform MayaFlux::Kinesis::scroll_view_transform ( const ScrollState &  state)
noexcept

Build an orthographic ViewTransform that translates by +offset.

For content already authored directly in NDC, as every Forma geometry function is, this is view = translate(offset), projection = identity: the vertex shader's projection * view * position reduces to position + offset, the same shift LayoutCursor applies on the CPU side.

Meant for a buffer that wants to shift many vertices as one GPU-side move instead of a per-element CPU reflow. Hit-testing against elements shifted this way still needs the same offset applied to the cursor position before testing them - see ScrollState's own doc comment; this function only produces the render-side half.

Definition at line 37 of file ScrollState.cpp.

38{
39 return {
40 .view = glm::translate(glm::mat4(1.0F), glm::vec3(state.offset, 0.F)),
41 .projection = glm::mat4(1.0F),
42 };
43}

References MayaFlux::Kinesis::ViewTransform::view.