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

- fixed target color LUT

- fixed Clear button to reset max as well
parent 18e77c1d
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -110,6 +110,8 @@ void AOptiXLaserDetectorActor::Init() ...@@ -110,6 +110,8 @@ void AOptiXLaserDetectorActor::Init()
} }
} }
MaxRef = Max; MaxRef = Max;
//UE_LOG(LogTemp, Display, TEXT("MAX: %f"), Max);
FTexture2DRHIRef TextureRef = ((FTexture2DResource*)DetectorResultTexture->Resource)->GetTexture2DRHI(); FTexture2DRHIRef TextureRef = ((FTexture2DResource*)DetectorResultTexture->Resource)->GetTexture2DRHI();
{ {
...@@ -117,6 +119,19 @@ void AOptiXLaserDetectorActor::Init() ...@@ -117,6 +119,19 @@ void AOptiXLaserDetectorActor::Init()
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));
//float M2 = 0;
//for (int32 i = 0; i < DetectorResultTexture->GetSizeX(); ++i)
//{
// for (int32 j = 0; j < DetectorResultTexture->GetSizeY(); ++j)
// {
// M2 = FMath::Max(M2, DataPtr[i * j]);
// }
//}
//UE_LOG(LogTemp, Display, TEXT("MAX2: %f"), M2);
//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") TRACE_CPUPROFILER_EVENT_SCOPE("AOptiXLaserDetectorActor::LaserTraceFinishedCallback::GetTargetBuffer::UpdateTexture2D")
...@@ -205,7 +220,7 @@ void AOptiXLaserDetectorActor::Clear() ...@@ -205,7 +220,7 @@ void AOptiXLaserDetectorActor::Clear()
// DynamicScreenMaterial->SetTextureParameterValue("ResultTexture", DetectorResultTexture); // DynamicScreenMaterial->SetTextureParameterValue("ResultTexture", DetectorResultTexture);
// DynamicScreenMaterial->SetScalarParameterValue("ResultMax", 0); // DynamicScreenMaterial->SetScalarParameterValue("ResultMax", 0);
//} //}
Max = 0.0f;
OptiXLaserTargetComponent->ClearOptiXBuffer(); OptiXLaserTargetComponent->ClearOptiXBuffer();
} }
......
...@@ -120,6 +120,11 @@ void UOptiXLaserTargetComponent::ClearOptiXBuffer() ...@@ -120,6 +120,11 @@ void UOptiXLaserTargetComponent::ClearOptiXBuffer()
float* DataPtr = static_cast<float*>(Buffer->map(0, RT_BUFFER_MAP_WRITE)); float* DataPtr = static_cast<float*>(Buffer->map(0, RT_BUFFER_MAP_WRITE));
FMemory::Memset(DataPtr, 0u, TargetRes * TargetRes * 4); FMemory::Memset(DataPtr, 0u, TargetRes * TargetRes * 4);
Buffer->unmap(); Buffer->unmap();
optix::Buffer BufferMax = *Buffers->Find("target_buffer_max");
*static_cast<unsigned int*>(BufferMax->map(0, RT_BUFFER_MAP_WRITE)) = 0;
BufferMax->unmap();
}; };
FOptiXModule::Get().GetOptiXContextManager()->EnqueueUpdateFunction(GetUniqueID(), UpdateFunction); FOptiXModule::Get().GetOptiXContextManager()->EnqueueUpdateFunction(GetUniqueID(), UpdateFunction);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment