API reference
API reference
Select your platform
No SDKs available
No versions available

AMRUKDistanceMapGenerator Class

Extends AActor
Generates a distance map that can be used in materials to calculate the distance to various objects. This can enable interesting effects. With the distance map you can get the distance from scene objects or walls in a material shader.
The Jump Flood Algorithm is used to generate the distance map. This is fast enough to regenerate every tick.
To capture a distance map after a room has been loaded call CaptureDistanceMap(). It will return a captured distance map. In case you already called CaptureDistanceMap() you can receive the last captured distance map with GetDistanceMap(). No other setup is required.
This class will create procedural meshes for every anchor to create a mask. These meshes have their visibility set to scene capture only. That however means that if you place a scene capture component yourself that the meshes will show up in your scene capture component. The actors that have the procedural meshes attached are tagged with GMRUK_DISTANCE_MAP_ACTOR_TAG. In case you don't want them to show up in your scene capture you can hide them by receiving all these actors with the tag GMRUK_DISTANCE_MAP_ACTOR_TAG and add these to the scene captures hidden actors.

Constructors

AMRUKDistanceMapGenerator ()
Signature
AMRUKDistanceMapGenerator::AMRUKDistanceMapGenerator()

Fields

DistanceMapAllSpaceMaterial : class UMaterialInterface *
Signature
class UMaterialInterface* AMRUKDistanceMapGenerator::DistanceMapAllSpaceMaterial
DistanceMapFreeSpaceMaterial : class UMaterialInterface *
Material to render final distance map
Signature
class UMaterialInterface* AMRUKDistanceMapGenerator::DistanceMapFreeSpaceMaterial
DistanceMapGenerationMode : EMRUKDistanceMapGenerationMode
The mode in which the final distance map should be generated.
Signature
EMRUKDistanceMapGenerationMode AMRUKDistanceMapGenerator::DistanceMapGenerationMode
DistanceMapOccupiedSpaceMaterial : class UMaterialInterface *
Signature
class UMaterialInterface* AMRUKDistanceMapGenerator::DistanceMapOccupiedSpaceMaterial
DistanceMapRenderTarget : class UCanvasRenderTarget2D *
Render target for the final distance map
Signature
class UCanvasRenderTarget2D* AMRUKDistanceMapGenerator::DistanceMapRenderTarget
JFPassMaterial : class UMaterialInterface *
Material that executes a pass of the jump flood algorithm.
Signature
class UMaterialInterface* AMRUKDistanceMapGenerator::JFPassMaterial
MaskMaterial : class UMaterialInterface *
Material to render a mask that gets used to calculate the distance map.
Signature
class UMaterialInterface* AMRUKDistanceMapGenerator::MaskMaterial
OnReady : FOnReady
Signature
FOnReady AMRUKDistanceMapGenerator::OnReady
RenderTarget1 : class UCanvasRenderTarget2D *
First render target for jump flood algorithm.
Signature
class UCanvasRenderTarget2D* AMRUKDistanceMapGenerator::RenderTarget1
RenderTarget2 : class UCanvasRenderTarget2D *
Second render target for jump flood algorithm.
Signature
class UCanvasRenderTarget2D* AMRUKDistanceMapGenerator::RenderTarget2
Root : class USceneComponent *
Signature
class USceneComponent* AMRUKDistanceMapGenerator::Root
SceneCapture2D : class USceneCaptureComponent2D *
Signature
class USceneCaptureComponent2D* AMRUKDistanceMapGenerator::SceneCapture2D
SpawnMode : EMRUKSpawnMode
Signature
EMRUKSpawnMode AMRUKDistanceMapGenerator::SpawnMode

Protected Member Functions

BeginPlay ()
Signature
void AMRUKDistanceMapGenerator::BeginPlay() override
Returns
void

Member Functions

CaptureDistanceMap ()
Capture the distance map.
Signature
UTexture * AMRUKDistanceMapGenerator::CaptureDistanceMap()
Returns
UTexture *  The captured distance map.
CreateMaskMeshesForRoom ( Room )
Create mask meshes for the given room. These mask meshes are needed for the distance map to be rendered. It should only be called once before CaptureDistanceMap in case the SpawnMode has been set to None. The operation that this function executes is expensive. It only needs to be called after the room has been created or updated.
Signature
void AMRUKDistanceMapGenerator::CreateMaskMeshesForRoom(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *  The room for which the masked meshes should be created.
Returns
void
DECLARE_DYNAMIC_MULTICAST_DELEGATE ()
Signature
AMRUKDistanceMapGenerator::DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnReady)
Parameters
FOnReady
GetDistanceMap ()
Return the captured distance map. Be sure to call CaptureDistanceMap() before
Signature
UTexture * AMRUKDistanceMapGenerator::GetDistanceMap() const
Returns
UTexture *  The captured distance map.
GetDistanceMapRenderTarget ()
Signature
UCanvasRenderTarget2D * AMRUKDistanceMapGenerator::GetDistanceMapRenderTarget() const
Returns
UCanvasRenderTarget2D *
GetSceneCaptureView ()
Retrieve the view info from the scene capture. This is useful for re projection of the distance map in a material.
Signature
FMinimalViewInfo AMRUKDistanceMapGenerator::GetSceneCaptureView() const
Returns
FMinimalViewInfo  The view info.
RemoveMaskMeshesFromRoom ( Room )
Remove mask meshes for the given room. This function should only be executed when SpawnMode is set to None. It only needs to be called after a room has been removed.
Signature
void AMRUKDistanceMapGenerator::RemoveMaskMeshesFromRoom(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *  The room for which the masked meshes should be removed.
Returns
void