diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-07-25 16:52:28 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-07-25 16:52:28 +0200 |
| commit | 3bfd2d67e1c2d7e2d77c431f54dd68356c94d787 (patch) | |
| tree | c3fbd47d8d273c08c64c363342fff35c04f780d0 /src/gltf.cpp | |
| parent | 3dd870b001bef62aaa501257352d968d1346c7f2 (diff) | |
Slowly rendering sponza
Diffstat (limited to 'src/gltf.cpp')
| -rw-r--r-- | src/gltf.cpp | 7 |
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);
}
{
|
