Navigation
API > API/Plugins > API/Plugins/MassLOD
Helper struct to calculate LOD for each agent and maximize count per LOD Requires TViewerInfoFragment fragment collected by the TMassLODCollector. Stores information in TLODFragment fragment.
| Name | TMassLODCalculator |
| Type | struct |
| Header File | /Engine/Plugins/Runtime/MassGameplay/Source/MassLOD/Public/MassLODCalculator.h |
| Include Path | #include "MassLODCalculator.h" |
Syntax
template<typename FLODLogic>
struct TMassLODCalculator : public FMassLODBaseLogic
Inheritance Hierarchy
- FMassLODBaseLogic → TMassLODCalculator
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TMassLODCalculator() |
MassLODCalculator.h |
Structs
| Name | Remarks |
|---|---|
| FMassLODRuntimeData |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AdjustDistancesFromCount() |
Adjust LOD distances by clamping them to respect the maximum LOD count @Return true if any LOD distances clamping was done | MassLODCalculator.h | |
void AdjustLODFromCount
(
FMassExecutionContext& Context, |
Adjust LOD from newly adjusted distances, only needed to be called when AdjustDistancesFromCount return true, called for each entity chunks Use this version when FLODLogic::bStoreInfoPerViewer is enabled It calculates a LOD per viewer and needs information per viewer via PerViewerInfoList fragments @Param Context of the chunk execution @Param ViewersInfoList is the source information fragment for LOD calculation @Param LODList is the fragment where calculation are stored @Param PerViewerInfoList is the Per viewer source information | MassLODCalculator.h | |
void AdjustLODFromCount
(
FMassExecutionContext& Context, |
Adjust LOD from newly adjusted distances, only needed to be called when AdjustDistancesFromCount return true, called for each entity chunks Use next method when FLODLogic::bStoreInfoPerViewer is enabled @Param Context of the chunk execution @Param ViewersInfoList is the source information fragment for LOD calculation @Param LODList is the fragment where calculation are stored | MassLODCalculator.h | |
void CalculateLOD
(
FMassExecutionContext& Context, |
Calculate LOD, called for each entity chunks Use next method when FLODLogic::bStoreInfoPerViewer is enabled @Param Context of the chunk execution @Param ViewersInfoList is the source information fragment for LOD calculation @Param LODList is the fragment where calculation are stored | MassLODCalculator.h | |
void CalculateLOD
(
FMassExecutionContext& Context, |
Calculate LOD, called for each entity chunks Use this version when FLODLogic::bStoreInfoPerViewer is enabled It calculates a LOD per viewer and needs information per viewer via PerViewerInfoList fragments @Param Context of the chunk execution @Param ViewersInfoList is the source information fragment for LOD calculation @Param LODList is the fragment where calculation are stored @Param PerViewerInfoList is the Per viewer source information | MassLODCalculator.h | |
void DebugDisplayLOD
(
FMassExecutionContext& Context, |
Debug draw the current state of each agent as a color coded square @Param Context of the chunk execution @Param LODList is the fragment where calculation are stored @Param LocationList is the fragment transforms of the entities @Param World where the debug display should be drawn | MassLODCalculator.h | |
void DebugDisplaySignificantLOD
(
FMassExecutionContext& Context, |
Debug draw the current state of each agent as a color coded square, within MaxLODSignificance range @Param Context of the chunk execution @Param LODList is the fragment where calculation are stored @Param LocationList is the fragment transforms of the entities @Param World where the debug display should be drawn @Param MaxLODSignificance is the max allowed value of LODList[i].LODSignificance for an agent's state to debug draw | MassLODCalculator.h | |
void ForceOffLOD
(
FMassExecutionContext& Context, |
Turn Off all LOD, called for each entity chunks @Param Context of the chunk execution @Param LODList is the fragment where calculation are stored | MassLODCalculator.h | |
float GetMaxLODDistance() |
Return the maximum distance at which the LOD will be turn off | MassLODCalculator.h | |
void Initialize
(
const float InBaseLODDistance, |
Initializes the LOD calculator, needed to be called once at initialization time @Param InBaseLODDistance distances used to calculate LOD @Param InBufferHysteresisOnFOVRatio distance hysteresis used to calculate LOD @Param InLODMaxCount the maximum count for each LOD - Supports nullptr being passed in now and will put INT_MAX everywhere by default @Param InLODMaxCountPerViewer the maximum count for each LOD per viewer (Only when FLODLogic::bMaximizeCountPerViewer is enabled) @Param InVisibleDistanceToFrustum is the distance from the frustum to start considering this entity is visible (Only when FLODLogic::bDoVisibilityLogic is enabled) @Param InVisibleDistanceToFrustumHysteresis once visible, what extra distance the entity need to be before considered not visible anymore (Only when FLODLogic::bDoVisibilityLogic is enabled) @Param InVisibleLODDistance the maximum count for each LOD per viewer (Only when FLODLogic::bDoVisibilityLogic is enabled) | MassLODCalculator.h | |
void PrepareExecution
(
TConstArrayView< FViewerInfo > Viewers |
Prepares execution for the current frame, needed to be called before every execution @Param Viewers is the array of all the known viewers | MassLODCalculator.h | |
void VisLogLOD
(
FMassExecutionContext& Context, |
Add Visual Log entries for the current state of each agent as a color coded location @Param Context of the chunk execution @Param LODList is the fragment where calculation are stored @Param LocationList is the fragment transforms of the entities @Param World where the debug display should be drawn | MassLODCalculator.h | |
void VisLogSignificantLOD
(
FMassExecutionContext& Context, |
Add Visual Log entries for the current state of each agent as a color coded location, within MaxLODSignificance range @Param Context of the chunk execution @Param LODList is the fragment where calculation are stored @Param LocationList is the fragment transforms of the entities @Param World where the debug display should be drawn @Param MaxLODSignificance is the max allowed value of LODList[i].LODSignificance for an agent's state to vislog | MassLODCalculator.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
float AccumulateCountInRuntimeData
(
const EMassLOD::Type LOD, |
MassLODCalculator.h | ||
bool AdjustDistancesFromCountForRuntimeData
(
const TStaticArray< int32, EMassLOD::Max >& MaxCount, |
MassLODCalculator.h | ||
bool CalculateVisibility
(
const bool bWasVisible, |
MassLODCalculator.h | ||
EMassLOD::Type ComputeLODFromSettings
(
const EMassLOD::Type PrevLOD, |
MassLODCalculator.h |