Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/modules/openxr/extensions/openxr_valve_analog_threshold_extension.h
10278 views
1
/**************************************************************************/
2
/* openxr_valve_analog_threshold_extension.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "../action_map/openxr_binding_modifier.h"
34
#include "../action_map/openxr_haptic_feedback.h"
35
#include "../util.h"
36
#include "core/io/resource.h"
37
#include "openxr_extension_wrapper.h"
38
39
class OpenXRValveAnalogThresholdExtension : public OpenXRExtensionWrapper {
40
GDCLASS(OpenXRValveAnalogThresholdExtension, OpenXRExtensionWrapper);
41
42
protected:
43
static void _bind_methods() {}
44
45
public:
46
static OpenXRValveAnalogThresholdExtension *get_singleton();
47
48
OpenXRValveAnalogThresholdExtension();
49
virtual ~OpenXRValveAnalogThresholdExtension() override;
50
51
virtual HashMap<String, bool *> get_requested_extensions() override;
52
53
bool is_available();
54
55
private:
56
static OpenXRValveAnalogThresholdExtension *singleton;
57
58
bool binding_modifier_ext = false;
59
bool threshold_ext = false;
60
};
61
62
class OpenXRAnalogThresholdModifier : public OpenXRActionBindingModifier {
63
GDCLASS(OpenXRAnalogThresholdModifier, OpenXRActionBindingModifier);
64
65
private:
66
XrInteractionProfileAnalogThresholdVALVE analog_threshold;
67
Ref<OpenXRHapticBase> on_haptic;
68
Ref<OpenXRHapticBase> off_haptic;
69
70
protected:
71
static void _bind_methods();
72
73
public:
74
OpenXRAnalogThresholdModifier();
75
76
void set_on_threshold(float p_threshold);
77
float get_on_threshold() const;
78
79
void set_off_threshold(float p_threshold);
80
float get_off_threshold() const;
81
82
void set_on_haptic(const Ref<OpenXRHapticBase> &p_haptic);
83
Ref<OpenXRHapticBase> get_on_haptic() const;
84
85
void set_off_haptic(const Ref<OpenXRHapticBase> &p_haptic);
86
Ref<OpenXRHapticBase> get_off_haptic() const;
87
88
virtual String get_description() const override { return "Analog threshold modifier"; }
89
virtual PackedByteArray get_ip_modification() override;
90
};
91
92