數據類型:枚舉與結構體
LCC Unity SDK 對外公開的枚舉與結構體,供 LCCManager 與 Renderer 的方法使用。
枚舉
PlatformType
目標運行平台。用於 SetPlatformType()。
public enum PlatformType { PC, Mac, Android, iOS, Pico, Quest, AVP, PicoSwan, OpenXR, PCVR }
ActiveRenderMode
全局渲染架構模式。用於 SwitchRenderPass()。
public enum ActiveRenderMode { MultiRender, SingleRender }
| 值 | 說明 |
|---|---|
MultiRender | 使用共享 GPU Buffer,可同時渲染最多 255 個 Renderer |
SingleRender | 由 SDK 根據數據量自動選擇渲染路徑 |
僅 PC / Mac 平台適用;移動端 / VR 平台自動採用適配策略,調用
SwitchRenderPass()會被拒絕。
SourceType
數據來源類型。由 Renderer.GetSourceType() 返回。
public enum SourceType { LCC, PLY, SPLAT, TYY, None, SOG, SPZ, KSPLAT }
DataType
數據格式類型。由 Renderer.GetDataType() 返回。
public enum DataType { L1, L2, L2Pro, K1, K2, Drone, Drone_L2, PortalCam, None }
MipMode
Mip 渲染模式。用於 SetMipMode()。
public enum MipMode { Mip, Non_Mip }
| 值 | 說明 |
|---|---|
Mip | 使用 mipmap 採樣(默認) |
Non_Mip | 禁用 mipmap,渲染細節更好但性能開銷更高 |
SnapType
吸附類型。用於 HitResult.snapType 與 SnapPreviewState.snapType。
public enum SnapType { None, Edge, Corner }
SelectionMode
節點篩選策略。用於 SetSelectionMode()。
public enum SelectionMode { Auto, Normal, Large }
| 值 | 說明 |
|---|---|
Auto | 根據場景整體包圍盒自動決策(默認) |
Normal | 適用於中小場景 |
Large | 適用於超大場景(1000 米以上) |
RenderMode
點雲 / 3DGS 渲染模式。用於 SwitchRenderMode()。
public enum RenderMode { PointCloud, LCCGS }
| 值 | 說明 |
|---|---|
PointCloud | 點雲渲染 |
LCCGS | 3DGS 渲染 |
SelectMode
選區取捨模式。用於 Data2D、Data3D 等選區數據。
public enum SelectMode { normal, invert, clip }
OperationMode
多幾何體布爾運算模式。用於 Data3D、DataMix 等選區數據。
public enum OperationMode { normal = 0, erase = 1 }
| 值 | 說明 |
|---|---|
normal | 並集 |
erase | 差集 |
EditType
混合選區中的條目類型。用於 DataMix、ToneMix。
public enum EditType { Edit2D, Edit3D }
ShapeType
3D 裁切 / 高亮幾何體類型。用於 Data3D、DataMix、ToneMix。
public enum ShapeType { box, sphere }
結構體
HitResult
射線檢測命中結果。由 Raycast()、RaycastMesh()、RaycastWithSnap() 返回。
public struct HitResult {
public bool isHit; // 是否命中
public float distance; // 距離
public Vector3 hitPos; // 命中點世界座標
public Vector3 normal; // 命中法線
public float hitAlpha; // 被擊中橢球的 Alpha
public float dist2Origin; // 到射線源的距離
public float scale; // 橢球 scale
public SnapType snapType; // 吸附類型(None / Edge / Corner)
public Vector3 originalHitPos; // 吸附前原始命中點
}
命中點世界座標字段名為
hitPos。
SnapPreviewState
吸附預覽狀態。由 GetSnapPreviewState() 返回。
public struct SnapPreviewState {
public bool hasTarget; // 是否有吸附目標
public SnapType snapType; // None / Edge / Corner
public Vector2 screenPos; // 吸附目標屏幕座標
public float distanceToMouse; // 到鼠標位置的像素距離
}
screenPos是屏幕座標(像素),不是世界座標。需要世界座標時請用 RaycastWithSnap() 取HitResult.hitPos。
Data2D
2D 紋理投影選區。用於 2D 紋理裁切 / 高亮。
public struct Data2D {
public Texture2D texture; // R8 1024x1024 蒙版紋理
public Matrix4x4 mv; // ModelView 矩陣
public Matrix4x4 mvp; // ModelViewProjection 矩陣
public SelectMode mode; // normal / invert
}
Data3D
3D 幾何體選區。用於 3D 幾何體裁切 / 高亮。
public struct Data3D {
public ShapeType type; // box / sphere
public Matrix4x4 invMat; // 幾何體逆變換矩陣
public OperationMode operation; // normal=並集, erase=差集
public SelectMode mode; // normal / invert / clip
}
DataMix
2D + 3D 混合選區。用於混合模式裁切 / 高亮。
public struct DataMix {
public EditType editType; // Edit2D / Edit3D
public ShapeType type; // 3D 幾何體類型
public Matrix4x4 invMat; // 3D 逆變換矩陣
public Texture2D texture; // 2D 蒙版紋理
public Matrix4x4 mv; // 2D ModelView
public Matrix4x4 mvp; // 2D MVP
public OperationMode operation;
public SelectMode mode;
}
ToneMix
調色選區,在 DataMix 基礎上增加調色參數。用於 SetTone()。
public struct ToneMix {
public EditType editType; // Edit2D / Edit3D
public ShapeType type; // 3D 幾何體類型
public Matrix4x4 invMat; // 3D 逆變換矩陣
public Texture2D texture; // 2D 蒙版紋理
public Matrix4x4 mv; // 2D ModelView
public Matrix4x4 mvp; // 2D MVP
public OperationMode operation;
public SelectMode mode;
public float brightness; // 亮度(默認 1.0)
public float saturation; // 飽和度(默認 1.0)
public float contrast; // 對比度(默認 1.0)
public int lutid; // LUT 濾鏡索引(0=不使用)
}
PointLightData
自定義點光源 / 聚光燈數據。用於 SetLights()。
public struct PointLightData {
public float3 position; // 世界座標
public int lightType; // 0=點光源, 1=聚光燈
public float3 color; // rgb 顏色(無 alpha 分量)
public float intensity; // 光照強度
public float3 direction; // 聚光燈朝向(點光源忽略)
public float range; // 光照範圍
public float spotAngle; // 聚光燈錐角(度,點光源忽略)
public float3 pad; // 對齊填充,無需賦值
}
字段類型為
Unity.Mathematics.float3,不是Vector4;color不含 alpha 分量。lightType為0時是點光源(忽略direction/spotAngle),為1時是聚光燈。
DecalOcclusionSettings
貼花遮擋剔除質量參數。用於 SetDecalOcclusionSettings()。
public struct DecalOcclusionSettings {
public float opacityCutoff; // [0,1] splat 參與深度圖的最低 opacity,默認 0(全部參與)
public float depthBias; // 相對深度容差比例,默認 0.05
public int footprintMaxPx; // 方形足跡半徑上限(px),0~16,默認 2
public int resolution; // 深度圖分辨率(px,2 的冪,256~4096),默認 1024
public static DecalOcclusionSettings Default { get; } // cutoff=0, bias=0.05, footprint=2, resolution=1024
}
| 字段 | 說明 |
|---|---|
opacityCutoff | 只有不透明度 ≥ 此值的 splat 參與深度圖,可濾掉漂浮 / 霧狀 splat。默認 0(全部參與)。 |
depthBias | 相對深度容差比例,按距離成比例吸收點雲表面厚度。默認 0.05。過小會出現自遮擋噪點,過大會漏擋。 |
footprintMaxPx | 保守方形足跡半徑上限(像素),用於蓋滿鄰域、避免穿透漏染。0 為單紋素,範圍 0~16,默認 2。過大會導致輪廓外擴、過遮擋。 |
resolution | 深度圖分辨率(像素,2 的冪,256~4096)。調低可填補稀疏空洞,代價是遮擋邊界略糙。默認 1024。 |
SplatMeta
3DGS 數據的元信息。由 Renderer.GetMeta() 輸出,包含數據來源(source)、數據格式(dataType)等元數據,可在不完整加載數據的情況下讀取。
LCCMeshBlockInfo
碰撞 Mesh 分塊元信息。由 Renderer.GetMeshBlockInfos() 返回。
public struct LCCMeshBlockInfo {
public string id; // 節點 id,與 LCCMeshBlock.id 對應
public Bounds boundsWorld; // 世界空間 AABB,用於挑選 id
public Bounds boundsLocal; // 本地空間 AABB
public int vertexCount; // 頂點數
public int faceCount; // 面數
}
| 字段 | 類型 | 說明 |
|---|---|---|
id | string | 節點 id,與 LCCMeshBlock.id 對應 |
boundsWorld | Bounds | 世界空間 AABB,用於挑選 id |
boundsLocal | Bounds | 本地空間 AABB |
vertexCount | int | 頂點數 |
faceCount | int | 面數 |
LCCMeshBlock
碰撞 Mesh 分塊幾何數據。由 Renderer.GetMeshes() 返回。
public struct LCCMeshBlock {
public string id; // 節點 id
public Vector3[] vertices; // 頂點,本地座標系
public int[] triangles; // 三角形索引,每 3 個一組
public Bounds boundsLocal; // 與 vertices 同空間的包圍盒
}
| 字段 | 類型 | 說明 |
|---|---|---|
id | string | 節點 id |
vertices | Vector3[] | 頂點數組,物體本地座標系 |
triangles | int[] | 三角形索引,每 3 個一組 |
boundsLocal | Bounds | 與 vertices 同空間的包圍盒 |
vertices/boundsLocal都在物體本地座標系,把承載 Mesh 的 GameObject 掛到Renderer.Transform之下即可自動對齊。單塊頂點數可超過 65535,自建 Mesh 前必須設置mesh.indexFormat = IndexFormat.UInt32。