OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
orientation.hpp
1#pragma once
2#include <ossia/network/dataspace/dataspace_base.hpp>
3#include <ossia/network/domain/domain_base_impl.hpp>
4
5namespace ossia
6{
7
8struct quaternion_u;
9struct orientation_u;
10template <typename Impl>
11struct orientation_unit
12{
13 using is_unit = std::true_type;
14 using is_multidimensional = std::true_type;
15 using dataspace_type = orientation_u;
16 using neutral_unit = quaternion_u;
17 using concrete_type = Impl;
18};
19
20struct OSSIA_EXPORT quaternion_u : public orientation_unit<quaternion_u>
21{
22 static constexpr auto text()
23 {
24 constexpr_return(ossia::make_string_array("quaternion", "quat"));
25 }
26 static constexpr auto array_parameters()
27 {
28 constexpr_return(ossia::make_string_view("abcd"));
29 }
30 static constexpr auto units()
31 {
32 constexpr_return(ossia::make_string_array(
33 "distance.m", "distance.m", "distance.m", "distance.m"));
34 }
35 using value_type = vec4f;
36 static constexpr strong_value<neutral_unit>
37 to_neutral(strong_value<concrete_type> self)
38 {
39 return self;
40 }
41
42 static constexpr value_type from_neutral(strong_value<neutral_unit> self)
43 {
44 return self.dataspace_value;
45 }
46
47 static ossia::vecf_domain<4> domain()
48 {
49 return vecf_domain<4>{
50 ossia::make_vec(0.f, 0.f, 0.f, 0.f), ossia::make_vec(1.f, 1.f, 1.f, 1.f)};
51 }
52
53 static constexpr auto bounding() { return ossia::bounding_mode::FREE; }
54};
55
56struct OSSIA_EXPORT euler_u : public orientation_unit<euler_u>
57{
58 static constexpr auto text()
59 {
60 constexpr_return(ossia::make_string_array("euler", "ypr"));
61 }
62 static constexpr auto array_parameters()
63 {
64 constexpr_return(ossia::make_string_view("ypr"));
65 }
66 static constexpr auto units()
67 {
68 constexpr_return(
69 ossia::make_string_array("angle.degree", "angle.degree", "angle.degree"));
70 }
71 using value_type = vec3f;
72
73 static strong_value<neutral_unit> to_neutral(strong_value<concrete_type> self);
74
75 static value_type from_neutral(strong_value<neutral_unit> self);
76
77 static ossia::vecf_domain<3> domain()
78 {
79 return vecf_domain<3>{
80 ossia::make_vec(0.f, 0.f, 0.f), ossia::make_vec(360.f, 360.f, 360.f)};
81 }
82 static constexpr auto bounding() { return ossia::bounding_mode::WRAP; }
83};
84
85struct OSSIA_EXPORT axis_u : public orientation_unit<axis_u>
86{
87 static constexpr auto text()
88 {
89 constexpr_return(ossia::make_string_array("axis", "xyzw"));
90 }
91 static constexpr auto array_parameters()
92 {
93 constexpr_return(ossia::make_string_view("xyzw"));
94 }
95 static constexpr auto units()
96 {
97 constexpr_return(ossia::make_string_array(
98 "distance.m", "distance.m", "distance.m", "angle.degree"));
99 }
100 using value_type = vec4f;
101
102 static strong_value<neutral_unit> to_neutral(strong_value<concrete_type> self);
103
104 static value_type from_neutral(strong_value<neutral_unit> self);
105
106 static ossia::vecf_domain<4> domain()
107 {
108 return vecf_domain<4>{
109 ossia::make_vec(0.f, 0.f, 0.f, 0.f), ossia::make_vec(1.f, 1.f, 1.f, 360.f)};
110 }
111
112 static constexpr auto bounding() { return ossia::bounding_mode::FREE; }
113};
114}
Definition git_info.h:7