docs: explain Tessera modules and execution flows in Chinese
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
//! 有界屏幕网格,用来减少普通二维命中和相机目标查询的候选。
|
||||
//! 巨大对象和 3D 面板进入后备集合,再由精确命中判断;索引预算不足不能导致遗漏目标。反序列化或索引长度不匹配时可退回完整候选。
|
||||
//!
|
||||
//! Bounded screen-space broad phase. Projective world UI uses the precise
|
||||
//! ray-based narrow phase rather than an unsafe screen rectangle approximation.
|
||||
use crate::{document::MountGeometry, geometry::Point};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
/// 有限屏幕格子和后备集合。候选筛选允许保守多取,但不能因索引预算漏掉有效命中。
|
||||
pub struct Index {
|
||||
count: usize,
|
||||
cells: HashMap<(i32, i32), Vec<usize>>,
|
||||
fallback: Vec<usize>,
|
||||
}
|
||||
impl Index {
|
||||
/// 根据当前输入构造本模块的派生结果,具体的验证与资源边界见函数内步骤。
|
||||
pub fn build(mounts: &[MountGeometry]) -> Self {
|
||||
let mut result = Self {
|
||||
count: mounts.len(),
|
||||
@@ -66,6 +71,7 @@ impl Index {
|
||||
}
|
||||
result
|
||||
}
|
||||
/// 返回当前网格格子与后备集合中的候选,去重并恢复逆绘制顺序。
|
||||
pub fn candidates(&self, point: Point, count: usize) -> Vec<usize> {
|
||||
if self.count != count {
|
||||
return (0..count).rev().collect();
|
||||
@@ -79,6 +85,7 @@ impl Index {
|
||||
output
|
||||
}
|
||||
}
|
||||
/// 把屏幕坐标映射到有界整数网格坐标,处理负方向与极端数值。
|
||||
fn cell(value: f32) -> i32 {
|
||||
(value / 128.)
|
||||
.floor()
|
||||
|
||||
Reference in New Issue
Block a user