Render.h
Source/MassBattle/Public/Fragments/Render.h
概述 Overview
渲染相关的 fragment 集合,覆盖 Agent / FX / 弹道 / 掉落四类实体的视觉层数据。配置与运行时状态分离是统一模式:FVisualize 是 Agent 的视觉配置(渲染器类、Actor 类、网格变换、插值参数),FVisualizing 是其逐帧运行时状态(插值、动画帧、材质特效、溶解、血条);FFxVisualizing / FProjectileVisualizing / FLootVisualizing 分别是 FX / 弹道 / 掉落实体的轻量渲染 fragment,使附加 FX 跟随父级的插值变换。另有跨端共用的 CPU 预测插值基础件 FInterpParams(参数)、FHostRenderInterpState(状态)与自由函数 ComputeAngVelFromRotationDelta。
Render-related fragment collection covering visual-layer data for four entity kinds: agents, FX, projectiles and loot. Config/runtime-state separation is the uniform pattern: FVisualize holds the agent's visual config (renderer class, actor class, mesh transform, interp params) while FVisualizing holds per-frame runtime state (interpolation, anim frames, material FX, dissolve, health bar); FFxVisualizing / FProjectileVisualizing / FLootVisualizing are lightweight render fragments for FX / projectile / loot entities so attached FX follow the parent's interpolated transform. Shared CPU prediction/interp primitives FInterpParams (params), FHostRenderInterpState (state) and the free function ComputeAngVelFromRotationDelta are also defined here.
FInterpParams USTRUCT
统一的插值参数集合,同时被 FVisualize、FHostRenderInterpState::Tick 与渲染批次数据使用。四个参数共同决定"跟随真值"的平滑方式:速度插值 + 速度外推 + 超距瞬切。
Unified interpolation parameter set, used by FVisualize, FHostRenderInterpState::Tick and the render batch data. The four parameters together define how the render layer follows ground truth: speed smoothing + velocity extrapolation + snap on large jumps.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bInterpEnabled | bool | true | 是否启用插值平滑。Enable interpolation smoothing. |
InterpSpeed | float | 0.f | 每帧平滑插值速度(<=0 禁用,通常 5-15)。Interpolation speed for per-frame smoothing (<=0 to disable, typical 5-15). |
PredictTime | float | 0.f | 使用速度向前预测的秒数(0 = 不预测)。Seconds ahead to predict using velocity (0 = no prediction). |
SnapDist | float | 0.f | 距离真值超过该值时立即对齐(瞬切,0 = 永不对齐)。Snap to ground truth if the distance exceeded (0 = never snap). |
方法 Methods
插值是否生效:bInterpEnabled 为 true 且 InterpSpeed > 0.f。控制 FHostRenderInterpState::Tick 走平滑分支还是直通分支。
Whether interpolation is active: bInterpEnabled is true AND InterpSpeed > 0.f. Governs whether FHostRenderInterpState::Tick takes the smoothing branch or the pass-through branch.
Input
无参数。
No parameters.
Output
返回两字段的与运算结果;无副作用。
Returns the AND of the two fields; no side effects.
四个字段逐一相等比较,用于配置相等性判断。
Field-by-field equality comparison of all four members.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Other | const FInterpParams& | 待比较的插值参数。The interp params to compare against. |
Output
四字段全等返回 true;无副作用。
Returns true when all four fields match; no side effects.
FHostRenderInterpState Plain struct
CPU 侧预测 + 插值状态(非 USTRUCT),组件与宿主子系统路径共用。预测数学与 GPU HLSL 一致:GTLoc + Vel × PredictTime 外推后以 VInterpTo 平滑。每次槽位复用 / 宿主重建时用 Reset() 清空。
CPU-side prediction + interp state (not a USTRUCT), reusable across component and host-subsystem paths. The prediction math matches the GPU HLSL: extrapolate via GTLoc + Vel × PredictTime, then smooth with VInterpTo. Call Reset() on slot reuse or host rebuild.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
InterpLocation | FVector | ZeroVector | 当前插值位置。Current interpolated location. |
InterpRotation | FQuat | Identity | 当前插值旋转。Current interpolated rotation. |
InterpScale | FVector | OneVector | 当前插值缩放。Current interpolated scale. |
bInterpInitialized | bool | false | 首次 Tick 时置 true(首帧直接对齐真值,不插值)。Set true on the first Tick (first frame aligns to ground truth directly, no interpolation). |
方法 Methods
每引擎帧调用一次,计算预测 + 插值后的变换。实现位于 MassBattleFuncLib.cpp。分支:① IsEnabled() 为 false 或未初始化 → 直接对齐真值并标记初始化;② 启用后先做 SnapDist 瞬切(仅位置,距离平方 > SnapDist 平方);③ 外推——位置 GT + LinearVel × PredictTime,旋转按角速度轴角向量旋转 AngVel × PredictTime;④ 以 InterpSpeed 向预测目标 VInterpTo / QInterpTo 平滑(缩放无外推,直接向 GT 平滑)。
Call every engine frame; computes the predicted+interpolated transform. Implementation lives in MassBattleFuncLib.cpp. Branches: ① IsEnabled() false or not initialized → align to ground truth directly and mark initialized; ② when enabled, SnapDist teleports the location when distance² exceeds SnapDist²; ③ extrapolate — location GT + LinearVel × PredictTime, rotation advanced by the angular velocity axis-angle vector times PredictTime; ④ smooth toward the predicted target with VInterpTo / QInterpTo at InterpSpeed (scale has no extrapolation, smoothed toward GT directly).
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
GTLocation | const FVector | 最近一次逻辑 tick 的真值位置(GT = ground truth)。Ground-truth location from the most recent logic tick. |
GTRotation | const FQuat | 真值旋转。Ground-truth rotation. |
GTScale | const FVector | 真值缩放。Ground-truth scale. |
LinearVel | const FVector | 世界空间线速度(外推用)。World-space linear velocity (for extrapolation). |
AngVel | const FVector | 角速度轴角向量,弧度/秒(旋转外推用)。Angular velocity axis-angle vector in rad/s (for rotational extrapolation). |
Params | const FInterpParams | 插值参数(启用 / 速度 / 预测 / 瞬切)。Interpolation parameters (enable / speed / predict / snap). |
EngineDeltaTime | float | 引擎帧 delta,非逻辑步长 delta。Engine-frame delta, NOT logic-step delta. |
Output
返回合成变换 FTransform(InterpRotation, InterpLocation, InterpScale)。副作用:写入 InterpLocation / InterpRotation / InterpScale 三个状态成员,并可能置位 bInterpInitialized。
Returns the composed FTransform(InterpRotation, InterpLocation, InterpScale). Side effects: writes the InterpLocation / InterpRotation / InterpScale state members and may set bInterpInitialized.
复位全部状态:插值位置归零、旋转归单位、缩放归一、初始化标志清除。
Resets all state: location to zero, rotation to identity, scale to one, initialization flag cleared.
Input
无参数。
No parameters.
Output
无返回值。副作用:全部成员复位。
No return value. Side effect: all members reset.
ComputeAngVelFromRotationDelta Free function
自由函数(FORCEINLINE):从逻辑帧间旋转差计算角速度(轴角,弧度/秒)。旋转未变时直接返回缓存值(不更新时间戳)。首次调用时 InOutLastChangeTime <= 0,回退用固定 0.033 秒假设。
Free function (FORCEINLINE): computes angular velocity (axis-angle, rad/s) from the rotation delta between logic ticks. Returns the cached value when the rotation hasn't changed (no timestamp update). On first call InOutLastChangeTime <= 0, so a fixed 0.033 s assumption is used.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
CurrentRot | const FQuat | 当前帧旋转。Current rotation. |
InOutPrevRot | FQuat& | 上一帧旋转(输入输出,函数内更新为 CurrentRot)。Previous rotation (in/out; updated to CurrentRot inside). |
InOutLastChangeTime | double& | 上次旋转变化的墙钟时间(输入输出,旋转变化时更新)。Wall-clock time of the last rotation change (in/out; updated when the rotation changes). |
InOutAngVel | FVector& | 角速度缓存(输入输出,旋转未变时直接返回)。Angular velocity cache (in/out; returned as-is when the rotation is unchanged). |
Output
返回计算得到(或缓存)的轴角角速度向量。副作用:可能更新 InOutPrevRot / InOutLastChangeTime / InOutAngVel 三个引用参数。
Returns the computed (or cached) axis-angle angular velocity vector. Side effects: may update the three reference parameters InOutPrevRot / InOutLastChangeTime / InOutAngVel.
FFxVisualizing USTRUCT
FX 实体的渲染 fragment(FA_MassBattleBaseFragment 派生)——附加 FX 跟随父级 Agent 的插值变换。字段分五组:批次身份(InstanceId / RenderBatchId / RendererActor / UniqueID)、Niagara 唯一身份(NiagaraIdIndex / NiagaraAcquireTag,由 UMassBattleFxRenderProcessor::AllocateFxRenderId 在槽位获取时分配)、父级附加状态(ParentEntity / RelativeTransform / FxScale)、父级真值快照(ParentGTLoc 等,由 HostMonoProcessor 每帧填入,FxRenderProcessor 直接读取不再碰父级 fragment)、事件时刻锚点(EventParentLoc 等,生成请求时捕获、激活时拷入,仅注册分支消费)。多数字段带 UPROPERTY() 注释「快照注册表字段」,参与网络快照同步。含位域成员,经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明。
Render fragment for FX entities (derived from FA_MassBattleBaseFragment) — attached FX follow the parent agent's interpolated transform. Fields fall into five groups: batch identity (InstanceId / RenderBatchId / RendererActor / UniqueID), Niagara identity (NiagaraIdIndex / NiagaraAcquireTag, assigned by UMassBattleFxRenderProcessor::AllocateFxRenderId at slot acquisition), parent attachment state (ParentEntity / RelativeTransform / FxScale), parent ground-truth snapshot (ParentGTLoc etc., filled every frame by the HostMonoProcessor so the FxRenderProcessor reads without touching parent fragments), and event-time anchor (EventParentLoc etc., captured at the spawn request, copied in at activation, consumed only by the registration branch). Most fields are marked UPROPERTY() as snapshot-registry fields. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE (contains bitfield members).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
InstanceId | int32 | -1 | 渲染批次中的实例 ID。Instance ID in the render batch. |
RenderBatchId | int32 | -1 | 渲染批次 ID。Render batch ID. |
RendererActor | TObjectPtr<AActor> | nullptr | 渲染器 Actor。Renderer actor. |
UniqueID | int32 | -1 | 稳定的唯一 ID,用于句柄↔ID 映射,实体创建时设置,池复用时持久化。Stable unique ID for handle↔ID mapping, set at entity creation, persists across pool reuse. |
NiagaraIdIndex | int32 | -1 | 渲染专用 Niagara 身份索引(视为 Epoch)。-1 哨兵保证 AllocateFxRenderId 分配 (0,1) 时首帧必跳变。非 UPROPERTY。Render-only Niagara identity index (Epoch). -1 sentinel guarantees first-frame snap when AllocateFxRenderId assigns (0,1). Not a UPROPERTY. |
NiagaraAcquireTag | int32 | -1 | 渲染专用 Niagara 身份计数(Counter)。与 NiagaraIdIndex 组成不重复对,独立于 FX/宿主实体池化,推送给 NS 组合唯一 NiagaraID 供复用跳变检测 + RibbonID。非 UPROPERTY。Render-only Niagara identity counter. Forms a never-repeating pair with NiagaraIdIndex, independent of FX/host entity pooling; pushed to the NS to compose a unique NiagaraID for snap-on-reuse detection and RibbonID. Not a UPROPERTY. |
ParentEntity | FMassEntityHandle | — | 附加 FX 的父级实体(快照注册表字段)。Parent agent entity for attached FX (snapshot-registry field). |
RelativeTransform | FTransform3f | Identity | 父级相对变换偏移(仅位置/旋转,缩放单独处理)。Relative transform offset from the parent (location/rotation only; scale handled separately). |
FxScale | float | 1.f | FX 专属缩放(仅影响粒子大小,不影响相对偏移)。FX-specific scale (affects particle size only, NOT the relative offset). |
ParentGTLoc | FVector | ZeroVector | 父级真值位置(HostMonoProcessor 每帧填入)。Parent ground-truth location (filled per frame by the HostMonoProcessor). |
ParentGTRot | FQuat4f | Identity | 父级真值朝向。Parent ground-truth rotation. |
ParentVel | FVector3f | ZeroVector | 父级速度,供 GPU 外推。父级丢失或无 FMoving(弹道/掉落)时为零。Parent velocity for GPU extrapolation. Zero when the parent is gone or has no FMoving (projectiles/loot). |
ParentAngularVelocity | FVector3f | ZeroVector | 父级角速度(弧度/秒),供 GPU 旋转外推。Parent angular velocity (rad/s) for GPU rotational extrapolation. |
ParentInterpParams | FVector4f | Zero | 父级插值参数 (InterpSpeed, PredictTime, SnapDist, bEnabled?1:0),供 GPU 平滑。Parent interp params (InterpSpeed, PredictTime, SnapDist, bEnabled?1:0) for GPU smoothing. |
ParentGTScale | FVector3f | OneVector | 父级缩放(来自 FScaling,默认 1),用于偏移+缩放组合。Parent scale from FScaling (default 1) for offset+scale composition. |
EventParentLoc | FVector | ZeroVector | 事件时刻锚点:父级世界位置——生成请求时(出生/死亡时刻)捕获、激活时拷入(快照注册表字段)。Event-time anchor: parent world location — captured at the spawn request (birth/death moment) and copied in at activation (snapshot-registry field). |
EventParentRot | FQuat4f | Identity | 事件时刻锚点:父级世界朝向(快照注册表字段)。Event-time anchor: parent world rotation (snapshot-registry field). |
EventWorldLoc | FVector | ZeroVector | 事件时刻锚点:FX 自身世界位置(burst/非附着)(快照注册表字段)。Event-time anchor: the FX's own world location (burst/non-attached) (snapshot-registry field). |
EventWorldRot | FQuat4f | Identity | 事件时刻锚点:FX 自身世界朝向(快照注册表字段)。Event-time anchor: the FX's own world rotation (snapshot-registry field). |
bHasEventAnchor | bool | false | 锚点有效(区别于父级位于世界原点)。事件时刻变换仅由 FxRenderProcessor 注册分支消费,使首帧显示诚实的事件位置(锁步确定性渲染晚 1+ tick,注册时实时父级已移动);逐帧更新路径继续用实时 ParentGTLoc/ParentGTRot。渲染层字段:进快照注册表,严禁进 hash。Anchor valid (distinguishes from a parent at the world origin). The event-time transform is consumed ONLY by the FxRenderProcessor registration branch so the first rendered frame shows the honest event position (deterministic lockstep renders 1+ ticks late, and the live parent has already moved by registration); the per-frame update path keeps using the live ParentGTLoc/ParentGTRot. Render-layer field: in the snapshot registry, NEVER folded into hash. |
CachedWorldLocation | FVector | ZeroVector | 缓存的世界位置——父级被销毁时保留最后已知良好位置,防止 FX 在清理前跳回生成点一帧。Cached world location — preserves the last known good position when the parent is destroyed, preventing the FX from jumping to its spawn location for one frame before cleanup. |
CachedWorldRotation | FQuat4f | Identity | 缓存的世界旋转。Cached world rotation. |
CachedWorldScale | FVector3f | OneVector | 缓存的世界缩放。Cached world scale. |
bCacheInitialized | uint8 : 1 | — | 缓存的世界变换已初始化(位域)。Cached world transform initialized (bitfield). |
bCpuInterpMode | bool | false | 宿主为 CPU 插值 → 批次推送 FX 世界变换(旧模型)。普通 bool(非位域)——位域 pad 位不确定会导致 hash 折叠假失步。Host is CPU-interp → batch pushes FX world-space (old model). Plain bool (not bitfield) — bitfield pad bits are indeterminate and would cause false desync in hash folding. |
Flags_Pad | uint8 : 6 | — | 备用位。Spare bits. |
FProjectileVisualizing USTRUCT
弹道实体的轻量渲染 fragment(FA_MassBattleBaseFragment 派生)——使附加 FX 跟随插值变换。目标值(真值)在模拟 tick 更新,当前插值值每帧更新。
Lightweight rendering fragment for projectiles (derived from FA_MassBattleBaseFragment) — enables attached FX to follow the interpolated transform. Target values (ground truth) update on the sim tick; current interpolated values update every frame.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
TargetLocation | FVector | ZeroVector | 目标位置(模拟 tick 更新)。Target location (updated on sim tick). |
TargetRotation | FQuat4f | Identity | 目标旋转。Target rotation. |
TargetScale | FVector3f | OneVector | 目标缩放。Target scale. |
InterpLocation | FVector | ZeroVector | 当前插值位置(每帧更新)。Current interpolated location (updated every frame). |
InterpRotation | FQuat4f | Identity | 当前插值旋转。Current interpolated rotation. |
InterpScale | FVector3f | OneVector | 当前插值缩放。Current interpolated scale. |
CachedVelocity | FVector3f | ZeroVector | 缓存的预测插值速度。UPROPERTY:快照注册表恢复需要(宿主层级解析读取,见 HostMonoProcessor)。Cached velocity for predictive interpolation. UPROPERTY: needed for snapshot-registry restore (host hierarchy resolve reads it — HostMonoProcessor). |
AngularVelocity | FVector3f | ZeroVector | 角速度(弧度/秒,三维轴角向量),供 GPU 旋转预测,由 tick 内旋转增量计算。Angular velocity (rad/s, 3D axis-angle vec) for GPU rotational prediction, from the in-tick rotation delta. |
bInterpInitialized | uint8 : 1 | — | 插值系统已初始化(位域)。Interpolation system initialized (bitfield). |
Flags_Pad | uint8 : 7 | — | 备用位。Spare bits. |
FLootVisualizing USTRUCT
掉落实体的轻量渲染 fragment(FA_MassBattleBaseFragment 派生)——结构、字段语义与 FProjectileVisualizing 完全相同,使附加 FX 跟随掉落的插值变换。
Lightweight rendering fragment for loot (derived from FA_MassBattleBaseFragment) — identical structure and field semantics to FProjectileVisualizing; enables attached FX to follow the loot's interpolated transform.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
TargetLocation | FVector | ZeroVector | 目标位置(模拟 tick 更新)。Target location (updated on sim tick). |
TargetRotation | FQuat4f | Identity | 目标旋转。Target rotation. |
TargetScale | FVector3f | OneVector | 目标缩放。Target scale. |
InterpLocation | FVector | ZeroVector | 当前插值位置(每帧更新)。Current interpolated location (updated every frame). |
InterpRotation | FQuat4f | Identity | 当前插值旋转。Current interpolated rotation. |
InterpScale | FVector3f | OneVector | 当前插值缩放。Current interpolated scale. |
CachedVelocity | FVector3f | ZeroVector | 缓存的预测插值速度。UPROPERTY:快照注册表恢复需要(宿主层级解析读取,见 HostMonoProcessor)。Cached velocity for predictive interpolation. UPROPERTY: needed for snapshot-registry restore (host hierarchy resolve reads it — HostMonoProcessor). |
AngularVelocity | FVector3f | ZeroVector | 角速度(弧度/秒,三维轴角向量),供 GPU 旋转预测,由 tick 内旋转增量计算。Angular velocity (rad/s, 3D axis-angle vec) for GPU rotational prediction, from the in-tick rotation delta. |
bInterpInitialized | uint8 : 1 | — | 插值系统已初始化(位域)。Interpolation system initialized (bitfield). |
Flags_Pad | uint8 : 7 | — | 备用位。Spare bits. |
FVisualize USTRUCT
逐 Agent 视觉配置 fragment(FA_MassBattleBaseFragment 派生):渲染器类、Actor 类、网格变换、插值参数。LOD 现位于 FLODShared(LOD.h)。配置经 EntityConfig 注入后运行时不变。
Per-agent visual config fragment (derived from FA_MassBattleBaseFragment): renderer class, actor class, mesh transform, interpolation params. LOD now lives in FLODShared (LOD.h). Config is injected via EntityConfig and constant at runtime.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用渲染。Enable rendering. |
Transform | FTransform3f | Identity | 网格变换偏移(位置、旋转、缩放)。Mesh transform offset (location, rotation, scale). |
InterpParams | FInterpParams | — | 每帧平滑插值参数。Interpolation parameters for per-frame smoothing. |
RendererClass | TSoftClassPtr<AMassBattleAgentRenderer> | — | NS 渲染器类(编辑器显示名 "Particle Renderer Class")。Renderer class (editor display name "Particle Renderer Class"). |
SoftBindingActorClass | TSoftClassPtr<AActor> | — | Actor 表示类(编辑器显示名 "Actor Representaion Class")。Actor representation class (editor display name "Actor Representaion Class"). |
CullDistance | float | 0.f | 超过此相机距离时收回渲染槽位且不发送渲染数据(0 = 不剔除)。端本地渲染层决策。Release the render slot and send no render data beyond this camera distance (0 = never cull). Peer-local render-layer decision. |
方法 Methods
逐字段比较:启用标志、Transform 的旋转/位置/缩放(各用 Equals)、插值参数、两个软类指针与 CullDistance。
Field-by-field comparison: enable flag, Transform rotation/location/scale (each via Equals), interp params, both soft class pointers, and CullDistance.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Other | const FVisualize& | 待比较的视觉配置。The visual config to compare against. |
Output
全部字段相等返回 true;无副作用。
Returns true when all fields match; no side effects.
FVisualizing USTRUCT
逐 Agent 渲染运行时状态 fragment(FA_MassBattleBaseFragment 派生):插值、动画播放、材质特效、溶解、血条。由 MassBattleAgentRenderProcessor 每帧更新;位域标志紧凑打包以优化缓存行。含多个 TArray-free 的纯标量成员,经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明。
Per-agent rendering runtime state fragment (derived from FA_MassBattleBaseFragment): interpolation, animation playback, material FX, dissolve, health bar. Updated per frame by MassBattleAgentRenderProcessor; bitfield flags are packed for cache-line efficiency. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
InstanceId | int32 | -1 | 粒子表示:渲染批次实例 ID。Particle representation: instance ID. |
RenderBatchId | int32 | -1 | 渲染批次 ID。Render batch ID. |
RendererActor | TObjectPtr<AActor> | nullptr | 渲染器 Actor(编辑器显示名 "ParticleRendererActor")。Renderer actor (editor display name "ParticleRendererActor"). |
CurrentLOD | int32 | -1 | 当前渲染使用的 LOD 索引。Current LOD index being used for rendering. |
CurrentRepresentation | ERepresentationMode | Particle | 当前表现模式(粒子 / Actor)。Current representation mode (Particle/Actor). |
PreviousRepresentation | ERepresentationMode | Particle | 上一帧的表现模式,用于过渡检测。Previous frame representation mode, for transition detection. |
BindingActorPtr | TObjectPtr<AActor> | — | Actor 表示:绑定的 Actor 指针。Actor representation: pointer to the bound actor. |
BindingActorClassPtr | TSubclassOf<AActor> | nullptr | 绑定 Actor 的类指针。Class pointer of the bound actor. |
BindingComponentPtr | TObjectPtr<UMassBattleAgentComponent> | nullptr | 绑定的组件指针。Pointer to the bound component. |
bIsBindingActorSwappable | uint8 : 1 | — | LOD 系统是否可替换该 Agent。Whether the LOD system can swap this agent. |
CachedLoop0/1/2 | uint8 : 1 ×3 | — | 三个动画槽缓存的循环标志。Cached animation loop flags for slots 0/1/2. |
bInterpInitialized | uint8 : 1 | — | 插值系统已初始化。Interpolation system initialized. |
bLastMoveDirReversed | uint8 : 1 | — | 上一 tick 的移动方向乘数符号——检测翻转。Previous tick's MoveDirectionMultiplier sign — detects flips. |
bNoFrameExtrap | uint8 : 1 | — | 反向/抖动时关闭 GPU 帧外推(用 raw CPU 帧)。Suppress GPU frame extrapolation (raw CPU frame) during reverse/wobble. |
bMeshCulled | uint8 : 1 | — | mesh 剔除锁存:Agent 当前超出 FVisualize::CullDistance——槽位已收回,不发送数据。Mesh cull latch: agent currently beyond FVisualize::CullDistance — slot released, no data sent. |
Flags_Pad | uint8 : 1 | — | 备用位。Spare bit. |
TargetLocation | FVector | ZeroVector | 每帧插值状态:目标位置。Per-frame interp state: target location. |
TargetRotation | FQuat4f | Identity | 目标旋转。Target rotation. |
TargetFacingRotation | FQuat4f | Identity | parent+relative 模型的父级旋转;角速度取自其增量(非 TargetRotation 增量)。Parent rot for the parent+relative model; angular velocity derived from its delta (not the TargetRotation delta). |
TargetScale | FVector3f | OneVector | 目标缩放。Target scale. |
InterpLocation | FVector | ZeroVector | 当前插值位置。Current interpolated location. |
InterpRotation | FQuat4f | Identity | 当前插值旋转。Current interpolated rotation. |
InterpScale | FVector3f | OneVector | 当前插值缩放。Current interpolated scale. |
CachedVelocity | FVector3f | ZeroVector | 缓存速度(预测外推用)。Cached velocity (for predictive extrapolation). |
CachedAngularVelocity | FVector3f | ZeroVector | 3D 角速度(弧度/秒,轴角),取自渲染旋转增量,供 GPU 旋转预测。3D angular velocity (rad/s, axis·angle) from the rendered-rotation delta, for GPU rotational prediction. |
TargetFrame0/1/2 | float ×3 | 0.f | 目标动画帧值(三槽)。Target animation frame values (3 slots). |
TargetLerp0/1 | uint8 ×2 | 0 | 目标动画插值系数。Target animation lerp factors. |
InterpFrame0/1/2 | float ×3 | 0.f | 每帧插值的动画帧值。Per-frame interpolated animation frame values. |
InterpLerp0/1 | uint8 ×2 | 0 | 每帧插值的动画插值系数。Per-frame interpolated animation lerp factors. |
CachedPlayRate0/1/2 | float ×3 | 1.f | 模拟 tick 间帧推进缓存的播放速率。Cached play rates for frame advancement between sim ticks. |
CachedSampleRate | int32 | 30 | 缓存的采样率。Cached sample rate. |
CachedStartFrame0-2 / CachedEndFrame0-2 | uint16 ×6 | 0 | 三个动画槽缓存的循环起止帧。Cached loop boundaries (start/end frames) for the three anim slots. |
FrameExtrapCooldown | float | 0.f | 帧外推抑制冷却:MoveDirectionMultiplier 翻转时置位;期间 GPU 用 raw CPU 帧(不外推),避免反向/抖动移动动画过冲回弹。Frame-extrap suppression cooldown: set when MoveDirectionMultiplier flips; while >0 the GPU uses the raw CPU frame (no extrapolation) so reversing/wobbling move anims don't overshoot-snap. |
TargetIceFx / TargetFireFx / TargetPoisonFx / TargetHitGlow | uint8 ×4 | 0 | 材质特效目标值(冰冻/火焰/中毒/受击高亮)。Material FX target values (ice/fire/poison/hit glow). |
InterpIceFx / InterpFireFx / InterpPoisonFx / InterpHitGlow | uint8 ×4 | 0 | 材质特效插值值。Material FX interpolated values. |
TargetDissolve / InterpDissolve | uint8 ×2 | 0 | 溶解插值的目标值与当前值。Dissolve interpolation target and current values. |
TargetHBCurrentRatio / TargetHBTargetRatio | float ×2 | 0.f | 血条比例插值目标值(当前/目标)。Health-bar ratio interpolation targets (current/target). |
InterpHBCurrentRatio / InterpHBTargetRatio | float ×2 | 0.f | 血条比例插值当前值。Health-bar ratio interpolated values. |
管线角色 Pipeline Role
在 MassBattle 管线中的位置:FVisualize / FVisualizing 由 MassBattleAgentRenderProcessor 读写(插值、批次推送、LOD/表示模式切换),MassBattleHostMonoProcessor 经快照注册表恢复渲染状态,MassBattleAgentTraceProcessor / MassBattleAgentBehaviorProcessor 读取。FFxVisualizing / FProjectileVisualizing / FLootVisualizing 分别由 MassBattleFxRenderProcessor / MassBattleProjectileMonoProcessor / MassBattleLootMonoProcessor 消费,父级真值由 MassBattleHostMonoProcessor 的 FX 段每帧填入;FHostRenderInterpState::Tick 的实现在 MassBattleFuncLib.cpp,被组件与宿主子系统路径共用。
Position in the MassBattle pipeline: FVisualize / FVisualizing are read/written by MassBattleAgentRenderProcessor (interpolation, batch push, LOD/representation switching); MassBattleHostMonoProcessor restores render state via the snapshot registry; MassBattleAgentTraceProcessor / MassBattleAgentBehaviorProcessor read them. FFxVisualizing / FProjectileVisualizing / FLootVisualizing are consumed by MassBattleFxRenderProcessor / MassBattleProjectileMonoProcessor / MassBattleLootMonoProcessor, with parent ground truth filled every frame by the FX section of MassBattleHostMonoProcessor. FHostRenderInterpState::Tick is implemented in MassBattleFuncLib.cpp and shared by component and host-subsystem paths.