blob: 5f72dad5423e6689d78ff880747a044ac6cf2fd7 [file] [log] [blame]
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/vr/oculus/oculus_type_converters.h"
#include <math.h>
#include <iterator>
#include <vector>
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "third_party/libovr/src/Include/OVR_CAPI.h"
namespace mojo {
TypeConverter<device::mojom::VRPosePtr, ovrPosef>::Convert(
const ovrPosef& hmd_pose) {
device::mojom::VRPosePtr pose = device::mojom::VRPose::New();
pose->orientation =
std::vector<float>({hmd_pose.Orientation.x, hmd_pose.Orientation.y,
hmd_pose.Orientation.z, hmd_pose.Orientation.w});
pose->position = std::vector<float>(
{hmd_pose.Position.x, hmd_pose.Position.y, hmd_pose.Position.z});
// TODO: If we want linear/angular velocity, we need to convert a
// ovrPoseStatef.
return pose;
} // namespace mojo