feat(asset): 统一资产引用使用 GUID 替代路径 (#287)

* feat(world-streaming): 添加世界流式加载系统

实现基于区块的世界流式加载系统,支持开放世界游戏:

运行时包 (@esengine/world-streaming):
- ChunkComponent: 区块实体组件,包含坐标、边界、状态
- StreamingAnchorComponent: 流式锚点组件(玩家/摄像机)
- ChunkLoaderComponent: 流式加载配置组件
- ChunkStreamingSystem: 区块加载/卸载调度系统
- ChunkCullingSystem: 区块可见性剔除系统
- ChunkManager: 区块生命周期管理服务
- SpatialHashGrid: 空间哈希网格
- ChunkSerializer: 区块序列化

编辑器包 (@esengine/world-streaming-editor):
- ChunkVisualizer: 区块可视化覆盖层
- ChunkLoaderInspectorProvider: 区块加载器检视器
- StreamingAnchorInspectorProvider: 流式锚点检视器
- WorldStreamingPlugin: 完整插件导出

* feat(asset): 统一资产引用使用 GUID 替代路径

将所有组件的资产引用字段从路径改为 GUID:
- SpriteComponent: texture -> textureGuid, material -> materialGuid
- SpriteAnimatorComponent: AnimationFrame.texture -> textureGuid
- UIRenderComponent: texture -> textureGuid
- UIButtonComponent: normalTexture -> normalTextureGuid 等
- AudioSourceComponent: clip -> clipGuid
- ParticleSystemComponent: 已使用 textureGuid

修复 AssetRegistryService 注册问题和路径规范化,
添加渲染系统的 GUID 解析支持。

* fix(sprite-editor): 更新 material 为 materialGuid

* fix(editor-app): 更新 AnimationFrame.texture 为 textureGuid
This commit is contained in:
YHH
2025-12-06 14:08:48 +08:00
committed by GitHub
parent 0c03b13d74
commit 3617f40309
25 changed files with 443 additions and 152 deletions

View File

@@ -54,9 +54,25 @@ export enum SimulationSpace {
* 管理粒子发射、模拟,并为渲染提供数据。
*/
@ECSComponent('ParticleSystem')
@Serializable({ version: 1, typeId: 'ParticleSystem' })
@Serializable({ version: 2, typeId: 'ParticleSystem' })
export class ParticleSystemComponent extends Component {
// ============= 资产引用 | Asset Reference =============
/**
* 粒子效果资产 GUID
* Particle effect asset GUID
*
* When set, loads particle configuration from .particle file.
* Inline properties below are ignored when asset is set.
* 设置后从 .particle 文件加载粒子配置。
* 设置了资产后,下面的内联属性将被忽略。
*/
@Serialize()
@Property({ type: 'asset', label: 'Particle Asset', extensions: ['.particle', '.particle.json'] })
public particleAssetGuid: string = '';
// ============= 基础属性 | Basic Properties =============
// These are used when particleAssetGuid is not set
/** 最大粒子数量 | Maximum particle count */
@Serialize()
@@ -200,10 +216,13 @@ export class ParticleSystemComponent extends Component {
// ============= 渲染属性 | Rendering Properties =============
/** 粒子纹理 | Particle texture */
/**
* 粒子纹理 GUID
* Particle texture GUID
*/
@Serialize()
@Property({ type: 'asset', label: 'Texture', assetType: 'texture' })
public texture: string = '';
public textureGuid: string = '';
/** 粒子尺寸(像素)| Particle size (pixels) */
@Serialize()

View File

@@ -108,8 +108,8 @@ export interface IParticleAsset {
blendMode: ParticleBlendMode;
/** 排序顺序 | Sorting order */
sortingOrder: number;
/** 纹理路径 | Texture path */
texture?: string;
/** 纹理资产 GUID | Texture asset GUID */
textureGuid?: string;
// 模块配置 | Module configurations
/** 模块列表 | Module list */

View File

@@ -191,7 +191,7 @@ export class ParticleRenderDataProvider implements IRenderDataProvider {
colors: this._colors.subarray(0, particleIndex),
tileCount: particleIndex,
sortingOrder,
texturePath: systems[0]?.component.texture || undefined
texturePath: systems[0]?.component.textureGuid || undefined
};
this._renderDataCache.push(renderData);