HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
pipeline_box_vertex.hpp
1// Copyright Take Vos 2020-2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../vector_span.hpp"
8#include "../geometry/module.hpp"
9#include "../image/module.hpp"
10#include <vulkan/vulkan.hpp>
11#include <span>
12
13namespace hi::inline v1::pipeline_box {
14
18struct alignas(16) vertex {
21 sfloat_rgba32 position;
22
25 sfloat_rgba32 clipping_rectangle;
26
35
39
43
47
48
49 float line_width;
50
51 vertex(
52 sfloat_rgba32 position,
53 sfloat_rgba32 clipping_rectangle,
54 sfloat_rgba32 corner_coordinate,
55 sfloat_rgba32 corner_radii,
56 sfloat_rgba16 fill_color,
57 sfloat_rgba16 line_color,
58 float line_width) noexcept :
59 position(position),
60 clipping_rectangle(clipping_rectangle),
61 corner_coordinate(corner_coordinate),
62 corner_radii(corner_radii),
63 fill_color(fill_color),
64 line_color(line_color),
65 line_width(line_width)
66 {
67 }
68
69 static vk::VertexInputBindingDescription inputBindingDescription()
70 {
71 return {0, sizeof(vertex), vk::VertexInputRate::eVertex};
72 }
73
74 static std::vector<vk::VertexInputAttributeDescription> inputAttributeDescriptions()
75 {
76 return {
77 {0, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, position)},
78 {1, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, clipping_rectangle)},
79 {2, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, corner_coordinate)},
80 {3, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, corner_radii)},
81 {4, 0, vk::Format::eR16G16B16A16Sfloat, offsetof(vertex, fill_color)},
82 {5, 0, vk::Format::eR16G16B16A16Sfloat, offsetof(vertex, line_color)},
83 {6, 0, vk::Format::eR32Sfloat, offsetof(vertex, line_width)},
84 };
85 }
86};
87
88} // namespace hi::inline v1::pipeline_box
DOXYGEN BUG.
Definition algorithm.hpp:13
Definition pipeline_alpha_vertex.hpp:18
sfloat_rgba32 corner_coordinate
Double 2D coordinates inside the quad, used to determine the distance from the sides and corner insid...
Definition pipeline_box_vertex.hpp:34
sfloat_rgba16 line_color
border color of the box.
Definition pipeline_box_vertex.hpp:46
sfloat_rgba16 fill_color
background color of the box.
Definition pipeline_box_vertex.hpp:42
sfloat_rgba32 corner_radii
Shape of each corner, negative values are cut corners, positive values are rounded corners.
Definition pipeline_box_vertex.hpp:38
4 x float16 pixel format.
Definition sfloat_rgba16.hpp:26
4 x float32 pixel format.
Definition sfloat_rgba32.hpp:22