Implement playable Mac client and rendering validation

This commit is contained in:
shen
2026-09-11 14:58:22 +08:00
parent 1ab68bd06e
commit 374d4165d8
233 changed files with 6546 additions and 284 deletions
+5
View File
@@ -45,12 +45,17 @@ struct TriGroup {
};
struct Mesh {
struct BoneBounds {
float min[3] = {}, max[3] = {};
bool valid = false;
};
std::string name;
VertexKind kind = VertexKind::Unknown;
std::vector<Vertex> vertices;
std::vector<uint32_t> indices; // 三角形列表
std::vector<TriGroup> tri_groups;
std::vector<int32_t> bone_bindings; // mesh 局部骨骼槽 → skeleton 骨骼索引
std::vector<BoneBounds> bone_bounds; // Parallel source BoneBindings OBBMin/OBBMax.
uint32_t source_bone_weight_slots = 0; // 顶点类型声明值;审计 >4/8 权重
uint32_t source_bone_index_slots = 0; // packed UInt32 记为 4
// 与 granny_mesh.MaterialBindings 平行:每项 = 解析出的漫反射贴图文件名
+13
View File
@@ -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;