2022-08-13 17:22:19 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Orange/Core/Array.h>
|
|
|
|
#include <Orange/Core/Log.h>
|
|
|
|
#include <Orange/Core/Result.h>
|
|
|
|
#include <Orange/Core/Traits.h>
|
|
|
|
#include <Orange/Core/Vector.h>
|
|
|
|
#include <Orange/Math/Vector.h>
|
|
|
|
|
|
|
|
#include <vulkan/vulkan_core.h>
|
|
|
|
|
|
|
|
namespace orange
|
|
|
|
{
|
|
|
|
enum class MeshVertexType
|
|
|
|
{
|
|
|
|
Static,
|
|
|
|
Skinned,
|
|
|
|
};
|
|
|
|
|
2022-08-13 19:09:54 +01:00
|
|
|
struct alignas(8) StaticVertex
|
2022-08-13 17:22:19 +01:00
|
|
|
{
|
|
|
|
vec3 pos;
|
|
|
|
vec2 uv;
|
|
|
|
vec3 normal;
|
|
|
|
//vec3 tangent;
|
|
|
|
|
|
|
|
static constexpr VkVertexInputAttributeDescription Attributes[] =
|
|
|
|
{
|
|
|
|
{ .location = 0, .binding = 0, .format = VK_FORMAT_R32G32B32_SFLOAT, .offset = uint32_t(offsetof2(StaticVertex, pos)) },
|
|
|
|
{ .location = 1, .binding = 0, .format = VK_FORMAT_R32G32_SFLOAT, .offset = uint32_t(offsetof2(StaticVertex, uv)) },
|
|
|
|
{ .location = 2, .binding = 0, .format = VK_FORMAT_R32G32B32_SFLOAT, .offset = uint32_t(offsetof2(StaticVertex, normal)) },
|
|
|
|
};
|
|
|
|
|
|
|
|
bool operator == (const StaticVertex& other) const
|
|
|
|
{
|
|
|
|
return
|
|
|
|
pos == other.pos &&
|
|
|
|
uv == other.uv &&
|
|
|
|
normal == other.normal;// &&
|
|
|
|
//tangent == other.tangent;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-08-13 19:09:54 +01:00
|
|
|
struct alignas(8) SkinnedVertex : public StaticVertex
|
2022-08-13 17:22:19 +01:00
|
|
|
{
|
|
|
|
static constexpr uint32_t MaxVertexWeights = 4;
|
|
|
|
|
|
|
|
bool operator == (const SkinnedVertex& other) const
|
|
|
|
{
|
|
|
|
return
|
|
|
|
pos == other.pos &&
|
|
|
|
uv == other.uv &&
|
|
|
|
normal == other.normal &&
|
|
|
|
//tangent == other.tangent &&
|
|
|
|
boneIndices == other.boneIndices &&
|
|
|
|
boneWeights == other.boneWeights;
|
|
|
|
}
|
|
|
|
|
|
|
|
Array<uint8_t, MaxVertexWeights> boneIndices;
|
|
|
|
Array<uint8_t, MaxVertexWeights> boneWeights;
|
|
|
|
};
|
|
|
|
}
|