You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-SOURCE: CL 10869241 via CL 10869527 via CL 10869904 #ROBOMERGE-BOT: (v613-10869866) [CL 10870586 by ryan durand in Main branch]
51 lines
1.7 KiB
C++
51 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "ProceduralFoliageComponentVisualizer.h"
|
|
#include "ProceduralFoliageSpawner.h"
|
|
#include "ProceduralFoliageComponent.h"
|
|
|
|
|
|
static const FColor& ProcTileColor = FColor::Yellow;
|
|
static const FColor& ProcTileOverlapColor = FColor::Green;
|
|
|
|
void FProceduralFoliageComponentVisualizer::DrawVisualization(const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI)
|
|
{
|
|
if (const UProceduralFoliageComponent* ProcComponent = Cast<const UProceduralFoliageComponent>(Component))
|
|
{
|
|
if (ProcComponent->bShowDebugTiles && ProcComponent->FoliageSpawner)
|
|
{
|
|
const FVector TilesOrigin = ProcComponent->GetWorldPosition();
|
|
|
|
const float TileSize = ProcComponent->FoliageSpawner->TileSize;
|
|
const FVector TileSizeV(TileSize, TileSize, 0.f);
|
|
|
|
const float TileOverlap = ProcComponent->TileOverlap;
|
|
const FVector TileOverlapV(TileOverlap, TileOverlap, 0.f);
|
|
|
|
FTileLayout TileLayout;
|
|
ProcComponent->GetTileLayout(TileLayout);
|
|
|
|
// Draw each tile
|
|
for (int32 X = 0; X < TileLayout.NumTilesX; ++X)
|
|
{
|
|
for (int32 Y = 0; Y < TileLayout.NumTilesY; ++Y)
|
|
{
|
|
const FVector StartOffset(X*TileSize, Y*TileSize, 0.f);
|
|
|
|
// Draw the tile without overlap
|
|
const FBox BoxInner(TilesOrigin + StartOffset, TilesOrigin + StartOffset + TileSizeV);
|
|
DrawWireBox(PDI, BoxInner, ProcTileColor, SDPG_World);
|
|
|
|
if (TileOverlap != 0.f)
|
|
{
|
|
// Draw the tile expanded by the overlap amount
|
|
const FBox BoxOuter = BoxInner + (BoxInner.Min - TileOverlapV) + (BoxInner.Max + TileOverlapV);
|
|
DrawWireBox(PDI, BoxOuter, ProcTileOverlapColor, SDPG_World);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|