Files
XCEngine/docs/api/XCEngine/Resources/Material/Material.md

2.2 KiB

Material

命名空间: XCEngine::Resources

类型: submodule

描述: 材质运行时对象、显式 render-state 契约、材质 source 文件解析,以及 .xcmat artifact 回读链路所在子模块。

概览

Resources/Material 当前已经把三层语义收在同一目录里:

  • Material 运行时材质对象,负责 shader schema、render metadata、数值属性、texture binding 元数据和 packed constant buffer。
  • MaterialRenderState 显式材质 render-state 契约,定义 blend / depth / cull 相关枚举和 MaterialRenderState 结构。
  • MaterialLoader 负责 source 材质与 .xcmat artifact 的加载。
  • 与项目资产链路的接缝 通过 AssetRef、texture path 和 ResourceManager 的异步加载,把材质纹理绑定从“稳定身份”兑现成运行时句柄。

当前材质链路的关键点是:

  • source 材质里的 texture path 会进入 AssetDatabase 的依赖快照
  • 当前 .xcmat 版本会同时保存编码 AssetRef 与可选 path
  • Material::GetTexture(...) / GetTextureBindingTexture(...) 会在首次访问时启动异步纹理兑现
  • blend / depth / cull 等固定功能状态当前已经拆到独立头 MaterialRenderState.h

当前主链路

  1. MaterialLoader 读取 .mat / .material / .json.xcmat
  2. Material 保存 render metadata、数值属性和 texture binding 元数据。
  3. 若 texture binding 只有 path / AssetRef,首次读取时才通过 ResourceManager 启动异步加载。
  4. AssetDatabase 写出新的 .xcmat 时,会把这套元数据重新编码进 artifact。

头文件

相关文档