refactor(model):优化网格序列化逻辑并修复测试文件路径
- 使用Set避免重复序列化网格数据 - 在模型加载时自动补充缺失的网格引用 - 更新测试文件路径至统一的testing.model - 移除冗余的部件位置设置代码
This commit is contained in:
@@ -142,6 +142,7 @@ public class ModelLayerPanelTest {
|
||||
renderPanel.dispose();
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
model.saveToFile("C:\\Users\\Administrator\\Desktop\\testing.model");
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ModelLoadTest {
|
||||
private boolean enableWireframe = false;
|
||||
|
||||
// 要加载的 model 文件路径(请根据实际保存位置修改)
|
||||
private static final String MODEL_PATH = "C:\\Users\\Administrator\\Desktop\\trump_texture.model";
|
||||
private static final String MODEL_PATH = "C:\\Users\\Administrator\\Desktop\\testing.model";
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ModelLoadTest().run();
|
||||
@@ -318,20 +318,6 @@ public class ModelLoadTest {
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
// 如果 parts 不为空,尝试把第一个 part 放到窗口中心(如果有 setPosition)
|
||||
if (!parts.isEmpty()) {
|
||||
Object first = parts.get(0);
|
||||
try {
|
||||
Method setPosition = tryGetMethod(first.getClass(), "setPosition", float.class, float.class);
|
||||
if (setPosition != null) {
|
||||
setPosition.invoke(first, (float) WINDOW_WIDTH / 2f, (float) WINDOW_HEIGHT / 2f);
|
||||
System.out.println("Moved first part to window center.");
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user