From 3bfd2d67e1c2d7e2d77c431f54dd68356c94d787 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Sun, 25 Jul 2021 16:52:28 +0200 Subject: Slowly rendering sponza --- src/gltf.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gltf.cpp') diff --git a/src/gltf.cpp b/src/gltf.cpp index 0e74aaf..72219d6 100644 --- a/src/gltf.cpp +++ b/src/gltf.cpp @@ -78,11 +78,14 @@ void gltf::load_primitive(json &gltf_json, json &primitive, std::vector(); auto positions_buffer = buffers_content[positions_buffer_index]; - void* positions_start = positions_buffer.data() + positions_offset; + float* positions_start = (float*)(positions_buffer.data() + positions_offset); mesh_part.positions.resize(positions_length / (sizeof(float) * 3)); - std::memcpy(mesh_part.positions.data(), positions_start, positions_length); + for (size_t i = 0; i < positions_length / (sizeof(float) * 3); i++) { + mesh_part.positions[i] = vec3(positions_start[i * 3], positions_start[i * 3 + 1], positions_start[i * 3 + 2]); + } + // std::memcpy(mesh_part.positions.data(), positions_start, positions_length); } { -- cgit v1.3