Make imported mesh attributes' indices fixed

This commit is contained in:
Nikita Lisitsa 2021-08-05 16:29:47 +03:00
parent 66f733d937
commit 69c0ce8c59

View file

@ -242,18 +242,28 @@ namespace psemek::gfx
if (vertex_format & POSITION_MASK)
result.attribs += make_attribs_description<geom::point<float, 3>>();
else
result.attribs += make_attribs_description<gfx::skip>();
if (vertex_format & NORMALS_MASK)
result.attribs += make_attribs_description<geom::vector<float, 3>>();
else
result.attribs += make_attribs_description<gfx::skip>();
if (vertex_format & COLORS_MASK)
result.attribs += make_attribs_description<gfx::normalized<geom::vector<std::uint8_t, 4>>>();
else
result.attribs += make_attribs_description<gfx::skip>();
if (vertex_format & TEXCOORDS_MASK)
result.attribs += make_attribs_description<geom::vector<float, 2>>();
else
result.attribs += make_attribs_description<gfx::skip>();
if (vertex_format & WEIGHTS_MASK)
result.attribs += make_attribs_description<gfx::integer<geom::vector<std::uint8_t, 2>>, gfx::normalized<geom::vector<std::uint8_t, 2>>>();
else
result.attribs += make_attribs_description<gfx::skip, gfx::skip>();
auto vertex_count = s.read<std::uint32_t>();
auto vertex_ptr = s.read_raw(vertex_count * result.attribs.vertex_size);