本文整理汇总了C++中HMDState类的典型用法代码示例。如果您正苦于以下问题:C++ HMDState类的具体用法?C++ HMDState怎么用?C++ HMDState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HMDState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ovrHmd_AttachToWindow
OVR_EXPORT ovrBool ovrHmd_AttachToWindow( ovrHmd hmd, void* window,
const ovrRecti* destMirrorRect,
const ovrRecti* sourceRenderTargetRect )
{
OVR_UNUSED( destMirrorRect );
OVR_UNUSED( sourceRenderTargetRect );
if (!CAPI_ovrInitializeCalled)
return false;
if (!hmd || !hmd->Handle)
return false;
#ifndef OVR_OS_MAC
HMDState* hmds = (HMDState*)hmd->Handle;
CAPI_pNetClient->Hmd_AttachToWindow(hmds->GetNetId(), window);
hmds->pWindow = window;
#endif
#ifdef OVR_OS_WIN32
Win32::DisplayShim::GetInstance().hWindow = (HWND)window;
#endif
#ifdef OVR_OS_MAC
OVR_UNUSED(window);
#endif
return true;
}
示例2: ovrHmd_EndEyeRender
OVR_EXPORT void ovrHmd_EndEyeRender(ovrHmd hmd, ovrEyeType eye,
ovrPosef renderPose, ovrTexture* eyeTexture)
{
HMDState* hmds = (HMDState*)hmd;
if (!hmds) return;
hmds->EndEyeRender(eye, renderPose, eyeTexture);
}
示例3: getHSWTimeKey
// Returns HSWDisplayTimeNever (0) if there is no profile or this is the first time we are seeing this profile.
time_t HSWDisplay::GetCurrentProfileLastHSWTime() const
{
// We store the timeout value in HMDState's pProfile.
HMDState* pHMDState = (HMDState*)HMD->Handle;
if (pHMDState)
{
const char* profileName = pHMDState->pProfile ? pHMDState->pProfile->GetValue(OVR_KEY_USER) : NULL;
if (profileName)
{
if (LastProfileName == profileName)
{
return LastHSWTime;
}
LastProfileName = profileName;
String timeKey = getHSWTimeKey(profileName);
int lastTime = pHMDState->getIntValue(timeKey.ToCStr(), (int)HSWDisplayTimeNever);
LastHSWTime = lastTime;
return lastTime;
}
}
return HSWDisplayTimeNever;
}
示例4: OVR_DEBUG_LOG
HMDState* HMDState::CreateHMDState(NetClient* client, const HMDNetworkInfo& netInfo)
{
// HMDState works through a handle to service HMD....
HMDInfo hinfo;
if (!client->Hmd_GetHmdInfo(netInfo.NetId, &hinfo))
{
OVR_DEBUG_LOG(("[HMDState] Unable to get HMD info"));
return nullptr;
}
#if !defined(HEADLESS_APP)
#ifdef OVR_OS_WIN32
OVR_DEBUG_LOG(("[HMDState] Setting up display shim"));
// Initialize the display shim before reporting the display to the user code
// so that this will happen before the D3D display object is created.
Win32::DisplayShim::GetInstance().Update(&hinfo.ShimInfo);
#endif
#endif /* !defined(HEADLESS_APP) */
Ptr<Profile> pDefaultProfile = *ProfileManager::GetInstance()->GetDefaultUserProfile(&hinfo);
OVR_DEBUG_LOG(("[HMDState] Using profile %s", pDefaultProfile->GetValue(OVR_KEY_USER)));
HMDState* hmds = new HMDState(hinfo, pDefaultProfile, &netInfo, client);
if (!hmds->InitializeSharedState())
{
delete hmds;
return nullptr;
}
return hmds;
}
示例5: ovrHmd_GetEyePose
OVR_EXPORT ovrPosef ovrHmd_GetEyePose(ovrHmd hmd, ovrEyeType eye)
{
HMDState* hmds = (HMDState*)hmd;
if (!hmds) return ovrPosef();
hmds->checkBeginFrameTimingScope("ovrHmd_GetEyePose");
return hmds->TimeManager.GetEyePredictionPose(hmd, eye);
}
示例6: ovrHmd_SetEnabledCaps
// Modifies capability bits described by ovrHmdCapBits that can be modified,
// such as ovrHmdCap_LowPersistance.
OVR_EXPORT void ovrHmd_SetEnabledCaps(ovrHmd hmddesc, unsigned int capsBits)
{
HMDState* p = (HMDState*)hmddesc->Handle;
if (p)
{
p->SetEnabledHmdCaps(capsBits);
}
}
示例7: ovrHmd_SetFloat
OVR_EXPORT ovrBool ovrHmd_SetFloat(ovrHmd hmd, const char* propertyName, float value)
{
HMDState* hmds = (HMDState*)hmd;
if (hmds)
{
return hmds->setFloatValue(propertyName, value);
}
return false;
}
示例8: ovrHmd_AddDistortionTimeMeasurement
OVR_EXPORT void ovrHmd_AddDistortionTimeMeasurement(ovrHmd hmddesc, double distortionTimeSeconds)
{
if (!hmddesc)
return;
HMDState* hmds = (HMDState*)hmddesc->Handle;
hmds->checkBeginFrameTimingScope("ovrHmd_GetTimewarpEyeMatrices");
hmds->TimeManager.AddDistortionTimeMeasurement(distortionTimeSeconds);
}
示例9: ovrHmd_GetFloat
OVR_EXPORT float ovrHmd_GetFloat(ovrHmd hmd, const char* propertyName, float defaultVal)
{
HMDState* hmds = (HMDState*)hmd;
if (hmds)
{
return hmds->getFloatValue(propertyName, defaultVal);
}
return defaultVal;
}
示例10: ovrHmd_SetBool
OVR_EXPORT ovrBool ovrHmd_SetBool(ovrHmd hmddesc, const char* propertyName, ovrBool value)
{
OVR_ASSERT(hmddesc && propertyName);
HMDState* hmds = (HMDState*)hmddesc->Handle;
if (hmds)
{
return hmds->setBoolValue(propertyName, value != 0) ? 1 : 0;
}
return false;
}
示例11: ovrHmd_GetString
OVR_EXPORT const char* ovrHmd_GetString(ovrHmd hmd, const char* propertyName,
const char* defaultVal)
{
HMDState* hmds = (HMDState*)hmd;
if (hmds)
{
return hmds->getString(propertyName, defaultVal);
}
return defaultVal;
}
示例12: ovrHmd_ConfigureTracking
OVR_EXPORT ovrBool ovrHmd_ConfigureTracking(ovrHmd hmddesc, unsigned int supportedCaps,
unsigned int requiredCaps)
{
if (hmddesc)
{
HMDState* p = (HMDState*)hmddesc->Handle;
return p->ConfigureTracking(supportedCaps, requiredCaps);
}
return 0;
}
示例13: ovrHmd_SetFloatArray
// Modify float[] property; false if property doesn't exist or is readonly.
OVR_EXPORT ovrBool ovrHmd_SetFloatArray(ovrHmd hmd, const char* propertyName,
float values[], unsigned int arraySize)
{
HMDState* hmds = (HMDState*)hmd;
if (hmds)
{
return hmds->setFloatArray(propertyName, values, arraySize);
}
return 0;
}
示例14: ovrHmd_EndFrame
// Renders textures to frame buffer
OVR_EXPORT void ovrHmd_EndFrame(ovrHmd hmddesc,
const ovrPosef renderPose[2],
const ovrTexture eyeTexture[2])
{
HMDState* hmds = (HMDState*)hmddesc->Handle;
if (!hmds) return;
// Instrument when the EndFrame() call started
hmds->LagStats.InstrumentEndFrameStart(ovr_GetTimeInSeconds());
hmds->SubmitEyeTextures(renderPose, eyeTexture);
// Debug state checks: Must be in BeginFrame, on the same thread.
hmds->checkBeginFrameScope("ovrHmd_EndFrame");
ThreadChecker::Scope checkScope(&hmds->RenderAPIThreadChecker, "ovrHmd_EndFrame");
hmds->pRenderer->SetLatencyTestColor(hmds->LatencyTestActive ? hmds->LatencyTestDrawColor : NULL);
ovrHmd_GetLatencyTest2DrawColor(hmddesc, NULL); // We don't actually need to draw color, so send NULL
if (hmds->pRenderer)
{
hmds->pRenderer->SaveGraphicsState();
// See if we need to show the HSWDisplay.
if (hmds->pHSWDisplay) // Until we know that these are valid, assume any of them can't be.
{
ovrHSWDisplayState hswDisplayState;
hmds->pHSWDisplay->TickState(&hswDisplayState, true); // This may internally call HASWarning::Display.
if (hswDisplayState.Displayed)
{
hmds->pHSWDisplay->Render(ovrEye_Left, &eyeTexture[ovrEye_Left]);
hmds->pHSWDisplay->Render(ovrEye_Right, &eyeTexture[ovrEye_Right]);
}
}
hmds->pRenderer->EndFrame(true);
hmds->pRenderer->RestoreGraphicsState();
}
// Call after present
ovrHmd_EndFrameTiming(hmddesc);
// Instrument latency tester
hmds->LagStats.InstrumentLatencyTimings(hmds->TimeManager);
// Instrument when the EndFrame() call ended
hmds->LagStats.InstrumentEndFrameEnd(ovr_GetTimeInSeconds());
// Out of BeginFrame
hmds->BeginFrameThreadId = 0;
hmds->BeginFrameCalled = false;
}
示例15: ovrHmd_GetInt
OVR_EXPORT int ovrHmd_GetInt(ovrHmd hmddesc, const char* propertyName, int defaultVal)
{
OVR_ASSERT(hmddesc && propertyName);
HMDState* hmds = (HMDState*)hmddesc->Handle;
if (hmds)
{
return hmds->getIntValue(propertyName, defaultVal);
}
return defaultVal;
}