Newer
Older
ForwardPlusRenderer / src / Vertex.cpp
#include <stdafx.h>
#include "Vertex.h"
namespace fpr
{
VertexInfo Vertex::MakeVertexInputStateData()
{
  std::vector<vk::VertexInputBindingDescription> vertex_binding_desc;
  vertex_binding_desc.emplace_back(0U, (uint32_t)sizeof(Vertex), vk::VertexInputRate::eVertex);

  std::vector<vk::VertexInputAttributeDescription> vertex_attr_desc(6);
  vertex_attr_desc[0].binding  = 0;
  vertex_attr_desc[0].location = 0;
  vertex_attr_desc[0].format   = vk::Format::eR32G32B32Sfloat;
  vertex_attr_desc[0].offset   = (uint32_t)offsetof(Vertex, position);

  vertex_attr_desc[1].binding  = 0;
  vertex_attr_desc[1].location = 1;
  vertex_attr_desc[1].format   = vk::Format::eR32G32B32Sfloat;
  vertex_attr_desc[1].offset   = (uint32_t)offsetof(Vertex, color);

  vertex_attr_desc[2].binding  = 0;
  vertex_attr_desc[2].location = 2;
  vertex_attr_desc[2].format   = vk::Format::eR32G32Sfloat;
  vertex_attr_desc[2].offset   = (uint32_t)offsetof(Vertex, uv);

  vertex_attr_desc[3].binding  = 0;
  vertex_attr_desc[3].location = 3;
  vertex_attr_desc[3].format   = vk::Format::eR32G32B32Sfloat;
  vertex_attr_desc[3].offset   = (uint32_t)offsetof(Vertex, normal);

  vertex_attr_desc[4].binding  = 0;
  vertex_attr_desc[4].location = 4;
  vertex_attr_desc[4].format   = vk::Format::eR32G32B32Sfloat;
  vertex_attr_desc[4].offset   = (uint32_t)offsetof(Vertex, tangent);

  vertex_attr_desc[5].binding  = 0;
  vertex_attr_desc[5].location = 5;
  vertex_attr_desc[5].format   = vk::Format::eR32G32B32Sfloat;
  vertex_attr_desc[5].offset   = (uint32_t)offsetof(Vertex, bitangent);
  return { vertex_binding_desc, vertex_attr_desc };
}
} // namespace fpr