summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/xr/xr_stationary_reference_space.h
blob: d1065509bf6ad2874bdbbcb951cadca0f28ae916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2018 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.

#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_STATIONARY_REFERENCE_SPACE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_STATIONARY_REFERENCE_SPACE_H_

#include "third_party/blink/renderer/modules/xr/xr_reference_space.h"
#include "third_party/blink/renderer/platform/transforms/transformation_matrix.h"

namespace blink {

class XRStationaryReferenceSpace final : public XRReferenceSpace {
  DEFINE_WRAPPERTYPEINFO();

 public:
  enum Subtype {
    kSubtypeEyeLevel,
    kSubtypeFloorLevel,
    kSubtypePositionDisabled
  };

  XRStationaryReferenceSpace(XRSession*, Subtype);
  ~XRStationaryReferenceSpace() override;

  std::unique_ptr<TransformationMatrix> TransformBasePose(
      const TransformationMatrix& base_pose) override;
  std::unique_ptr<TransformationMatrix> TransformBaseInputPose(
      const TransformationMatrix& base_input_pose,
      const TransformationMatrix& base_pose) override;

  const String& subtype() const { return subtype_string_; }

  void Trace(blink::Visitor*) override;

 private:
  void UpdateFloorLevelTransform();

  unsigned int display_info_id_ = 0;
  Subtype subtype_;
  String subtype_string_;
  std::unique_ptr<TransformationMatrix> floor_level_transform_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_STATIONARY_REFERENCE_SPACE_H_