diff --git a/Content/Blueprints/TabletBP.uasset b/Content/Blueprints/TabletBP.uasset index 66cd68b9e5e9c6d9bdfc70abf2fd9a4647b3f7b8..70471f0bd4bdba18cde69f90430fa282113748f7 100644 Binary files a/Content/Blueprints/TabletBP.uasset and b/Content/Blueprints/TabletBP.uasset differ diff --git a/Source/OptiX/Private/OptiXLaserComponent.cpp b/Source/OptiX/Private/OptiXLaserComponent.cpp index 993313bc9cc26987d1293bba7c1f4fc0f02fc253..2ca7f05627b7f7f056384b274fb8d02231c8d5ed 100644 --- a/Source/OptiX/Private/OptiXLaserComponent.cpp +++ b/Source/OptiX/Private/OptiXLaserComponent.cpp @@ -360,6 +360,7 @@ bool UOptiXLaserComponent::GetTargetColorMode() const void UOptiXLaserComponent::SetWavelength(float WL) { Wavelength = WL; + FOptiXModule::Get().GetOptiXContextManager()->BroadcastWavelengthChange(WL); bUpdateQueued.AtomicSet(true); } diff --git a/Source/OptiX/Private/OptiXLensComponent.cpp b/Source/OptiX/Private/OptiXLensComponent.cpp index d756e2e5d027960e973a58a5b10b843720312a12..f97e2916edc6f408af6d888b73f680a64dd085c3 100644 --- a/Source/OptiX/Private/OptiXLensComponent.cpp +++ b/Source/OptiX/Private/OptiXLensComponent.cpp @@ -154,6 +154,9 @@ void UOptiXLensComponent::InitOptiXGroups() OptiXContext->GetGroup("top_object")->AddChild(OptiXTransform); MarkDirty(); + + // hook into WL update: + FOptiXModule::Get().GetOptiXContextManager()->WavelengthChangedEvent.AddUFunction(this, "OnWavelengthChangedEvent"); } void UOptiXLensComponent::InitCubemap(FRHICommandListImmediate & RHICmdList) @@ -345,7 +348,7 @@ FString UOptiXLensComponent::GetGlassType() const void UOptiXLensComponent::SetWavelength(float WL) { - UE_LOG(LogTemp, Display, TEXT("Setting new WL")); + UE_LOG(LogTemp, Display, TEXT("Setting new WL in lens: %s"), *GetName()); CurrentWavelength = WL; QueueOptiXContextUpdate(); } @@ -448,3 +451,8 @@ TArray<FString> UOptiXLensComponent::GetGlassDefinitionNames() return Names; } + +void UOptiXLensComponent::OnWavelengthChangedEvent(float WL) +{ + SetWavelength(WL); +} diff --git a/Source/OptiX/Private/cuda/already generated - optical bench/miss.cu b/Source/OptiX/Private/cuda/already generated - optical bench/miss.cu index 400b05abd0fefef4ce51949880daa1a0bf11b2b0..6cc7415f2f0dd6e19d2af3f546974549241a496f 100644 --- a/Source/OptiX/Private/cuda/already generated - optical bench/miss.cu +++ b/Source/OptiX/Private/cuda/already generated - optical bench/miss.cu @@ -28,6 +28,6 @@ rtDeclareVariable(optix::Ray, ray, rtCurrentRay, ); RT_PROGRAM void miss_iterative() { - prd_radiance_it.origin = ray.origin + ray.direction * 150.0f; + prd_radiance_it.origin = ray.origin + ray.direction * 1500.0f; prd_radiance_it.done = true; } diff --git a/Source/OptiX/Private/cuda/miss.cu b/Source/OptiX/Private/cuda/miss.cu new file mode 100644 index 0000000000000000000000000000000000000000..6cc7415f2f0dd6e19d2af3f546974549241a496f --- /dev/null +++ b/Source/OptiX/Private/cuda/miss.cu @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// Project Phoenix +// +// Copyright (c) 2017-2018 RWTH Aachen University, Germany, +// Virtual Reality & Immersive Visualization Group. +//------------------------------------------------------------------------------ +// License +// +// Licensed under the 3-Clause BSD License (the "License"); +// you may not use this file except in compliance with the License. +// See the file LICENSE for the full text. +// You may obtain a copy of the License at +// +// https://opensource.org/licenses/BSD-3-Clause +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//------------------------------------------------------------------------------ + +#include <optix_world.h> +#include "prd.h" + +rtDeclareVariable(PerRayData_radiance_iterative, prd_radiance_it, rtPayload, ); +rtDeclareVariable(optix::Ray, ray, rtCurrentRay, ); + +RT_PROGRAM void miss_iterative() +{ + prd_radiance_it.origin = ray.origin + ray.direction * 1500.0f; + prd_radiance_it.done = true; +} diff --git a/Source/OptiX/Public/OptiXContextManager.h b/Source/OptiX/Public/OptiXContextManager.h index 2a3f4b8dbdd991df552c137d3be45abd1d6e36b0..70271d647b0279a2fa6d4ba8d63cddf4e0fcf192 100644 --- a/Source/OptiX/Public/OptiXContextManager.h +++ b/Source/OptiX/Public/OptiXContextManager.h @@ -21,6 +21,7 @@ // Let's try some events! DECLARE_EVENT(FOptiXContextManager, FLaserTraceFinishedEvent) +DECLARE_EVENT_OneParam(FOptiXContextManager, FWavelengthChangedEvent, const float) DECLARE_MULTICAST_DELEGATE(FOnSceneChangedDelegate); @@ -150,6 +151,11 @@ public: void AddCubemapToBuffer(int32 CubemapId, int32 SamplerId); + void BroadcastWavelengthChange(float WL) + { + WavelengthChangedEvent.Broadcast(WL); + } + public: @@ -163,7 +169,7 @@ public: FThreadSafeBool bValidCubemap = false; FLaserTraceFinishedEvent LaserTraceFinishedEvent; - + FWavelengthChangedEvent WavelengthChangedEvent; FOnSceneChangedDelegate OnSceneChangedDelegate; diff --git a/Source/OptiX/Public/OptiXLensComponent.h b/Source/OptiX/Public/OptiXLensComponent.h index 172b8502983c1461c5d1437a983aebde898dab5f..2249e9a92087a7a11f8f2694842ede0b39371ec2 100644 --- a/Source/OptiX/Public/OptiXLensComponent.h +++ b/Source/OptiX/Public/OptiXLensComponent.h @@ -119,6 +119,9 @@ public: UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXLensComponent") // TODO TArray<FString> GetGlassDefinitionNames(); + UFUNCTION() + void OnWavelengthChangedEvent(float WL); + public: // Lens Properties