aboutsummaryrefslogtreecommitdiffstats
path: root/src/gltf.cpp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2021-07-25 16:52:28 +0200
committerladevieq <ladevie.quentin@gmail.com>2021-07-25 16:52:28 +0200
commit3bfd2d67e1c2d7e2d77c431f54dd68356c94d787 (patch)
treec3fbd47d8d273c08c64c363342fff35c04f780d0 /src/gltf.cpp
parent3dd870b001bef62aaa501257352d968d1346c7f2 (diff)
Slowly rendering sponza
Diffstat (limited to 'src/gltf.cpp')
-rw-r--r--src/gltf.cpp7
1 files changed, 5 insertions, 2 deletions
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<std::vec
auto positions_length = positions_view["byteLength"].get<size_t>();
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);
}
{