work on openxr controllers
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "netprotocol.h"
|
||||
#include "userinput.h"
|
||||
#include "math.h"
|
||||
#include "cglm/euler.h"
|
||||
#ifdef STEAM
|
||||
#include "steam/isteamgameserver.h"
|
||||
#include "steam/steam_gameserver.h"
|
||||
@@ -36,6 +37,9 @@ IEngineBridge *EngineBridge()
|
||||
return &s_bridge;
|
||||
}
|
||||
|
||||
void XRInputCallback( IXRController *pController, EXRInputType_t eType, const char *szType, EXRInputActionType_t action, EXRInputValue_t value );
|
||||
|
||||
|
||||
EXPOSE_INTERFACE_FN(EngineBridge, IEngineBridge, ENGINE_BRIDGE_INTERFACE_VERSION)
|
||||
|
||||
void CFunnyGameBridge::Init()
|
||||
@@ -101,6 +105,11 @@ void CFunnyGameBridge::Init()
|
||||
g_pRenderContext->DestroyCommandList(pDoSomething);
|
||||
}
|
||||
}
|
||||
for ( uint32_t i = 0; i < pHeadSet->GetControllerCount(); i++ )
|
||||
{
|
||||
pHeadSet->GetController(i)->SetInputCallback(XRInputCallback);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CFunnyGameBridge::Tick( float fDelta )
|
||||
@@ -145,6 +154,17 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
|
||||
TryToConnectToServer();
|
||||
|
||||
|
||||
g_pXRManager->Frame();
|
||||
|
||||
IXRHeadset *pHeadSet = g_pXRManager->GetHeadset(0);
|
||||
if (pHeadSet) {
|
||||
XRRenderSurface_t s = pHeadSet->GetSurface(0);
|
||||
g_pWorldRenderer->SetCameraPosition(s.m_vPosition);
|
||||
V_printf("%f\n", s.m_vPosition.y);
|
||||
g_pWorldRenderer->SetCameraRotation(s.m_vRotation);
|
||||
}
|
||||
|
||||
INetworkBase *pCurrentServer = g_pServerBridge;
|
||||
pCurrentServer = g_pServerBridge;
|
||||
if (m_bIsConnectedToServer)
|
||||
@@ -197,8 +217,6 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
EntitySystem()->NetSendThink(pCurrentServer);
|
||||
}
|
||||
g_pWorldRenderer->Frame(fDelta);
|
||||
|
||||
g_pXRManager->Frame();
|
||||
}
|
||||
|
||||
void CFunnyGameBridge::Shutdown()
|
||||
|
||||
Reference in New Issue
Block a user