2.2 KiB
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 材质与
.xcmatartifact 的加载。 - 与项目资产链路的接缝
通过
AssetRef、texture path 和ResourceManager的异步加载,把材质纹理绑定从“稳定身份”兑现成运行时句柄。
当前材质链路的关键点是:
- source 材质里的 texture path 会进入
AssetDatabase的依赖快照 - 当前
.xcmat版本会同时保存编码AssetRef与可选 path Material::GetTexture(...)/GetTextureBindingTexture(...)会在首次访问时启动异步纹理兑现- blend / depth / cull 等固定功能状态当前已经拆到独立头
MaterialRenderState.h
当前主链路
MaterialLoader读取.mat/.material/.json或.xcmat。Material保存 render metadata、数值属性和 texture binding 元数据。- 若 texture binding 只有 path /
AssetRef,首次读取时才通过ResourceManager启动异步加载。 AssetDatabase写出新的.xcmat时,会把这套元数据重新编码进 artifact。
头文件
- Material -
Material.h - MaterialRenderState -
MaterialRenderState.h - MaterialLoader -
MaterialLoader.h