Files
GC/model/_engine/src/EngineEntry.cs
T
Morris 0b2f263dea
PR 审核 / 后端编译 (pull_request) Canceled after 0s
PR 审核 / 后端自检 (pull_request) Canceled after 0s
PR 审核 / 前端检查(Flutter) (pull_request) Canceled after 0s
PR 审核 / 安全扫描 (pull_request) Canceled after 0s
PR 审核 / 审核汇总 (pull_request) Canceled after 0s
chore: 彻底移除 NeoRF 标识,统一为 GC / Morris
- 命名空间 NeoRF.EarthModels / NeoRF.ContourMap / NeoRF.ScaleCalculator
  改为 GC.EarthModels / GC.ContourMap / GC.ScaleCalculator
- 模型清单 type 字段同步更新,五个模型 DLL 全部重新编译并替换
- 程序集 Company 由 NeoRF 改为 Morris
- 模型作者 author 统一为 Morris(原 NeoRF / Morris GC)
- macOS 包标识 cn.neorf.GC 改为 com.xhmcl.GC
- 重算 version.json 与 model/version.json 的 build / manifestSha256 / filesSha256
2026-11-18 06:55:10 +08:00

46 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using Avalonia.Controls;
using GC.ModelSdk;
namespace GC.EarthModels;
/// <summary>
/// 地球模型共享运行时:读自己目录下的 scene.json / land.json / i18n,
/// 然后把自带界面交给启动器。启动器完全不知道“地球”“节气”这些东西。
/// </summary>
public sealed class EarthModelRuntime : IModelRuntime
{
public const int SupportedApiVersion = 1;
private SceneRuntime? _scene;
/// <summary>后台准备:读场景、生成地表纹理(耗时都花在这里,进度条能实时走)。</summary>
public void Prepare(IModelContext context)
{
context.ReportProgress(0.03, "读取场景数据");
_scene = SceneRuntime.Load(context.DataDirectory, context.MemoryBudgetMb, context.ReportProgress);
context.Log($"[{context.ModelId}] 场景已加载:{_scene.Scene.DefaultView}," +
$"地表纹理 {(_scene.Texture == null ? "无" : _scene.Texture.Width + "×" + _scene.Texture.Height)}");
}
/// <summary>UI 线程构建界面(很快)。</summary>
public Control CreateView(IModelContext context)
{
context.ReportProgress(0.78, "构建界面");
_scene ??= SceneRuntime.Load(context.DataDirectory, context.MemoryBudgetMb, context.ReportProgress);
var view = new EarthModelView(context, _scene);
context.ReportProgress(1.0, "准备就绪");
return view;
}
/// <summary>
/// 释放预烘焙纹理(约 3MB 托管数组)与场景引用。窗口关闭时由启动器调用,
/// 避免 collectible ALC 里的类型被长生命周期引用拖住而无法卸载。
/// </summary>
public void Dispose()
{
_scene = null;
System.GC.SuppressFinalize(this);
}
}