本文整理汇总了C++中VRManager类的典型用法代码示例。如果您正苦于以下问题:C++ VRManager类的具体用法?C++ VRManager怎么用?C++ VRManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VRManager类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IPC_OK
mozilla::ipc::IPCResult
VRManagerParent::RecvCreateVRServiceTestController(const nsCString& aID, const uint32_t& aPromiseID)
{
uint32_t controllerIdx = 0;
nsTArray<VRControllerInfo> controllerInfoArray;
impl::VRControllerPuppet* controllerPuppet = nullptr;
VRManager* vm = VRManager::Get();
// Get VRControllerPuppet from VRManager
vm->GetVRControllerInfo(controllerInfoArray);
for (auto& controllerInfo : controllerInfoArray) {
if (controllerInfo.GetType() == VRDeviceType::Puppet) {
if (controllerIdx == mControllerTestID) {
controllerPuppet = static_cast<impl::VRControllerPuppet*>(
vm->GetController(controllerInfo.GetControllerID()).get());
break;
}
++controllerIdx;
}
}
MOZ_ASSERT(controllerPuppet);
MOZ_ASSERT(mControllerTestID < 2); // We have only two controllers in VRSystemManagerPuppet.
if (!mVRControllerTests.Get(mControllerTestID, nullptr)) {
mVRControllerTests.Put(mControllerTestID, controllerPuppet);
}
if (SendReplyCreateVRServiceTestController(aID, aPromiseID, mControllerTestID)) {
++mControllerTestID;
return IPC_OK();
}
return IPC_FAIL(this, "SendReplyCreateVRServiceTestController fail");
}
示例2:
void
VRManagerParent::RegisterWithManager()
{
VRManager* vm = VRManager::Get();
vm->AddVRManagerParent(this);
mVRManagerHolder = vm;
}
示例3: IPC_OK
mozilla::ipc::IPCResult
VRManagerParent::RecvGetDisplays(nsTArray<VRDisplayInfo> *aDisplays)
{
VRManager* vm = VRManager::Get();
vm->GetVRDisplayInfo(*aDisplays);
return IPC_OK();
}
示例4: IPC_OK
mozilla::ipc::IPCResult
VRManagerParent::RecvStopVibrateHaptic(const uint32_t& aControllerIdx)
{
VRManager* vm = VRManager::Get();
vm->StopVibrateHaptic(aControllerIdx);
return IPC_OK();
}
示例5:
bool
VRLayerParent::RecvSubmitFrame(PTextureParent* texture)
{
VRManager* vm = VRManager::Get();
vm->SubmitFrame(this, texture, mLeftEyeRect, mRightEyeRect);
return true;
}
示例6: MOZ_ASSERT
void
CompositorVsyncScheduler::DispatchVREvents(TimeStamp aVsyncTimestamp)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
VRManager* vm = VRManager::Get();
vm->NotifyVsync(aVsyncTimestamp);
}
示例7: IPC_OK
mozilla::ipc::IPCResult
VRLayerParent::RecvSubmitFrame(PTextureParent* texture)
{
if (mVRDisplayID) {
VRManager* vm = VRManager::Get();
vm->SubmitFrame(this, texture, mLeftEyeRect, mRightEyeRect);
}
return IPC_OK();
}
示例8: autoLock
void
VRDisplayHost::SubmitFrame(VRLayerParent* aLayer, PTextureParent* aTexture,
const gfx::Rect& aLeftEyeRect,
const gfx::Rect& aRightEyeRect)
{
if ((mDisplayInfo.mGroupMask & aLayer->GetGroup()) == 0) {
// Suppress layers hidden by the group mask
return;
}
TextureHost* th = TextureHost::AsTextureHost(aTexture);
// WebVR doesn't use the compositor to compose the frame, so use
// AutoLockTextureHostWithoutCompositor here.
AutoLockTextureHostWithoutCompositor autoLock(th);
if (autoLock.Failed()) {
NS_WARNING("Failed to lock the VR layer texture");
return;
}
CompositableTextureSourceRef source;
if (!th->BindTextureSource(source)) {
NS_WARNING("The TextureHost was successfully locked but can't provide a TextureSource");
return;
}
MOZ_ASSERT(source);
IntSize texSize = source->GetSize();
TextureSourceD3D11* sourceD3D11 = source->AsSourceD3D11();
if (!sourceD3D11) {
NS_WARNING("WebVR support currently only implemented for D3D11");
return;
}
if (!SubmitFrame(sourceD3D11, texSize, aLeftEyeRect, aRightEyeRect)) {
return;
}
/**
* Trigger the next VSync immediately after we are successfully
* submitting frames. As SubmitFrame is responsible for throttling
* the render loop, if we don't successfully call it, we shouldn't trigger
* NotifyVRVsync immediately, as it will run unbounded.
* If NotifyVRVsync is not called here due to SubmitFrame failing, the
* fallback "watchdog" code in VRDisplayHost::NotifyVSync() will cause
* frames to continue at a lower refresh rate until frame submission
* succeeds again.
*/
VRManager *vm = VRManager::Get();
MOZ_ASSERT(vm);
vm->NotifyVRVsync(mDisplayInfo.mDisplayID);
}
示例9: StopPresentation
void
VRDisplayHost::RemoveLayer(VRLayerParent *aLayer)
{
mLayers.RemoveElement(aLayer);
if (mLayers.Length() == 0) {
StopPresentation();
}
mDisplayInfo.mIsPresenting = mLayers.Length() > 0;
// Ensure that the content process receives the change immediately
VRManager* vm = VRManager::Get();
vm->RefreshVRDisplays();
}