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

DNA_xr_types.h « makesdna « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44419c9763f66e3ffb6d024714be60270acc64f0 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* SPDX-License-Identifier: GPL-2.0-or-later */

/** \file
 * \ingroup DNA
 */

#pragma once

#include "DNA_view3d_types.h"

#ifdef __cplusplus
extern "C" {
#endif

/* -------------------------------------------------------------------- */

typedef struct XrSessionSettings {
  /** Shading settings, struct shared with 3D-View so settings are the same. */
  struct View3DShading shading;

  float base_scale;
  char _pad[3];
  char base_pose_type; /* #eXRSessionBasePoseType */
  /** Object to take the location and rotation as base position from. */
  Object *base_pose_object;
  float base_pose_location[3];
  float base_pose_angle;

  /** View3D draw flags (V3D_OFSDRAW_NONE, V3D_OFSDRAW_SHOW_ANNOTATION, ...). */
  char draw_flags;
  /** Draw style for controller visualization. */
  char controller_draw_style;
  char _pad2[2];

  /** Clipping distance. */
  float clip_start, clip_end;

  int flag;

  /** Object type settings to apply to VR view (unlike shading, not shared with window 3D-View). */
  int object_type_exclude_viewport;
  int object_type_exclude_select;
} XrSessionSettings;

typedef enum eXrSessionFlag {
  XR_SESSION_USE_POSITION_TRACKING = (1 << 0),
  XR_SESSION_USE_ABSOLUTE_TRACKING = (1 << 1),
} eXrSessionFlag;

typedef enum eXRSessionBasePoseType {
  XR_BASE_POSE_SCENE_CAMERA = 0,
  XR_BASE_POSE_OBJECT = 1,
  XR_BASE_POSE_CUSTOM = 2,
} eXRSessionBasePoseType;

typedef enum eXrSessionControllerDrawStyle {
  XR_CONTROLLER_DRAW_DARK = 0,
  XR_CONTROLLER_DRAW_LIGHT = 1,
  XR_CONTROLLER_DRAW_DARK_RAY = 2,
  XR_CONTROLLER_DRAW_LIGHT_RAY = 3,
} eXrSessionControllerDrawStyle;

/** XR action type. Enum values match those in GHOST_XrActionType enum for consistency. */
typedef enum eXrActionType {
  XR_BOOLEAN_INPUT = 1,
  XR_FLOAT_INPUT = 2,
  XR_VECTOR2F_INPUT = 3,
  XR_POSE_INPUT = 4,
  XR_VIBRATION_OUTPUT = 100,
} eXrActionType;

/** Determines how XR action operators are executed. */
typedef enum eXrOpFlag {
  XR_OP_PRESS = 0,
  XR_OP_RELEASE = 1,
  XR_OP_MODAL = 2,
} eXrOpFlag;

typedef enum eXrActionFlag {
  /** Action depends on two sub-action paths (i.e. two-handed/bi-manual action). */
  XR_ACTION_BIMANUAL = (1 << 0),
} eXrActionFlag;

typedef enum eXrHapticFlag {
  /** Whether to apply haptics to corresponding user paths for an action and its haptic action. */
  XR_HAPTIC_MATCHUSERPATHS = (1 << 0),
  /**
   * Determines how haptics will be applied
   * ("repeat" is mutually exclusive with "press"/"release").
   */
  XR_HAPTIC_PRESS = (1 << 1),
  XR_HAPTIC_RELEASE = (1 << 2),
  XR_HAPTIC_REPEAT = (1 << 3),
} eXrHapticFlag;

/**
 * For axis-based inputs (thumb-stick/track-pad/etc).
 * Determines the region for action execution (mutually exclusive per axis).
 */
typedef enum eXrAxisFlag {
  XR_AXIS0_POS = (1 << 0),
  XR_AXIS0_NEG = (1 << 1),
  XR_AXIS1_POS = (1 << 2),
  XR_AXIS1_NEG = (1 << 3),
} eXrAxisFlag;

typedef enum eXrPoseFlag {
  /* Pose represents controller grip/aim. */
  XR_POSE_GRIP = (1 << 0),
  XR_POSE_AIM = (1 << 1),
} eXrPoseFlag;

/**
 * The following user and component path lengths are dependent on OpenXR's XR_MAX_PATH_LENGTH
 * (256). A user path will be combined with a component path to identify an action binding, and
 * that combined path should also have a max of XR_MAX_PATH_LENGTH (e.g. user_path =
 * /user/hand/left, component_path = /input/trigger/value, full_path =
 * /user/hand/left/input/trigger/value).
 */
#define XR_MAX_USER_PATH_LENGTH 64
#define XR_MAX_COMPONENT_PATH_LENGTH 192

/* -------------------------------------------------------------------- */

typedef struct XrComponentPath {
  struct XrComponentPath *next, *prev;
  char path[192]; /* XR_MAX_COMPONENT_PATH_LENGTH */
} XrComponentPath;

typedef struct XrActionMapBinding {
  struct XrActionMapBinding *next, *prev;

  /** Unique name. */
  char name[64]; /* MAX_NAME */

  /** OpenXR interaction profile path. */
  char profile[256];
  /** OpenXR component paths. */
  ListBase component_paths; /* XrComponentPath */

  /** Input threshold/region. */
  float float_threshold;
  short axis_flag; /* eXrAxisFlag */
  char _pad[2];

  /** Pose action properties. */
  float pose_location[3];
  float pose_rotation[3];
} XrActionMapBinding;

/* -------------------------------------------------------------------- */

typedef struct XrUserPath {
  struct XrUserPath *next, *prev;
  char path[64]; /* XR_MAX_USER_PATH_LENGTH */
} XrUserPath;

typedef struct XrActionMapItem {
  struct XrActionMapItem *next, *prev;

  /** Unique name. */
  char name[64]; /* MAX_NAME */
  /** Type. */
  char type; /** eXrActionType */
  char _pad[7];

  /** OpenXR user paths. */
  ListBase user_paths; /* XrUserPath */

  /** Operator to be called on XR events. */
  char op[64]; /* OP_MAX_TYPENAME */
  /** Operator properties, assigned to ptr->data and can be written to a file. */
  IDProperty *op_properties;
  /** RNA pointer to access properties. */
  struct PointerRNA *op_properties_ptr;

  short op_flag;     /* eXrOpFlag */
  short action_flag; /* eXrActionFlag */
  short haptic_flag; /* eXrHapticFlag */

  /** Pose action properties. */
  short pose_flag; /* eXrPoseFlag */

  /** Haptic properties. */
  char haptic_name[64]; /* MAX_NAME */
  float haptic_duration;
  float haptic_frequency;
  float haptic_amplitude;

  short selbinding;
  char _pad3[2];
  ListBase bindings; /* XrActionMapBinding */
} XrActionMapItem;

/* -------------------------------------------------------------------- */

typedef struct XrActionMap {
  struct XrActionMap *next, *prev;

  /** Unique name. */
  char name[64]; /* MAX_NAME */

  ListBase items; /* XrActionMapItem */
  short selitem;
  char _pad[6];
} XrActionMap;

/* -------------------------------------------------------------------- */

#ifdef __cplusplus
}
#endif