feat: ImGui docking Editor + 显示链/帧同步/输入语义重构
- App/editor: Hierarchy/Inspector/Viewport/Stats 四面板 + DockBuilder 默认布局,main.cpp 瘦身为场景搭建与生命周期 - 显示链: Tonemap→PresentTarget 经 ImGui::Image 呈现(零色偏),backbuffer 仅承载 ImGui;Direct/Viewport 双显示模式 + 面板分辨率上报 - 帧首同步 BeginFrameSync: resize/vsync/尺寸/模式意图统一帧首落定(修描述符悬垂);修复 vsync 意图未落 swapchain 导致的每帧重建交换链 - 输入: Editor 每帧判定键盘/鼠标归属(打字让位、Viewport hover/focus 放行、Fullscreen 全放行) - 材质: roughness 独立槽位 + 非 glTF 金属/粗糙贴图映射;透明队列 depthWrite=FALSE + translucent 独立 shader + scratch 清帧 - FBX: 非蒙皮网格烘焙节点链全局变换(Z-up 旋转/单位换算落顶点) - Hierarchy 行 ImGui ID 以 UUID 作用域(重名不冲突、改名不丢选中)
This commit is contained in:
@@ -40,8 +40,9 @@ layout(set = 1, binding = 1) uniform sampler2D normalMap;
|
||||
layout(set = 1, binding = 2) uniform sampler2D metallicRoughnessMap; // G=粗糙度 B=金属度
|
||||
layout(set = 1, binding = 3) uniform sampler2D emissiveMap;
|
||||
layout(set = 1, binding = 4) uniform sampler2D aoMap; // 环境光遮蔽(R 通道)
|
||||
layout(set = 1, binding = 5) uniform MaterialParams {
|
||||
vec4 factors; // x = metallic 因子,y = roughness 因子
|
||||
layout(set = 1, binding = 5) uniform sampler2D roughnessMap; // 独立粗糙度图(R 通道,specular 工作流)
|
||||
layout(set = 1, binding = 6) uniform MaterialParams {
|
||||
vec4 factors; // x = metallic 因子,y = roughness 因子,z = 独立粗糙度图开关
|
||||
} matParams;
|
||||
|
||||
// CSM 阴影(sampler2DShadow:单次采样 = 硬件 2×2 深度比较 PCF)
|
||||
@@ -134,9 +135,14 @@ vec3 FresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec3 albedo = texture(albedoMap, fragUV).rgb;
|
||||
vec4 albedoTex = texture(albedoMap, fragUV);
|
||||
vec3 albedo = albedoTex.rgb;
|
||||
vec4 mr = texture(metallicRoughnessMap, fragUV);
|
||||
float roughness = clamp(mr.g * matParams.factors.y, 0.045, 1.0);
|
||||
// 粗糙度源按 factors.z 切换:glTF 合图工作流读 MR.g;
|
||||
// FBX/OBJ specular 工作流(z=1)换用独立粗糙度图 R 通道
|
||||
float roughness = clamp(mix(mr.g, texture(roughnessMap, fragUV).r,
|
||||
matParams.factors.z) * matParams.factors.y,
|
||||
0.045, 1.0);
|
||||
float metallic = clamp(mr.b * matParams.factors.x, 0.0, 1.0);
|
||||
vec3 emissive = texture(emissiveMap, fragUV).rgb;
|
||||
|
||||
@@ -217,6 +223,8 @@ void main() {
|
||||
vec3 ambient = (diffuse + specular) * ubo.ambientColor.rgb
|
||||
* mix(0.4, 1.0, shade0); // 阴影区环境同步衰减(简化遮蔽)
|
||||
|
||||
outColor = vec4(ambient + Lo + emissive, 1.0);
|
||||
// alpha = albedo 贴图覆盖率(glTF alphaMode=BLEND 混合源);
|
||||
// 不透明资产贴图 a=1 行为不变。预乘在 tonemap 段完成。
|
||||
outColor = vec4(ambient + Lo + emissive, albedoTex.a);
|
||||
outVelocity = fragVelocity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user