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"
9#include "../rapid/sfloat_rgba16.hpp"
10#include "../rapid/sfloat_rgba32.hpp"
11#include "../rapid/sfloat_rgb32.hpp"
12#include "../rapid/int_abgr8_pack.hpp"
13#include <vulkan/vulkan.hpp>
14#include <span>
15
16namespace hi::inline v1::pipeline_box {
17
21struct alignas(16) vertex {
24 sfloat_rgba32 position;
25
28 sfloat_rgba32 clipping_rectangle;
29
38
42
46
50
51
52 float line_width;
53
54 vertex(
55 sfloat_rgba32 position,
56 sfloat_rgba32 clipping_rectangle,
57 sfloat_rgba32 corner_coordinate,
58 sfloat_rgba32 corner_radii,
59 sfloat_rgba16 fill_color,
60 sfloat_rgba16 line_color,
61 float line_width) noexcept :
62 position(position),
63 clipping_rectangle(clipping_rectangle),
64 corner_coordinate(corner_coordinate),
65 corner_radii(corner_radii),
66 fill_color(fill_color),
67 line_color(line_color),
68 line_width(line_width)
69 {
70 }
71
72 static vk::VertexInputBindingDescription inputBindingDescription()
73 {
74 return {0, sizeof(vertex), vk::VertexInputRate::eVertex};
75 }
76
77 static std::vector<vk::VertexInputAttributeDescription> inputAttributeDescriptions()
78 {
79 return {
80 {0, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, position)},
81 {1, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, clipping_rectangle)},
82 {2, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, corner_coordinate)},
83 {3, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, corner_radii)},
84 {4, 0, vk::Format::eR16G16B16A16Sfloat, offsetof(vertex, fill_color)},
85 {5, 0, vk::Format::eR16G16B16A16Sfloat, offsetof(vertex, line_color)},
86 {6, 0, vk::Format::eR32Sfloat, offsetof(vertex, line_width)},
87 };
88 }
89};
90
91} // namespace hi::inline v1::pipeline_box
DOXYGEN BUG.
Definition algorithm.hpp:15
Definition pipeline_alpha_vertex.hpp:21
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:37
sfloat_rgba16 line_color
border color of the box.
Definition pipeline_box_vertex.hpp:49
sfloat_rgba16 fill_color
background color of the box.
Definition pipeline_box_vertex.hpp:45
sfloat_rgba32 corner_radii
Shape of each corner, negative values are cut corners, positive values are rounded corners.
Definition pipeline_box_vertex.hpp:41
Definition sfloat_rgba16.hpp:19
Definition sfloat_rgba32.hpp:15