| 121 | } |
| 122 | |
| 123 | Napi::ObjectReference CreateXRInputSource(xr::System::Session::Frame::InputSource& inputSource, Napi::Env& env) |
| 124 | { |
| 125 | constexpr std::array<const char*, 2> HANDEDNESS_STRINGS{ |
| 126 | "left", |
| 127 | "right"}; |
| 128 | constexpr const char* TARGET_RAY_MODE{"tracked-pointer"}; |
| 129 | |
| 130 | auto jsInputSource = Napi::Object::New(env); |
| 131 | jsInputSource.Set("handedness", Napi::String::New(env, HANDEDNESS_STRINGS[static_cast<size_t>(inputSource.Handedness)])); |
| 132 | jsInputSource.Set("targetRayMode", TARGET_RAY_MODE); |
| 133 | SetXRInputSourceSpaces(jsInputSource, inputSource); |
| 134 | |
| 135 | auto profiles = Napi::Array::New(env, 1); |
| 136 | Napi::Value string = Napi::String::New(env, "generic-trigger-squeeze-touchpad-thumbstick"); |
| 137 | profiles.Set(uint32_t{0}, string); |
| 138 | jsInputSource.Set("profiles", profiles); |
| 139 | |
| 140 | return Napi::Persistent(jsInputSource); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | // NativeXr implementation proper. |
no test coverage detected