Files
XCEngine/docs/api/XCEngine/Rendering/Passes/ObjectIdOutlineStyle/ObjectIdOutlineStyle.md

55 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ObjectIdOutlineStyle
**命名空间**: `XCEngine::Rendering::Passes`
**类型**: `struct`
**头文件**: `XCEngine/Rendering/Passes/BuiltinObjectIdOutlinePass.h`
**描述**: 描述 builtin object-id 轮廓 pass 的可调参数,包括颜色、像素宽度和调试 mask 模式。
## 概览
`ObjectIdOutlineStyle` 是 [BuiltinObjectIdOutlinePass](../BuiltinObjectIdOutlinePass/BuiltinObjectIdOutlinePass.md) 的轻量配置结构。它不拥有 GPU 资源,也不参与生命周期管理,只负责把“这次要画什么样的轮廓”显式传给 pass。
当前它主要由 editor 侧的 Scene View 组装流程创建,再传给 `SceneViewportSelectionOutlinePassRenderer`,最终落到 `BuiltinObjectIdOutlinePass::Render(...)`
## 默认值
按头文件默认成员初始化,当前默认样式是:
| 字段 | 默认值 | 说明 |
|------|------|------|
| `outlineColor` | `Math::Color(1.0f, 0.4f, 0.0f, 1.0f)` | 橙色,不透明。 |
| `outlineWidthPixels` | `2.0f` | 轮廓宽度,单位是像素。 |
| `debugSelectionMask` | `false` | 默认输出正常轮廓,而不是调试 mask。 |
## 字段语义
### `outlineColor`
- 直接写进 outline 常量缓冲。
- 正常模式下会参与 alpha 混合,最终叠加到主颜色目标。
### `outlineWidthPixels`
- 传给 shader用于决定要在 object-id 纹理周围搜索多大的邻域。
- 当前 builtin shader 只枚举 `[-2, 2]` 范围内的像素偏移,因此即使把这个值设得更大,实际可见宽度也不会继续明显增加。
### `debugSelectionMask`
-`true`pass 不再输出橙色轮廓,而是把“当前像素是否属于被选中对象”可视化为白底/黑底 mask。
- Scene View 当前也复用同一组 style 字段控制这个模式,只是由 editor 侧决定是否创建对应 pass。
## 当前实现边界
- 当前样式只覆盖颜色、宽度和调试开关,没有羽化曲线、内描边、虚线、深度遮挡等更高阶参数。
- 匹配选中对象依赖 object-id 颜色编码,而不是额外的 stencil 或 instance mask。
- 样式对象本身不做合法性校验,调用方仍需对宽度和颜色取值负责。
## 相关文档
- [BuiltinObjectIdOutlinePass](../BuiltinObjectIdOutlinePass/BuiltinObjectIdOutlinePass.md)
- [SceneViewportRenderPlan](../../../Editor/Viewport/SceneViewportRenderPlan/SceneViewportRenderPlan.md)
- [Passes](../Passes.md)