fix(ShaderBake): 修正离屏视图矩阵与侧栏数值不可见

- 投影矩阵是 OpenGL 约定(相机朝 -Z),而 TRS.inverse 给的是 Unity 的 +Z 朝前,
  两者拼起来几何全被裁剪,表现是"渲染成功但画面全透明";视图矩阵补上 Z 镜像
- 侧栏半宽/三分之一宽的字段按内容定基宽,标题又占 ~120px,输入框被挤出可视区;
  改成 flex-basis:0 + 收窄标题 + 输入区 min-width:0,并缩短过长标签
- 数值绑定改用 INotifyValueChanged<T> 按名字绑定,不再依赖跨版本会换命名空间的具体字段类型
This commit is contained in:
2026-11-05 19:17:57 +08:00
parent bede1f8a8b
commit 7c0f35fdcb
4 changed files with 81 additions and 32 deletions
+13 -2
View File
@@ -31,10 +31,21 @@ namespace XericUI.ShaderBake
[Tooltip("相机旋转(欧拉角,度):默认朝 +Z 看,即看着放在原点、面朝 -Z 的面片")]
public Vector3 eulerAngles;
/// <summary> 视口(世界 → 相机)矩阵 </summary>
/// <summary>
/// 视口(世界 → 相机)矩阵。
///
/// <para><b>为什么要镜像 Z</b>:<see cref="Matrix4x4.Perspective"/> 与 <see cref="Matrix4x4.Ortho"/>
/// 沿用 OpenGL 约定——相机朝 <b>-Z</b> 看;而 <c>TRS(...).inverse</c> 给出的是 Unity 自己的
/// "朝 +Z 看"。两者直接拼起来,正前方的物体会得到负的裁剪 w(透视)或落在近远裁剪面之外(正交),
/// 整块几何被裁光,表现就是"渲染成功但画面全透明"。</para>
/// </summary>
public Matrix4x4 viewMatrix
{
get { return Matrix4x4.TRS(position, Quaternion.Euler(eulerAngles), Vector3.one).inverse; }
get
{
Matrix4x4 worldToLocal = Matrix4x4.TRS(position, Quaternion.Euler(eulerAngles), Vector3.one).inverse;
return Matrix4x4.Scale(new Vector3(1f, 1f, -1f)) * worldToLocal;
}
}
/// <summary>