查看器字节来源注明引用必须稳定
- Model3DViewerSource 的 bytes 分支补充 buffer 生命周期与稳定引用要求 - 说明同内容换新引用会触发场景重建与 GPU 重传的后果
This commit is contained in:
@@ -9,6 +9,14 @@ export type Model3DViewerSource =
|
||||
* 调用方已知格式时给出;不传就由加载流程按「声明类型 → 字节魔数 → 地址扩展名」判定。
|
||||
*/
|
||||
| { kind: 'url'; url: string; format?: Model3DViewerFormat }
|
||||
/**
|
||||
* 直接给模型字节;调用方负责持有并与生命周期一致地释放这份 buffer。
|
||||
*
|
||||
* **引用必须稳定**:查看器的加载 effect 依赖 `data` 的对象引用,只比对内容。
|
||||
* 父层每次渲染都新建一份同内容的 ArrayBuffer 会触发「销毁旧场景 → 重新解析 →
|
||||
* 重新上传 GPU」,表现为闪烁与资源抖动;因此请在父层缓存 buffer,或只在内容
|
||||
* 真的变化时才换新引用。
|
||||
*/
|
||||
| { kind: 'bytes'; data: ArrayBuffer; format?: Model3DViewerFormat };
|
||||
|
||||
export const MODEL3D_VIEWER_SUPPORTED_FORMATS: readonly Model3DViewerFormat[] =
|
||||
|
||||
Reference in New Issue
Block a user