Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GHOST_XrControllerModel.h « intern « ghost « intern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9f90408e62bc20173214238542427243f92535ee (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
/* SPDX-License-Identifier: GPL-2.0-or-later */

/** \file
 * \ingroup GHOST
 */

/* NOTE: Requires OpenXR headers to be included before this one for OpenXR types (XrInstance,
 * XrSession, etc.). */

#pragma once

#include <atomic>
#include <future>
#include <vector>

struct GHOST_XrControllerModelNode;

/**
 * OpenXR glTF controller model.
 */
class GHOST_XrControllerModel {
 public:
  GHOST_XrControllerModel(XrInstance instance, const char *subaction_path);
  ~GHOST_XrControllerModel();

  void load(XrSession session);
  void updateComponents(XrSession session);
  void getData(GHOST_XrControllerModelData &r_data);

 private:
  XrPath m_subaction_path = XR_NULL_PATH;
  XrControllerModelKeyMSFT m_model_key = XR_NULL_CONTROLLER_MODEL_KEY_MSFT;

  std::future<void> m_load_task;
  std::atomic<bool> m_data_loaded = false;

  std::vector<GHOST_XrControllerModelVertex> m_vertices;
  std::vector<uint32_t> m_indices;
  std::vector<GHOST_XrControllerModelComponent> m_components;
  std::vector<GHOST_XrControllerModelNode> m_nodes;
  /** Maps node states to nodes. */
  std::vector<int32_t> m_node_state_indices;

  void loadControllerModel(XrSession session);
};