MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _update_input_source

Method _update_input_source

modules/webxr/webxr_interface_js.cpp:628–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628void WebXRInterfaceJS::_update_input_source(int p_input_source_id) {
629 XRServer *xr_server = XRServer::get_singleton();
630 ERR_FAIL_NULL(xr_server);
631
632 InputSource &input_source = input_sources[p_input_source_id];
633
634 float target_pose[16];
635 int tmp_target_ray_mode;
636 int touch_index;
637 int has_grip_pose;
638 float grip_pose[16];
639 int has_standard_mapping;
640 int button_count;
641 float buttons[10];
642 int axes_count;
643 float axes[10];
644 int has_hand_data;
645 float hand_joints[WEBXR_HAND_JOINT_MAX * 16];
646 float hand_radii[WEBXR_HAND_JOINT_MAX];
647
648 input_source.active = godot_webxr_update_input_source(
649 p_input_source_id,
650 target_pose,
651 &tmp_target_ray_mode,
652 &touch_index,
653 &has_grip_pose,
654 grip_pose,
655 &has_standard_mapping,
656 &button_count,
657 buttons,
658 &axes_count,
659 axes,
660 &has_hand_data,
661 hand_joints,
662 hand_radii);
663
664 if (!input_source.active) {
665 if (input_source.tracker.is_valid()) {
666 xr_server->remove_tracker(input_source.tracker);
667 input_source.tracker.unref();
668 }
669 return;
670 }
671
672 input_source.target_ray_mode = (WebXRInterface::TargetRayMode)tmp_target_ray_mode;
673 input_source.touch_index = touch_index;
674
675 Ref<XRControllerTracker> &tracker = input_source.tracker;
676
677 if (tracker.is_null()) {
678 tracker.instantiate();
679
680 StringName tracker_name;
681 if (input_source.target_ray_mode == WebXRInterface::TargetRayMode::TARGET_RAY_MODE_SCREEN) {
682 tracker_name = touch_names[touch_index];
683 } else {
684 tracker_name = tracker_names[p_input_source_id];
685 }

Callers

nothing calls this directly

Calls 15

remove_trackerMethod · 0.80
set_tracker_nameMethod · 0.80
set_tracker_descMethod · 0.80
add_trackerMethod · 0.80
set_poseMethod · 0.80
set_inputMethod · 0.80
parse_input_eventMethod · 0.80
set_hand_joint_flagsMethod · 0.80
set_hand_joint_radiusMethod · 0.80
invalidate_poseMethod · 0.80

Tested by

no test coverage detected