1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 #ifndef DEVICE_VR_WINDOWS_MIXED_REALITY_WRAPPERS_WMR_HOLOGRAPHIC_FRAME_H_ 5 #define DEVICE_VR_WINDOWS_MIXED_REALITY_WRAPPERS_WMR_HOLOGRAPHIC_FRAME_H_ 6 7 #include <windows.graphics.holographic.h> 8 #include <wrl.h> 9 10 #include <memory> 11 #include <vector> 12 13 #include "base/macros.h" 14 15 namespace device { 16 class WMRCameraPose; 17 class WMRRenderingParameters; 18 class WMRTimestamp; 19 20 class WMRHolographicFramePrediction { 21 public: 22 virtual ~WMRHolographicFramePrediction() = default; 23 24 virtual std::unique_ptr<WMRTimestamp> Timestamp() = 0; 25 virtual std::vector<std::unique_ptr<WMRCameraPose>> CameraPoses() = 0; 26 }; 27 28 class WMRHolographicFramePredictionImpl : public WMRHolographicFramePrediction { 29 public: 30 explicit WMRHolographicFramePredictionImpl( 31 Microsoft::WRL::ComPtr< 32 ABI::Windows::Graphics::Holographic::IHolographicFramePrediction> 33 prediction); 34 ~WMRHolographicFramePredictionImpl() override; 35 36 std::unique_ptr<WMRTimestamp> Timestamp() override; 37 std::vector<std::unique_ptr<WMRCameraPose>> CameraPoses() override; 38 39 private: 40 Microsoft::WRL::ComPtr< 41 ABI::Windows::Graphics::Holographic::IHolographicFramePrediction> 42 prediction_; 43 44 DISALLOW_COPY_AND_ASSIGN(WMRHolographicFramePredictionImpl); 45 }; 46 47 class WMRHolographicFrame { 48 public: 49 virtual ~WMRHolographicFrame() = default; 50 51 virtual std::unique_ptr<WMRHolographicFramePrediction> 52 CurrentPrediction() = 0; 53 virtual std::unique_ptr<WMRRenderingParameters> TryGetRenderingParameters( 54 const WMRCameraPose* pose) = 0; 55 virtual bool TryPresentUsingCurrentPrediction() = 0; 56 }; 57 58 class WMRHolographicFrameImpl : public WMRHolographicFrame { 59 public: 60 explicit WMRHolographicFrameImpl( 61 Microsoft::WRL::ComPtr< 62 ABI::Windows::Graphics::Holographic::IHolographicFrame> 63 holographic_frame); 64 ~WMRHolographicFrameImpl() override; 65 66 std::unique_ptr<WMRHolographicFramePrediction> CurrentPrediction() override; 67 std::unique_ptr<WMRRenderingParameters> TryGetRenderingParameters( 68 const WMRCameraPose* pose) override; 69 bool TryPresentUsingCurrentPrediction() override; 70 71 private: 72 Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Holographic::IHolographicFrame> 73 holographic_frame_; 74 75 DISALLOW_COPY_AND_ASSIGN(WMRHolographicFrameImpl); 76 }; 77 78 } // namespace device 79 #endif // DEVICE_VR_WINDOWS_MIXED_REALITY_WRAPPERS_WMR_HOLOGRAPHIC_FRAME_H_ 80