From 213983403d2d54040065b72819f36af0a756f7ca Mon Sep 17 00:00:00 2001 From: Jens Koenen <koenen@vis.rwth-aachen.de> Date: Mon, 14 Apr 2025 13:30:13 +0200 Subject: [PATCH] Fixed last bug and updated documentation --- README.md | 8 ++++---- Source/HMDSimulatorHMD/Private/SimulatedHMD.cpp | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b7740ef..196d883 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# THIS VERSION IS NOT WORKING RIGHT NOW - # HMD Simulator The HMD Simulator is an Unreal plugin that emulates a connected HMD and its controllers. Once the plugin is added to your project and enabled, you can [start in VR](Resources/VRLaunch.png) even if you do not have an HMD connected. @@ -27,8 +25,10 @@ As shown in the following image, if you want to control an action with the HMD S For the Unreal VR template, the following mappings could be used: **IMC_Default** -- IA_Grab_Left <-> HMDSimulator (L) Grip Button -- IA_Grab_Right <-> HMDSimulator (R) Grip Button +- IA_Grab_Left_Pressed <-> HMDSimulator (L) Grip Button +- IA_Grab_Right_Pressed <-> HMDSimulator (R) Grip Button +- IA_Grab_Left_Released <-> HMDSimulator (L) Grip Button +- IA_Grab_Right_Released <-> HMDSimulator (R) Grip Button - IA_Menu_Toggle_Left <-> HMDSimulator (L) Menu Button - IA_Menu_Toggle_Right <-> HMDSimulator (R) Menu Button diff --git a/Source/HMDSimulatorHMD/Private/SimulatedHMD.cpp b/Source/HMDSimulatorHMD/Private/SimulatedHMD.cpp index 5f4304b..63b65d6 100644 --- a/Source/HMDSimulatorHMD/Private/SimulatedHMD.cpp +++ b/Source/HMDSimulatorHMD/Private/SimulatedHMD.cpp @@ -250,13 +250,21 @@ void FSimulatedHMD::CopyTexture_RenderThread(FRHICommandListImmediate& RHICmdLis const bool bSameSize = DstRect.Size() == SrcRect.Size(); if (bSameSize) { - //FRHIBatchedShaderParameters& BatchedParameters, FRHISamplerState* SamplerStateRHI, FRHITexture* TextureRHI - - PixelShader->SetParameters(RHICmdList, TStaticSamplerState<SF_Point>::GetRHI(), SrcTexture); + FRHIBatchedShaderParametersAllocator* batch_allocator = RHICmdList.CreateBatchedShaderParameterAllocator(ERHIBatchedShaderParameterAllocatorPageSize::Small); + FRHIBatchedShaderParameters batch(*batch_allocator); + + PixelShader->SetParameters(batch, TStaticSamplerState<SF_Point>::GetRHI(), SrcTexture); + + RHICmdList.SetBatchedShaderParameters(PixelShader.GetPixelShader(), batch); } else { - PixelShader->SetParameters(RHICmdList, TStaticSamplerState<SF_Bilinear>::GetRHI(), SrcTexture); + FRHIBatchedShaderParametersAllocator* batch_allocator = RHICmdList.CreateBatchedShaderParameterAllocator(ERHIBatchedShaderParameterAllocatorPageSize::Small); + FRHIBatchedShaderParameters batch(*batch_allocator); + + PixelShader->SetParameters(batch, TStaticSamplerState<SF_Bilinear>::GetRHI(), SrcTexture); + + RHICmdList.SetBatchedShaderParameters(PixelShader.GetPixelShader(), batch); } RendererModule->DrawRectangle( -- GitLab