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

- trying to pass late updated values to optix as well when things are grabbed by motioncontrollers

- function gets executed, but transforms are different, needs to be fixed
parent 30c66823
No related branches found
No related tags found
No related merge requests found
...@@ -72,13 +72,14 @@ FOptiXContextManager::FOptiXContextManager(const FAutoRegister& AutoRegister) ...@@ -72,13 +72,14 @@ FOptiXContextManager::FOptiXContextManager(const FAutoRegister& AutoRegister)
OptiXPTXDir = FOptiXModule::Get().OptiXPTXDir; OptiXPTXDir = FOptiXModule::Get().OptiXPTXDir;
} }
// gamethread
void FOptiXContextManager::SetupViewFamily(FSceneViewFamily & InViewFamily) void FOptiXContextManager::SetupViewFamily(FSceneViewFamily & InViewFamily)
{} {}
void FOptiXContextManager::SetupView(FSceneViewFamily & InViewFamily, FSceneView & InView) void FOptiXContextManager::SetupView(FSceneViewFamily & InViewFamily, FSceneView & InView)
{} {}
// gamethread
void FOptiXContextManager::BeginRenderViewFamily(FSceneViewFamily & InViewFamily) void FOptiXContextManager::BeginRenderViewFamily(FSceneViewFamily & InViewFamily)
{} {}
...@@ -89,6 +90,7 @@ void FOptiXContextManager::PreRenderView_RenderThread(FRHICommandListImmediate & ...@@ -89,6 +90,7 @@ void FOptiXContextManager::PreRenderView_RenderThread(FRHICommandListImmediate &
// Called on render thread at the start of rendering. // Called on render thread at the start of rendering.
void FOptiXContextManager::PreRenderViewFamily_RenderThread(FRHICommandListImmediate & RHICmdList, FSceneViewFamily & InViewFamily) void FOptiXContextManager::PreRenderViewFamily_RenderThread(FRHICommandListImmediate & RHICmdList, FSceneViewFamily & InViewFamily)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::PreRenderViewFamily_RenderThread"))
if (bEndPlayReceived) if (bEndPlayReceived)
{ {
...@@ -104,12 +106,12 @@ void FOptiXContextManager::PreRenderViewFamily_RenderThread(FRHICommandListImmed ...@@ -104,12 +106,12 @@ void FOptiXContextManager::PreRenderViewFamily_RenderThread(FRHICommandListImmed
ParseCubemapUpdateQueue(RHICmdList); ParseCubemapUpdateQueue(RHICmdList);
// launch the laser trace if needed (todo) // launch the laser trace if needed (todo)
LaunchLaser(RHICmdList); //LaunchLaser(RHICmdList);
} }
void FOptiXContextManager::PostRenderViewFamily_RenderThread(FRHICommandListImmediate & RHICmdList, FSceneViewFamily & InViewFamily) void FOptiXContextManager::PostRenderViewFamily_RenderThread(FRHICommandListImmediate & RHICmdList, FSceneViewFamily & InViewFamily)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::PreRenderViewFamily_RenderThread")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::PreRenderViewFamily_RenderThread")
if (bEndPlayReceived) if (bEndPlayReceived)
...@@ -135,7 +137,7 @@ void FOptiXContextManager::PostRenderViewFamily_RenderThread(FRHICommandListImme ...@@ -135,7 +137,7 @@ void FOptiXContextManager::PostRenderViewFamily_RenderThread(FRHICommandListImme
NativeContext->validate(); NativeContext->validate();
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::Trace")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::Trace")
//bIsTracing.AtomicSet(true); //bIsTracing.AtomicSet(true);
// Execute the actual trace // Execute the actual trace
...@@ -228,6 +230,7 @@ void FOptiXContextManager::PostRenderViewFamily_RenderThread(FRHICommandListImme ...@@ -228,6 +230,7 @@ void FOptiXContextManager::PostRenderViewFamily_RenderThread(FRHICommandListImme
RenderOrthoPass(); RenderOrthoPass();
bRequestOrthoPass.AtomicSet(false); bRequestOrthoPass.AtomicSet(false);
} }
LaunchLaser(RHICmdList);
} }
void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate & RHICmdList, FSceneView & InView) void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate & RHICmdList, FSceneView & InView)
...@@ -236,7 +239,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate ...@@ -236,7 +239,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList) void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::LaunchLaser")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::LaunchLaser")
if (/*bSceneChanged &&*/ bIsInitializedLaser && !CVarDisableLaserTrace.GetValueOnRenderThread()) if (/*bSceneChanged &&*/ bIsInitializedLaser && !CVarDisableLaserTrace.GetValueOnRenderThread())
{ {
...@@ -247,7 +250,10 @@ void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList) ...@@ -247,7 +250,10 @@ void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList)
NativeContext["random_frame_seed"]->setUint(RandomSeed++); NativeContext["random_frame_seed"]->setUint(RandomSeed++);
//UE_LOG(OptiXContextManagerLog, Warning, TEXT("Launching Laser Trace at Entry Point: %i"), LaserEntryPoint); //UE_LOG(OptiXContextManagerLog, Warning, TEXT("Launching Laser Trace at Entry Point: %i"), LaserEntryPoint);
//bIsTracing.AtomicSet(true); //bIsTracing.AtomicSet(true);
{
TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::NativeContext::launch")
NativeContext->launch(1, 50, 50, 20); NativeContext->launch(1, 50, 50, 20);
}
//bIsTracing.AtomicSet(false); //bIsTracing.AtomicSet(false);
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::LaunchLaser::CudaScope")) TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::LaunchLaser::CudaScope"))
...@@ -291,7 +297,7 @@ void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList) ...@@ -291,7 +297,7 @@ void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList)
} }
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::LaunchLaser::BroadcastFinish")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::LaunchLaser::BroadcastFinish")
//bSceneChanged.AtomicSet(false); //bSceneChanged.AtomicSet(false);
for (const auto& Pair : LaserTraceFinishedCallbacks) for (const auto& Pair : LaserTraceFinishedCallbacks)
...@@ -320,7 +326,7 @@ void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList) ...@@ -320,7 +326,7 @@ void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList)
bool FOptiXContextManager::IsActiveThisFrame(FViewport * InViewport) const bool FOptiXContextManager::IsActiveThisFrame(FViewport * InViewport) const
{ {
//UE_LOG(OptiXContextManagerLog, Warning, TEXT("IsActiveThisFrame")); //UE_LOG(OptiXContextManagerLog, Warning, TEXT("IsActiveThisFrame"));
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::IsActiveThisFrame")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::IsActiveThisFrame")
bool bDisableTrace = CVarDisableTrace.GetValueOnGameThread(); // Bad naming fix me bool bDisableTrace = CVarDisableTrace.GetValueOnGameThread(); // Bad naming fix me
return NativeContext != NULL && !bDisableTrace && bIsInitializedAll /*&& !bEndPlayReceived*/ /* && !bEndPlay*//* && TrackingSystem->IsHeadTrackingAllowed()*/; return NativeContext != NULL && !bDisableTrace && bIsInitializedAll /*&& !bEndPlayReceived*/ /* && !bEndPlay*//* && TrackingSystem->IsHeadTrackingAllowed()*/;
...@@ -328,7 +334,7 @@ bool FOptiXContextManager::IsActiveThisFrame(FViewport * InViewport) const ...@@ -328,7 +334,7 @@ bool FOptiXContextManager::IsActiveThisFrame(FViewport * InViewport) const
void FOptiXContextManager::RenderOrthoPass() void FOptiXContextManager::RenderOrthoPass()
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::RenderOrthoPass")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::RenderOrthoPass")
NativeContext["is_ortho"]->setInt(1); NativeContext["is_ortho"]->setInt(1);
...@@ -392,7 +398,7 @@ void FOptiXContextManager::RenderOrthoPass() ...@@ -392,7 +398,7 @@ void FOptiXContextManager::RenderOrthoPass()
void FOptiXContextManager::Init() void FOptiXContextManager::Init()
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::Init")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::Init")
// TODO Fix me there's still an optix error in there somewhere // TODO Fix me there's still an optix error in there somewhere
//if (CubemapSampler.IsValid()) //if (CubemapSampler.IsValid())
...@@ -449,7 +455,7 @@ void FOptiXContextManager::SceneChangedCallback() ...@@ -449,7 +455,7 @@ void FOptiXContextManager::SceneChangedCallback()
void FOptiXContextManager::InitContext() void FOptiXContextManager::InitContext()
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::InitContext")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::InitContext")
UE_LOG(OptiXContextManagerLog, Display, TEXT("Initializing Context in ContextManager")); UE_LOG(OptiXContextManagerLog, Display, TEXT("Initializing Context in ContextManager"));
...@@ -500,7 +506,7 @@ void FOptiXContextManager::InitContext() ...@@ -500,7 +506,7 @@ void FOptiXContextManager::InitContext()
void FOptiXContextManager::InitRendering() void FOptiXContextManager::InitRendering()
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::InitRendering")) TRACE_CPUPROFILER_EVENT_SCOPE("FOptiXContextManager::InitRendering")
UE_LOG(OptiXContextManagerLog, Display, TEXT("Initializing Rendering in ContextManager")); UE_LOG(OptiXContextManagerLog, Display, TEXT("Initializing Rendering in ContextManager"));
...@@ -1326,6 +1332,24 @@ void FOptiXContextManager::ParseCubemapUpdateQueue(FRHICommandListImmediate & RH ...@@ -1326,6 +1332,24 @@ void FOptiXContextManager::ParseCubemapUpdateQueue(FRHICommandListImmediate & RH
} }
} }
void FOptiXContextManager::LaserPositionLateUpdate_RenderThread(const FTransform LateUpdateTransform)
{
FVector Translation = LateUpdateTransform.GetTranslation();
FVector Forward = LateUpdateTransform.GetUnitAxis(EAxis::X);
FVector Right = LateUpdateTransform.GetUnitAxis(EAxis::Y);
FVector Up = LateUpdateTransform.GetUnitAxis(EAxis::Z);
FMatrix Rotation = LateUpdateTransform.ToMatrixNoScale();
NativeContext["laser_origin"]->setFloat(Translation.X, Translation.Y, Translation.Z);
NativeContext["laser_forward"]->setFloat(Forward.X, Forward.Y, Forward.Z);
NativeContext["laser_right"]->setFloat(Right.X, Right.Y, Right.Z);
NativeContext["laser_up"]->setFloat(Up.X, Up.Y, Up.Z);
NativeContext["laser_rot"]->setMatrix4x4fv(true, &Rotation.M[0][0]);
}
// Cleanup functions // Cleanup functions
void FOptiXContextManager::CleanupCuda() void FOptiXContextManager::CleanupCuda()
...@@ -1600,3 +1624,4 @@ void FOptiXContextManager::Cleanup_GameThread() ...@@ -1600,3 +1624,4 @@ void FOptiXContextManager::Cleanup_GameThread()
LaserTraceFinishedCallbacks.Empty(); LaserTraceFinishedCallbacks.Empty();
} }
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "OptiXLaserComponent.h" #include "OptiXLaserComponent.h"
#include "OptiXModule.h"
#include "UObject/ConstructorHelpers.h" #include "UObject/ConstructorHelpers.h"
#include "OptiXModule.h"
#include "StatsDefines.h" #include "StatsDefines.h"
...@@ -13,7 +14,7 @@ UOptiXLaserComponent::UOptiXLaserComponent() ...@@ -13,7 +14,7 @@ UOptiXLaserComponent::UOptiXLaserComponent()
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them. // off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = false; PrimaryComponentTick.bCanEverTick = false;
bWantsOnUpdateTransform = true; // why the hell do I need this here but not on the others? bWantsOnUpdateTransform = false; // why the hell do I need this here but not on the others?
// ... // ...
...@@ -134,11 +135,46 @@ UOptiXLaserComponent::UOptiXLaserComponent() ...@@ -134,11 +135,46 @@ UOptiXLaserComponent::UOptiXLaserComponent()
} }
FPrimitiveSceneProxy* UOptiXLaserComponent::CreateSceneProxy()
{
class FLaserComponentSceneProxy final : public FPrimitiveSceneProxy
{
public:
SIZE_T GetTypeHash() const override
{
static size_t UniquePointer;
return reinterpret_cast<size_t>(&UniquePointer);
}
/** Initialization constructor. */
FLaserComponentSceneProxy(const UOptiXLaserComponent* InComponent)
: FPrimitiveSceneProxy(InComponent)
{}
// FPrimitiveSceneProxy interface.
virtual void ApplyLateUpdateTransform(const FMatrix& LateUpdateTransform) override
{
UE_LOG(LogTemp, Display, TEXT("Applying late update to laser"));
UE_LOG(LogTemp, Display, TEXT("Transform on late update: %s"), *FTransform(LateUpdateTransform).ToString());
FPrimitiveSceneProxy::ApplyLateUpdateTransform(LateUpdateTransform);
FOptiXModule::Get().GetOptiXContextManager()->LaserPositionLateUpdate_RenderThread(FTransform(LateUpdateTransform));
}
virtual uint32 GetMemoryFootprint(void) const override { return(sizeof(*this) + GetAllocatedSize()); }
uint32 GetAllocatedSize(void) const { return(FPrimitiveSceneProxy::GetAllocatedSize()); }
};
return new FLaserComponentSceneProxy(this);
}
// Called when the game starts // Called when the game starts
void UOptiXLaserComponent::BeginPlay() void UOptiXLaserComponent::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
bWantsOnUpdateTransform = true;
UE_LOG(LogTemp, Display, TEXT("Initializing OptiX Laser")); UE_LOG(LogTemp, Display, TEXT("Initializing OptiX Laser"));
...@@ -420,17 +456,20 @@ void UOptiXLaserComponent::UpdateLaserPosition() ...@@ -420,17 +456,20 @@ void UOptiXLaserComponent::UpdateLaserPosition()
FVector Up = GetUpVector(); FVector Up = GetUpVector();
FMatrix Rotation = CurrentTransform.ToMatrixNoScale(); FMatrix Rotation = CurrentTransform.ToMatrixNoScale();
UE_LOG(LogTemp, Display, TEXT("Transform on update: %s"), *GetComponentTransform().ToString());
// Hard code this for now: laser is around 10x10x10 cube // Hard code this for now: laser is around 10x10x10 cube
OptiXContextUpdateFunction UpdateFunction = OptiXContextUpdateFunction UpdateFunction =
[Translation, Forward, Right, Up, Rotation](optix::Context Context) [Translation, Forward, Right, Up, Rotation](optix::Context Context)
{ {
Context["laser_origin"]->setFloat(Translation.X, Translation.Y, Translation.Z); /*Context["laser_origin"]->setFloat(Translation.X, Translation.Y, Translation.Z);
Context["laser_forward"]->setFloat(Forward.X, Forward.Y, Forward.Z); Context["laser_forward"]->setFloat(Forward.X, Forward.Y, Forward.Z);
Context["laser_right"]->setFloat(Right.X, Right.Y, Right.Z); Context["laser_right"]->setFloat(Right.X, Right.Y, Right.Z);
Context["laser_up"]->setFloat(Up.X, Up.Y, Up.Z); Context["laser_up"]->setFloat(Up.X, Up.Y, Up.Z);
Context["laser_rot"]->setMatrix4x4fv(true, &Rotation.M[0][0]); Context["laser_rot"]->setMatrix4x4fv(true, &Rotation.M[0][0]); */
}; };
FOptiXModule::Get().GetOptiXContextManager()->EnqueueContextUpdateFunction(UpdateFunction); FOptiXModule::Get().GetOptiXContextManager()->EnqueueContextUpdateFunction(UpdateFunction);
......
...@@ -51,7 +51,7 @@ void AOptiXLaserDetectorActor::EndPlay(const EEndPlayReason::Type EndPlayReason) ...@@ -51,7 +51,7 @@ void AOptiXLaserDetectorActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
void AOptiXLaserDetectorActor::Tick(float DeltaTime) void AOptiXLaserDetectorActor::Tick(float DeltaTime)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("AOptiXLaserDetectorActor::Tick")) TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::Tick")
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
//OnLaserTraceFinished(); // todo //OnLaserTraceFinished(); // todo
...@@ -94,31 +94,43 @@ void AOptiXLaserDetectorActor::Init() ...@@ -94,31 +94,43 @@ void AOptiXLaserDetectorActor::Init()
[&bIsColorMode = bIsColorMode, &HighlightColor = HighlightColor, TargetRes = Size, &DynamicScreenMaterial = DynamicScreenMaterial, TextureRegion = TextureRegion.Get(), DetectorResultTexture = DetectorResultTexture] [&bIsColorMode = bIsColorMode, &HighlightColor = HighlightColor, TargetRes = Size, &DynamicScreenMaterial = DynamicScreenMaterial, TextureRegion = TextureRegion.Get(), DetectorResultTexture = DetectorResultTexture]
(FOptiXObjectData* Data, TMap<FString, optix::Buffer>* Buffers, optix::TextureSampler TextureSampler, FRHICommandListImmediate& RHICmdList) (FOptiXObjectData* Data, TMap<FString, optix::Buffer>* Buffers, optix::TextureSampler TextureSampler, FRHICommandListImmediate& RHICmdList)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::LaserTraceFinishedCallback")
// Get Max // Get Max
float Max;
{
TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::LaserTraceFinishedCallback::GetMax")
optix::Buffer BufferMax = *Buffers->Find("target_buffer_max"); optix::Buffer BufferMax = *Buffers->Find("target_buffer_max");
float Max = (float)*static_cast<unsigned int*>(BufferMax->map(0, RT_BUFFER_MAP_READ)); Max = (float)*static_cast<unsigned int*>(BufferMax->map(0, RT_BUFFER_MAP_READ));
BufferMax->unmap(); BufferMax->unmap();
if (Max == 0) if (Max == 0)
{ {
Max = 1; // TODO WHY? Max = 1; // TODO WHY?
} }
}
FTexture2DRHIRef TextureRef = ((FTexture2DResource*)DetectorResultTexture->Resource)->GetTexture2DRHI(); FTexture2DRHIRef TextureRef = ((FTexture2DResource*)DetectorResultTexture->Resource)->GetTexture2DRHI();
{
TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::LaserTraceFinishedCallback::GetTargetBuffer")
optix::Buffer Buffer = *Buffers->Find("target_buffer"); optix::Buffer Buffer = *Buffers->Find("target_buffer");
float* DataPtr = static_cast<float*>(Buffer->map(0, RT_BUFFER_MAP_READ)); float* DataPtr = static_cast<float*>(Buffer->map(0, RT_BUFFER_MAP_READ));
//DetectorResultTexture->UpdateTextureRegions(0, 1, TextureRegion, TargetRes * 4, 4, (uint8*)DataPtr); //DetectorResultTexture->UpdateTextureRegions(0, 1, TextureRegion, TargetRes * 4, 4, (uint8*)DataPtr);
{
TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::LaserTraceFinishedCallback::GetTargetBuffer::UpdateTexture2D")
RHICmdList.UpdateTexture2D(TextureRef, 0, *TextureRegion, TargetRes * 4, (uint8*)DataPtr); RHICmdList.UpdateTexture2D(TextureRef, 0, *TextureRegion, TargetRes * 4, (uint8*)DataPtr);
}
Buffer->unmap(); Buffer->unmap();
}
// todo // todo
//DynamicScreenMaterial->Resource->RenderThread_UpdateParameter() //DynamicScreenMaterial->Resource->RenderThread_UpdateParameter()
if (DynamicScreenMaterial != nullptr) if (DynamicScreenMaterial != nullptr)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::LaserTraceFinishedCallback::UpdateMaterial")
DynamicScreenMaterial->SetScalarParameterValue("ColorMode", bIsColorMode ? 1.0f : 0.0f); DynamicScreenMaterial->SetScalarParameterValue("ColorMode", bIsColorMode ? 1.0f : 0.0f);
DynamicScreenMaterial->SetVectorParameterValue("ColorMode", HighlightColor); DynamicScreenMaterial->SetVectorParameterValue("ColorMode", HighlightColor);
DynamicScreenMaterial->SetTextureParameterValue("ResultTexture", DetectorResultTexture); DynamicScreenMaterial->SetTextureParameterValue("ResultTexture", DetectorResultTexture);
...@@ -126,13 +138,13 @@ void AOptiXLaserDetectorActor::Init() ...@@ -126,13 +138,13 @@ void AOptiXLaserDetectorActor::Init()
} }
}; };
FOptiXModule::Get().GetOptiXContextManager()->RegisterLaserTraceCallback(OptiXLaserTargetComponent->GetUniqueID(), Callback); FOptiXModule::Get().GetOptiXContextManager()->RegisterLaserTraceCallback(OptiXLaserTargetComponent->GetUniqueID(), Callback);
FOptiXModule::Get().GetOptiXContextManager()->OnSceneChangedDelegate.Broadcast(); //FOptiXModule::Get().GetOptiXContextManager()->OnSceneChangedDelegate.Broadcast();
} }
void AOptiXLaserDetectorActor::OnLaserTraceFinished() void AOptiXLaserDetectorActor::OnLaserTraceFinished()
{ {
//UE_LOG(LogTemp, Warning, TEXT("lasertracefinished")); //UE_LOG(LogTemp, Warning, TEXT("lasertracefinished"));
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("AOptiXLaserDetectorActor::OnLaserTraceFinished")) TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::OnLaserTraceFinished")
if (bIsEnabled) if (bIsEnabled)
{ {
...@@ -143,7 +155,7 @@ void AOptiXLaserDetectorActor::OnLaserTraceFinished() ...@@ -143,7 +155,7 @@ void AOptiXLaserDetectorActor::OnLaserTraceFinished()
void AOptiXLaserDetectorActor::RenderDataToTarget() void AOptiXLaserDetectorActor::RenderDataToTarget()
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("AOptiXLaserDetectorActor::RenderDataToTarget")) TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::RenderDataToTarget")
//int32 Size = static_cast<int32>(OptiXLaserTargetComponent->TargetRes); //int32 Size = static_cast<int32>(OptiXLaserTargetComponent->TargetRes);
...@@ -178,7 +190,7 @@ void AOptiXLaserDetectorActor::RenderDataToTarget() ...@@ -178,7 +190,7 @@ void AOptiXLaserDetectorActor::RenderDataToTarget()
void AOptiXLaserDetectorActor::Clear() void AOptiXLaserDetectorActor::Clear()
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("AOptiXLaserDetectorActor::Clear")) TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::Clear")
//uint32 Size = static_cast<int32>(OptiXLaserTargetComponent->TargetRes); //uint32 Size = static_cast<int32>(OptiXLaserTargetComponent->TargetRes);
......
...@@ -496,6 +496,9 @@ public: ...@@ -496,6 +496,9 @@ public:
*/ */
void RegisterLaserTraceCallback(UniqueId ObjectId, LaserTraceFinishedCallback Callback); void RegisterLaserTraceCallback(UniqueId ObjectId, LaserTraceFinishedCallback Callback);
void LaserPositionLateUpdate_RenderThread(const FTransform LateUpdateTransform);
private: private:
/* /*
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Components/SceneComponent.h" #include "Components/PrimitiveComponent.h"
#include "Runtime/Engine/Classes/Engine/Texture2D.h" #include "Runtime/Engine/Classes/Engine/Texture2D.h"
#include "PrimitiveSceneProxy.h"
//#include "OptiXContext.h" //#include "OptiXContext.h"
...@@ -22,7 +23,7 @@ enum class EPatternTypes : uint8 ...@@ -22,7 +23,7 @@ enum class EPatternTypes : uint8
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class OPTIX_API UOptiXLaserComponent : public USceneComponent class OPTIX_API UOptiXLaserComponent : public UPrimitiveComponent
{ {
GENERATED_BODY() GENERATED_BODY()
...@@ -43,6 +44,8 @@ public: ...@@ -43,6 +44,8 @@ public:
virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport = ETeleportType::None) override; virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport = ETeleportType::None) override;
virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXLaserComponent") UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXLaserComponent")
void CleanOptiXObjects(); void CleanOptiXObjects();
......
...@@ -24,7 +24,6 @@ public: ...@@ -24,7 +24,6 @@ public:
UOptiXObjectComponent(const FObjectInitializer& ObjectInitializer); UOptiXObjectComponent(const FObjectInitializer& ObjectInitializer);
// End of UObject interface // End of UObject interface
// Begin UActorComponent interface // Begin UActorComponent interface
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment