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

◆ crosshair()

MAYAFLUX_API GeometryFn< glm::vec2 > MayaFlux::Portal::Forma::Geometry::crosshair ( float  arm_len = 0.04F,
glm::vec3  color = glm::vec3(0.9F),
float  thickness = 1.F,
float  hit_radius = 0.05F 
)

Geometry function for a crosshair indicator in NDC space.

Parameters
arm_lenHalf-length of each arm in NDC units.
colorLine color.
thicknessLine thickness (maps to LineVertex::thickness).
hit_radiusHit region radius in NDC units.
Note
Pass PrimitiveTopology::LINE_LIST explicitly to create_element — the default TRIANGLE_STRIP will misinterpret the 4 vertices.

Definition at line 266 of file Geometry.cpp.

271{
272 return [arm_len, color, thickness, hit_radius](
273 glm::vec2 pos, std::vector<uint8_t>& out, Element& el) {
274 using V = Kakshya::LineVertex;
275 const std::array<V, 4> verts { {
276 { .position = { pos.x - arm_len, pos.y, 0.F }, .color = color, .thickness = thickness },
277 { .position = { pos.x + arm_len, pos.y, 0.F }, .color = color, .thickness = thickness },
278 { .position = { pos.x, pos.y - arm_len, 0.F }, .color = color, .thickness = thickness },
279 { .position = { pos.x, pos.y + arm_len, 0.F }, .color = color, .thickness = thickness },
280 } };
281 write_verts(out, verts);
282 el.bounds_hint = Kinesis::AABB2D::from_ndc(pos, glm::vec2(arm_len));
283 el.contains = Kinesis::circular_bounds(pos, hit_radius);
284 };
285}
void write_verts(std::vector< uint8_t > &out, const std::vector< V > &verts)
Write a vertex array into a GeometryFn output buffer.
Definition Geometry.hpp:35
Vertex type for line primitives (LINE_LIST / LINE_STRIP topology)
A bounded, renderable region on a window surface.
Definition Element.hpp:58

References MayaFlux::Kinesis::circular_bounds(), MayaFlux::Kinesis::AABB2D::from_ndc(), MayaFlux::Kakshya::LineVertex::position, and write_verts().

+ Here is the call graph for this function: