HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
pipeline_image_vertex.hpp
1// Copyright Take Vos 2019-2020.
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 "../geometry/axis_aligned_rectangle.hpp"
8#include "../rapid/sfloat_rgba32.hpp"
9#include <vulkan/vulkan.hpp>
10
11namespace hi::inline v1::pipeline_image {
12
16struct alignas(16) vertex {
18 sfloat_rgba32 position;
19
21 sfloat_rgba32 clipping_rectangle;
22
25
26 vertex(sfloat_rgba32 position, sfloat_rgba32 clipping_rectangle, sfloat_rgba32 atlas_position) noexcept :
27 position(position), clipping_rectangle(clipping_rectangle), atlas_position(atlas_position)
28 {
29 }
30
31 static vk::VertexInputBindingDescription inputBindingDescription()
32 {
33 return {0, sizeof(vertex), vk::VertexInputRate::eVertex};
34 }
35
36 static std::vector<vk::VertexInputAttributeDescription> inputAttributeDescriptions()
37 {
38 return {
39 {0, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, position)},
40 {1, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, clipping_rectangle)},
41 {2, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex, atlas_position)},
42 };
43 }
44};
45
46} // namespace hi::inline v1::pipeline_image
Definition pipeline_box_vertex.hpp:21
sfloat_rgba32 atlas_position
The x, y coordinate inside the texture-atlas, z is used as an index in the texture-atlas array.
Definition pipeline_image_vertex.hpp:24
Definition sfloat_rgba32.hpp:15