当前位置: 首页>>代码示例>>C++>>正文


C++ VRManager::GetController方法代码示例

本文整理汇总了C++中VRManager::GetController方法的典型用法代码示例。如果您正苦于以下问题:C++ VRManager::GetController方法的具体用法?C++ VRManager::GetController怎么用?C++ VRManager::GetController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VRManager的用法示例。


在下文中一共展示了VRManager::GetController方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: IPC_OK

mozilla::ipc::IPCResult
VRManagerParent::RecvCreateVRServiceTestController(const nsCString& aID, const uint32_t& aPromiseID)
{
  uint32_t controllerIdx = 1; // ID's are 1 based
  nsTArray<VRControllerInfo> controllerInfoArray;
  impl::VRControllerPuppet* controllerPuppet = nullptr;
  VRManager* vm = VRManager::Get();

  /**
   * When running headless mochitests on some of our automated test
   * infrastructure, 2d display vsyncs are not always generated.
   * In this case, the test controllers can't be created immediately
   * after the VR display was created as the state of the VR displays
   * are updated during vsync.
   * To workaround, we produce a vsync manually.
   */
  vm->NotifyVsync(TimeStamp::Now());

  // 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;
    }
  }

  // We might not have a controllerPuppet if the test did
  // not create a VR display first.
  if (!controllerPuppet) {
    // We send a device ID of "0" to indicate failure
    if (SendReplyCreateVRServiceTestController(aID, aPromiseID, 0)) {
      return IPC_OK();
    }
  } else {
    if (!mVRControllerTests.Get(mControllerTestID, nullptr)) {
      mVRControllerTests.Put(mControllerTestID, controllerPuppet);
    }

    if (SendReplyCreateVRServiceTestController(aID, aPromiseID, mControllerTestID)) {
      ++mControllerTestID;
      return IPC_OK();
    }
  }

  return IPC_FAIL(this, "SendReplyCreateVRServiceTestController fail");
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:51,代码来源:VRManagerParent.cpp


注:本文中的VRManager::GetController方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。