2#ifndef LIBSBX_MODELS_VERTEX3D_HPP_
3#define LIBSBX_MODELS_VERTEX3D_HPP_
7#include <libsbx/math/vector2.hpp>
8#include <libsbx/math/vector3.hpp>
9#include <libsbx/math/vector4.hpp>
12#include <libsbx/graphics/pipeline/vertex_input_description.hpp>
14namespace sbx::models {
16struct alignas(alignof(std::float_t))
vertex3d {
23static_assert(
sizeof(
vertex3d) == 48,
"Incorrect sbx::models::vertex3d size");
24static_assert(
alignof(
vertex3d) == 4,
"Incorrect sbx::models::vertex3d alignment");
26constexpr auto operator==(
const vertex3d& lhs,
const vertex3d& rhs)
noexcept ->
bool {
27 return lhs.position == rhs.position && lhs.normal == rhs.normal && lhs.tangent == rhs.tangent && lhs.uv == rhs.uv;
37 result.binding_descriptions.push_back(VkVertexInputBindingDescription{
40 .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
43 result.attribute_descriptions.push_back(VkVertexInputAttributeDescription{
46 .format = VK_FORMAT_R32G32B32_SFLOAT,
50 result.attribute_descriptions.push_back(VkVertexInputAttributeDescription{
53 .format = VK_FORMAT_R32G32B32_SFLOAT,
57 result.attribute_descriptions.push_back(VkVertexInputAttributeDescription{
60 .format = VK_FORMAT_R32G32B32A32_SFLOAT,
64 result.attribute_descriptions.push_back(VkVertexInputAttributeDescription{
67 .format = VK_FORMAT_R32G32_SFLOAT,
76struct std::hash<sbx::models::vertex3d> {
78 auto hash = std::size_t{0};
79 sbx::utility::hash_combine(hash, vertex.position, vertex.normal, vertex.tangent, vertex.uv);
A vector in two-dimensional space.
Definition: vector2.hpp:28
Definition: vector3.hpp:23
Definition: vector4.hpp:24
RGBA color representation and utilities.
Definition: vertex3d.hpp:16