Implement playable Mac client and rendering validation
This commit is contained in:
@@ -237,10 +237,23 @@ bool File::Impl::extract_mesh(Ref mesh_obj, Ref mesh_type,
|
||||
if (read_ref_to_array(mesh_obj, *mBB, bb, bc, bs) && bc) {
|
||||
const auto& bbT = parse_type(mBB->ref_type);
|
||||
const TypeMember* mBN = find_member(bbT, "BoneName");
|
||||
const TypeMember* mMin = find_member(bbT, "OBBMin");
|
||||
const TypeMember* mMax = find_member(bbT, "OBBMax");
|
||||
out.bone_bounds.resize(bc);
|
||||
std::vector<std::string> names(bc);
|
||||
for (uint32_t i = 0; i < bc; ++i) {
|
||||
Ref e = {bb.section, bb.offset + i * bs};
|
||||
names[i] = mBN ? rd_str(member_slot(e, *mBN)) : std::string();
|
||||
auto &bounds = out.bone_bounds[i];
|
||||
if (mMin && mMax && mMin->type == detail::MT_Real32 && mMax->type == detail::MT_Real32 && mMin->array_width == 3 && mMax->array_width == 3) {
|
||||
Ref lo = member_slot(e, *mMin), hi = member_slot(e, *mMax);
|
||||
bounds.valid = true;
|
||||
for (int axis = 0; axis < 3; ++axis) {
|
||||
bounds.min[axis] = rd_f32({lo.section, lo.offset + uint32_t(axis * 4)});
|
||||
bounds.max[axis] = rd_f32({hi.section, hi.offset + uint32_t(axis * 4)});
|
||||
bounds.valid &= std::isfinite(bounds.min[axis]) && std::isfinite(bounds.max[axis]) && bounds.min[axis] <= bounds.max[axis];
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<int32_t> best(bc, -1);
|
||||
int best_dangling = int(bc) + 1;
|
||||
|
||||
Reference in New Issue
Block a user