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
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -360,6 +360,7 @@ bool UOptiXLaserComponent::GetTargetColorMode() const
void UOptiXLaserComponent::SetWavelength(float WL)
{
Wavelength = WL;
FOptiXModule::Get().GetOptiXContextManager()->BroadcastWavelengthChange(WL);
bUpdateQueued.AtomicSet(true);
}
......
......@@ -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);
}
......@@ -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;
}
//------------------------------------------------------------------------------
// 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 @@
// 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;
......
......@@ -119,6 +119,9 @@ public:
UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXLensComponent") // TODO
TArray<FString> GetGlassDefinitionNames();
UFUNCTION()
void OnWavelengthChangedEvent(float WL);
public:
// Lens Properties
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment