Skip to content
Snippets Groups Projects
Commit ac19cd26 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

Added custom log category.

parent e6ea37b6
Branches
No related tags found
No related merge requests found
......@@ -2,9 +2,10 @@
#include "GPUInstancedLineComponent.h"
#include "InstancedMeshLineRendering.h" // Only needed for logging
#include "PropertyPathHelpers.h"
//#pragma optimize("", off)
#pragma optimize("", off)
UGPUInstancedLineComponent::UGPUInstancedLineComponent(const FObjectInitializer& ObjectInitializer)
......@@ -75,12 +76,12 @@ void UGPUInstancedLineComponent::UpdateWholeTexture()
void UGPUInstancedLineComponent::Init()
{
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::Init Creating Texture"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::Init Creating Texture"));
PositionTexture = UTexture2D::CreateTransient(TextureWidth, TextureHeight, PF_A32B32G32R32F);
// Allocate the texture RHI
PositionTexture->UpdateResource();
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::Init Creating MID"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::Init Creating MID"));
DynamicLineMaterial = CreateAndSetMaterialInstanceDynamic(0);// UMaterialInstanceDynamic::Create(LineMat, this, "DynamicLineMaterialMID");
if (DynamicLineMaterial == nullptr) // FOR WHATEVER REASON I HAVE NO IDEA
......@@ -94,9 +95,9 @@ void UGPUInstancedLineComponent::Init()
DynamicLineMaterial->SetScalarParameterValue("TextureWidth", TextureWidth);
}
else
UE_LOG(LogTemp, Error, TEXT("UGPUInstancedLineComponent::Init DynamicLineMaterial was nullptr"));
UE_LOG(LogLineRendering, Error, TEXT("UGPUInstancedLineComponent::Init DynamicLineMaterial was nullptr"));
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::Init Resetting Data"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::Init Resetting Data"));
LineMap.Empty();
LinearLineData.Empty();
NextFreeId = 0;
......@@ -140,7 +141,7 @@ void UGPUInstancedLineComponent::UpdateAllEditorLines()
}
else
{
UE_LOG(LogTemp, Error, TEXT("UGPUInstancedLineComponent::UpdateAllEditorLines : An editor line wasn't registered before updating it, ignoring!"));
UE_LOG(LogLineRendering, Error, TEXT("UGPUInstancedLineComponent::UpdateAllEditorLines : An editor line wasn't registered before updating it, ignoring!"));
}
}
}
......@@ -184,7 +185,7 @@ FUpdateTextureRegion2D* UGPUInstancedLineComponent::CalculateTextureRegions(cons
return Regions->GetData();
}
else if (RemainingPoints >= TextureWidth)
UE_LOG(LogTemp, Fatal, TEXT("UGPUInstancedLineComponent::CalculateTextureRegions : Calculation went wrong on second region, fix code!"));
UE_LOG(LogLineRendering, Fatal, TEXT("UGPUInstancedLineComponent::CalculateTextureRegions : Calculation went wrong on second region, fix code!"));
Regions->AddZeroed(1);
(*Regions)[2].DestX = 0;
......@@ -197,7 +198,7 @@ FUpdateTextureRegion2D* UGPUInstancedLineComponent::CalculateTextureRegions(cons
RemainingPoints -= (*Regions)[2].Width * ((*Regions)[1].Height - 1);
if (RemainingPoints > 0)
UE_LOG(LogTemp, Fatal, TEXT("UGPUInstancedLineComponent::CalculateTextureRegions : Calculation went wrong on third region, fix code!"));
UE_LOG(LogLineRendering, Fatal, TEXT("UGPUInstancedLineComponent::CalculateTextureRegions : Calculation went wrong on third region, fix code!"));
NumberOfRegionsOut = 3;
return Regions->GetData();
......@@ -213,7 +214,7 @@ void UGPUInstancedLineComponent::BeginPlay()
//Init();
if(!bIsInitialized)
{
UE_LOG(LogTemp, Fatal, TEXT("UGPUInstancedLineComponent::BeginPlay: FATAL ERROR - Component is not initialized on BeginPlay!"));
UE_LOG(LogLineRendering, Fatal, TEXT("UGPUInstancedLineComponent::BeginPlay: FATAL ERROR - Component is not initialized on BeginPlay!"));
}
}
......@@ -222,7 +223,7 @@ void UGPUInstancedLineComponent::PostInitProperties()
{
Super::PostInitProperties();
if (FApp::CanEverRender() && !HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject))
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::PostInitProperties IF"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::PostInitProperties IF"));
}
......@@ -308,7 +309,7 @@ void UGPUInstancedLineComponent::PostEditChangeChainProperty(FPropertyChangedCha
// Alternatively, just delete the line? TODO
if(EditorLines[EditorLineIndex].Points.Num() < 2)
{
UE_LOG(LogTemp, Error, TEXT("UGPUInstancedLineComponent: A Line needs to consist of at least two points, trying to remove one of them doesn't work. Defaulted point inserted again!"));
UE_LOG(LogLineRendering, Error, TEXT("UGPUInstancedLineComponent: A Line needs to consist of at least two points, trying to remove one of them doesn't work. Defaulted point inserted again!"));
EditorLines[EditorLineIndex].Points.AddZeroed(1);
UpdatePoint(EditorLines[EditorLineIndex].RespectiveLineId, RemovedAtIndex, EditorLines[EditorLineIndex].Points[RemovedAtIndex].Point);
}
......@@ -415,10 +416,10 @@ void UGPUInstancedLineComponent::PostEditChangeProperty(FPropertyChangedEvent& P
void UGPUInstancedLineComponent::PostLoad()
{
Super::PostLoad();
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::PostLoad"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::PostLoad"));
if (FApp::CanEverRender() && !HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject))
{
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::PostLoad IF"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::PostLoad IF"));
if (!bIsInitialized)
Init();
......@@ -429,10 +430,10 @@ void UGPUInstancedLineComponent::PostLoad()
void UGPUInstancedLineComponent::OnComponentCreated()
{
Super::OnComponentCreated();
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::OnComponentCreated"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::OnComponentCreated"));
if (FApp::CanEverRender() && !HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject))
{
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::OnComponentCreated IF"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::OnComponentCreated IF"));
if (!bIsInitialized)
Init();
......@@ -488,7 +489,7 @@ bool UGPUInstancedLineComponent::ResizeTexture(int32 Width, int32 Height)
}
// Recreate texture
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::ResizeTexture - Creating New Texture"));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::ResizeTexture - Creating New Texture"));
PositionTexture = UTexture2D::CreateTransient(TextureWidth, TextureHeight, PF_A32B32G32R32F);
// Allocate the texture RHI
PositionTexture->UpdateResource();
......@@ -518,7 +519,7 @@ void UGPUInstancedLineComponent::InitializeLinesInBulk(int32 NumberOfLines, int3
if (Points.Num() != NumberOfLines * (NumberOfSegmentsPerLine + 1))
{
UE_LOG(LogTemp, Fatal, TEXT("UGPUInstancedLineComponent::InitializeLinesInBulk : Inconsistent number of points and lines!"));
UE_LOG(LogLineRendering, Fatal, TEXT("UGPUInstancedLineComponent::InitializeLinesInBulk : Inconsistent number of points and lines!"));
}
LinearLineData = MoveTemp(Points);
......@@ -563,7 +564,7 @@ int32 UGPUInstancedLineComponent::AddLine(const TArray<FVector>& Line, FLinearCo
{
if (Line.Num() < 2)
{
UE_LOG(LogTemp, Error, TEXT("UGPUInstancedLineComponent::AddLine : Can't add line with less than 2 points.")); // Actually we can!
UE_LOG(LogLineRendering, Error, TEXT("UGPUInstancedLineComponent::AddLine : Can't add line with less than 2 points.")); // Actually we can!
return -1;
}
// 1.
......@@ -1326,7 +1327,7 @@ bool UGPUInstancedLineComponent::RemoveAllEditorLines()
if(EditorLines.Num() != 0)
{
EditorLines.Empty();
UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::RemoveAllEditorLines - EditorLines wasn't empty already, clearing."));
UE_LOG(LogLineRendering, Display, TEXT("UGPUInstancedLineComponent::RemoveAllEditorLines - EditorLines wasn't empty already, clearing."));
}
EditorLineIds.Empty();
return true;
......@@ -1463,4 +1464,4 @@ bool UGPUInstancedLineComponent::SetSegmentWidth(int32 LineId, int32 SegmentId,
SetCustomDataValue(InstanceId, 3, Width, false);
return true;
}
//#pragma optimize("", on)
#pragma optimize("", on)
......@@ -2,6 +2,8 @@
#include "InstancedMeshLineRendering.h"
DEFINE_LOG_CATEGORY(LogLineRendering);
#define LOCTEXT_NAMESPACE "FInstancedMeshLineRenderingModule"
void FInstancedMeshLineRenderingModule::StartupModule()
......
......@@ -5,6 +5,8 @@
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
DECLARE_LOG_CATEGORY_EXTERN(LogLineRendering, Log, All);
class INSTANCEDMESHLINERENDERING_API FInstancedMeshLineRenderingModule : public IModuleInterface
{
public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment