mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Basic port of code
This commit is contained in:
parent
93a36f006f
commit
64b751a7c8
19 changed files with 613 additions and 374 deletions
|
|
@ -156,26 +156,27 @@ void OculusVRDevice::buildCodeTable()
|
|||
OculusVRSensorDevice::buildCodeTable();
|
||||
}
|
||||
|
||||
void OculusVRDevice::addHMDDevice(ovrHmd hmd)
|
||||
void OculusVRDevice::addHMDDevice(ovrHmd hmd, ovrGraphicsLuid luid)
|
||||
{
|
||||
if(!hmd)
|
||||
return;
|
||||
|
||||
OculusVRHMDDevice* hmdd = new OculusVRHMDDevice();
|
||||
hmdd->set(hmd,mHMDDevices.size());
|
||||
hmdd->set(hmd, luid, mHMDDevices.size());
|
||||
mHMDDevices.push_back(hmdd);
|
||||
|
||||
Con::printf(" HMD found: %s by %s [v%d]", hmd->ProductName, hmd->Manufacturer, hmd->Type);
|
||||
ovrHmdDesc desc = ovr_GetHmdDesc(hmd);
|
||||
Con::printf(" HMD found: %s by %s [v%d]", desc.ProductName, desc.Manufacturer, desc.Type);
|
||||
}
|
||||
|
||||
void OculusVRDevice::createSimulatedHMD()
|
||||
{
|
||||
{/* TOFIX
|
||||
OculusVRHMDDevice* hmdd = new OculusVRHMDDevice();
|
||||
ovrHmd hmd = ovrHmd_CreateDebug(ovrHmd_DK2);
|
||||
ovrHmd hmd = ovr_CreateDebug(ovrHmd_DK2);
|
||||
hmdd->set(hmd,mHMDDevices.size());
|
||||
mHMDDevices.push_back(hmdd);
|
||||
|
||||
Con::printf(" HMD simulated: %s by %s [v%d]", hmdd->getProductName(), hmdd->getManufacturer(), hmdd->getVersion());
|
||||
Con::printf(" HMD simulated: %s by %s [v%d]", hmdd->getProductName(), hmdd->getManufacturer(), hmdd->getVersion()); */
|
||||
}
|
||||
|
||||
bool OculusVRDevice::enable()
|
||||
|
|
@ -185,16 +186,17 @@ bool OculusVRDevice::enable()
|
|||
|
||||
Con::printf("Oculus VR Device Init:");
|
||||
|
||||
if(sOcculusEnabled && ovr_Initialize())
|
||||
if(sOcculusEnabled && OVR_SUCCESS(ovr_Initialize(0)))
|
||||
{
|
||||
mEnabled = true;
|
||||
|
||||
// Enumerate HMDs and pick the first one
|
||||
ovrHmd hmd = ovrHmd_Create(0);
|
||||
if(hmd)
|
||||
ovrHmd hmd;
|
||||
ovrGraphicsLuid luid;
|
||||
if(OVR_SUCCESS(ovr_Create(&hmd, &luid)))
|
||||
{
|
||||
// Add the HMD to our list
|
||||
addHMDDevice(hmd);
|
||||
addHMDDevice(hmd, luid);
|
||||
|
||||
setActive(true);
|
||||
}
|
||||
|
|
@ -700,7 +702,7 @@ DefineEngineFunction(getOVRHMDVersion, S32, (S32 index),,
|
|||
return hmd->getVersion();
|
||||
}
|
||||
|
||||
DefineEngineFunction(getOVRHMDDisplayDeviceName, const char*, (S32 index),,
|
||||
DefineEngineFunction(getOVRHMDDisplayDeviceType, const char*, (S32 index),,
|
||||
"@brief Windows display device name used in EnumDisplaySettings/CreateDC.\n\n"
|
||||
"@param index The HMD index.\n"
|
||||
"@return The name of the HMD display device, if any.\n"
|
||||
|
|
@ -717,7 +719,7 @@ DefineEngineFunction(getOVRHMDDisplayDeviceName, const char*, (S32 index),,
|
|||
return "";
|
||||
}
|
||||
|
||||
return hmd->getDisplayDeviceName();
|
||||
return hmd->getDisplayDeviceType();
|
||||
}
|
||||
|
||||
DefineEngineFunction(getOVRHMDDisplayDeviceId, S32, (S32 index),,
|
||||
|
|
@ -740,26 +742,6 @@ DefineEngineFunction(getOVRHMDDisplayDeviceId, S32, (S32 index),,
|
|||
return hmd->getDisplayDeviceId();
|
||||
}
|
||||
|
||||
DefineEngineFunction(getOVRHMDDisplayDesktopPos, Point2I, (S32 index),,
|
||||
"@brief Desktop coordinate position of the screen (can be negative; may not be present on all platforms).\n\n"
|
||||
"@param index The HMD index.\n"
|
||||
"@return Position of the screen.\n"
|
||||
"@ingroup Game")
|
||||
{
|
||||
if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
|
||||
{
|
||||
return Point2I::Zero;
|
||||
}
|
||||
|
||||
const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
|
||||
if(!hmd)
|
||||
{
|
||||
return Point2I::Zero;
|
||||
}
|
||||
|
||||
return hmd->getDesktopPosition();
|
||||
}
|
||||
|
||||
DefineEngineFunction(getOVRHMDResolution, Point2I, (S32 index),,
|
||||
"@brief Provides the OVR HMD screen resolution.\n\n"
|
||||
"@param index The HMD index.\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue