| Index: device/vr/test/fake_vr_device.cc
|
| diff --git a/device/vr/test/fake_vr_device.cc b/device/vr/test/fake_vr_device.cc
|
| index d6c1b9527b81d3b6958610e95aa4b104a1e5e908..48e7138dd074fb2199c9a7f0b1748ff9feea5757 100644
|
| --- a/device/vr/test/fake_vr_device.cc
|
| +++ b/device/vr/test/fake_vr_device.cc
|
| @@ -9,10 +9,47 @@ namespace device {
|
| FakeVRDevice::FakeVRDevice(VRDeviceProvider* provider) : VRDevice(provider) {
|
| device_ = VRDisplay::New();
|
| pose_ = VRPose::New();
|
| +
|
| + InitBasicDevice();
|
| }
|
|
|
| FakeVRDevice::~FakeVRDevice() {}
|
|
|
| +void FakeVRDevice::InitBasicDevice() {
|
| + device_->displayName = "FakeVRDevice";
|
| +
|
| + device_->capabilities = VRDisplayCapabilities::New();
|
| + device_->capabilities->hasOrientation = true;
|
| + device_->capabilities->hasPosition = false;
|
| + device_->capabilities->hasExternalDisplay = false;
|
| + device_->capabilities->canPresent = false;
|
| +
|
| + device_->leftEye = InitEye(45, -0.03f, 1024);
|
| + device_->rightEye = InitEye(45, 0.03f, 1024);
|
| +}
|
| +
|
| +VREyeParametersPtr FakeVRDevice::InitEye(float fov,
|
| + float offset,
|
| + uint32_t size) {
|
| + VREyeParametersPtr eye = VREyeParameters::New();
|
| +
|
| + eye->fieldOfView = VRFieldOfView::New();
|
| + eye->fieldOfView->upDegrees = fov;
|
| + eye->fieldOfView->downDegrees = fov;
|
| + eye->fieldOfView->leftDegrees = fov;
|
| + eye->fieldOfView->rightDegrees = fov;
|
| +
|
| + eye->offset = mojo::Array<float>::New(3);
|
| + eye->offset[0] = offset;
|
| + eye->offset[1] = 0.0f;
|
| + eye->offset[2] = 0.0f;
|
| +
|
| + eye->renderWidth = size;
|
| + eye->renderHeight = size;
|
| +
|
| + return eye;
|
| +}
|
| +
|
| void FakeVRDevice::SetVRDevice(const VRDisplayPtr& device) {
|
| device_ = device.Clone();
|
| }
|
| @@ -22,7 +59,9 @@ void FakeVRDevice::SetPose(const VRPosePtr& pose) {
|
| }
|
|
|
| VRDisplayPtr FakeVRDevice::GetVRDevice() {
|
| - return device_.Clone();
|
| + VRDisplayPtr display = device_.Clone();
|
| + display->index = id();
|
| + return display.Clone();
|
| }
|
|
|
| VRPosePtr FakeVRDevice::GetPose() {
|
|
|