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

- fixed laser length

- wavelength change now gets broadcast to lenses correctly
parent 52cccc39
Branches
No related tags found
No related merge requests found
No preview for this file type
...@@ -360,6 +360,7 @@ bool UOptiXLaserComponent::GetTargetColorMode() const ...@@ -360,6 +360,7 @@ bool UOptiXLaserComponent::GetTargetColorMode() const
void UOptiXLaserComponent::SetWavelength(float WL) void UOptiXLaserComponent::SetWavelength(float WL)
{ {
Wavelength = WL; Wavelength = WL;
FOptiXModule::Get().GetOptiXContextManager()->BroadcastWavelengthChange(WL);
bUpdateQueued.AtomicSet(true); bUpdateQueued.AtomicSet(true);
} }
......
...@@ -154,6 +154,9 @@ void UOptiXLensComponent::InitOptiXGroups() ...@@ -154,6 +154,9 @@ void UOptiXLensComponent::InitOptiXGroups()
OptiXContext->GetGroup("top_object")->AddChild(OptiXTransform); OptiXContext->GetGroup("top_object")->AddChild(OptiXTransform);
MarkDirty(); MarkDirty();
// hook into WL update:
FOptiXModule::Get().GetOptiXContextManager()->WavelengthChangedEvent.AddUFunction(this, "OnWavelengthChangedEvent");
} }
void UOptiXLensComponent::InitCubemap(FRHICommandListImmediate & RHICmdList) void UOptiXLensComponent::InitCubemap(FRHICommandListImmediate & RHICmdList)
...@@ -345,7 +348,7 @@ FString UOptiXLensComponent::GetGlassType() const ...@@ -345,7 +348,7 @@ FString UOptiXLensComponent::GetGlassType() const
void UOptiXLensComponent::SetWavelength(float WL) 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; CurrentWavelength = WL;
QueueOptiXContextUpdate(); QueueOptiXContextUpdate();
} }
...@@ -448,3 +451,8 @@ TArray<FString> UOptiXLensComponent::GetGlassDefinitionNames() ...@@ -448,3 +451,8 @@ TArray<FString> UOptiXLensComponent::GetGlassDefinitionNames()
return Names; return Names;
} }
void UOptiXLensComponent::OnWavelengthChangedEvent(float WL)
{
SetWavelength(WL);
}
...@@ -28,6 +28,6 @@ rtDeclareVariable(optix::Ray, ray, rtCurrentRay, ); ...@@ -28,6 +28,6 @@ rtDeclareVariable(optix::Ray, ray, rtCurrentRay, );
RT_PROGRAM void miss_iterative() 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; prd_radiance_it.done = true;
} }
//------------------------------------------------------------------------------
// 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;
}
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
// Let's try some events! // Let's try some events!
DECLARE_EVENT(FOptiXContextManager, FLaserTraceFinishedEvent) DECLARE_EVENT(FOptiXContextManager, FLaserTraceFinishedEvent)
DECLARE_EVENT_OneParam(FOptiXContextManager, FWavelengthChangedEvent, const float)
DECLARE_MULTICAST_DELEGATE(FOnSceneChangedDelegate); DECLARE_MULTICAST_DELEGATE(FOnSceneChangedDelegate);
...@@ -150,6 +151,11 @@ public: ...@@ -150,6 +151,11 @@ public:
void AddCubemapToBuffer(int32 CubemapId, int32 SamplerId); void AddCubemapToBuffer(int32 CubemapId, int32 SamplerId);
void BroadcastWavelengthChange(float WL)
{
WavelengthChangedEvent.Broadcast(WL);
}
public: public:
...@@ -163,7 +169,7 @@ public: ...@@ -163,7 +169,7 @@ public:
FThreadSafeBool bValidCubemap = false; FThreadSafeBool bValidCubemap = false;
FLaserTraceFinishedEvent LaserTraceFinishedEvent; FLaserTraceFinishedEvent LaserTraceFinishedEvent;
FWavelengthChangedEvent WavelengthChangedEvent;
FOnSceneChangedDelegate OnSceneChangedDelegate; FOnSceneChangedDelegate OnSceneChangedDelegate;
......
...@@ -119,6 +119,9 @@ public: ...@@ -119,6 +119,9 @@ public:
UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXLensComponent") // TODO UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXLensComponent") // TODO
TArray<FString> GetGlassDefinitionNames(); TArray<FString> GetGlassDefinitionNames();
UFUNCTION()
void OnWavelengthChangedEvent(float WL);
public: public:
// Lens Properties // Lens Properties
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment