diff options
| author | skal <pascal.massimino@gmail.com> | 2026-05-21 08:10:47 +0200 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-05-21 08:10:47 +0200 |
| commit | d806027dcaeadcdd8d2febd88bc46b2fd2c465de (patch) | |
| tree | 30bc1ef9f40ccab7c00e31ee20e62bb86755fa26 /src/3d/scene_loader.cc | |
| parent | 680042a18c11ad5e58757e45b260745c2f52417f (diff) | |
Diffstat (limited to 'src/3d/scene_loader.cc')
| -rw-r--r-- | src/3d/scene_loader.cc | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/src/3d/scene_loader.cc b/src/3d/scene_loader.cc index d5c1879..d27cc16 100644 --- a/src/3d/scene_loader.cc +++ b/src/3d/scene_loader.cc @@ -64,26 +64,40 @@ bool LoadScene(Scene& scene, const uint8_t* data, size_t size) { if (offset + 12 + 16 + 12 + 16 > size) return false; // Transforms + Color - float px = read_f32(data + offset); offset += 4; - float py = read_f32(data + offset); offset += 4; - float pz = read_f32(data + offset); offset += 4; + float px = read_f32(data + offset); + offset += 4; + float py = read_f32(data + offset); + offset += 4; + float pz = read_f32(data + offset); + offset += 4; vec3 pos(px, py, pz); - float rx = read_f32(data + offset); offset += 4; - float ry = read_f32(data + offset); offset += 4; - float rz = read_f32(data + offset); offset += 4; - float rw = read_f32(data + offset); offset += 4; + float rx = read_f32(data + offset); + offset += 4; + float ry = read_f32(data + offset); + offset += 4; + float rz = read_f32(data + offset); + offset += 4; + float rw = read_f32(data + offset); + offset += 4; quat rot(rx, ry, rz, rw); - float sx = read_f32(data + offset); offset += 4; - float sy = read_f32(data + offset); offset += 4; - float sz = read_f32(data + offset); offset += 4; + float sx = read_f32(data + offset); + offset += 4; + float sy = read_f32(data + offset); + offset += 4; + float sz = read_f32(data + offset); + offset += 4; vec3 scale(sx, sy, sz); - float cr = read_f32(data + offset); offset += 4; - float cg = read_f32(data + offset); offset += 4; - float cb = read_f32(data + offset); offset += 4; - float ca = read_f32(data + offset); offset += 4; + float cr = read_f32(data + offset); + offset += 4; + float cg = read_f32(data + offset); + offset += 4; + float cb = read_f32(data + offset); + offset += 4; + float ca = read_f32(data + offset); + offset += 4; vec4 color(cr, cg, cb, ca); // Plane Distance (if type == PLANE) @@ -127,9 +141,12 @@ bool LoadScene(Scene& scene, const uint8_t* data, size_t size) { // Physics properties if (offset + 4 + 4 + 4 > size) return false; - float mass = read_f32(data + offset); offset += 4; - float restitution = read_f32(data + offset); offset += 4; - uint32_t is_static_u32 = read_u32(data + offset); offset += 4; + float mass = read_f32(data + offset); + offset += 4; + float restitution = read_f32(data + offset); + offset += 4; + uint32_t is_static_u32 = read_u32(data + offset); + offset += 4; bool is_static = (is_static_u32 != 0); // Create Object3D |
