diff options
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 |
