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

Method _set_rotation

modules/camera/camera_android.cpp:104–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void CameraFeedAndroid::_set_rotation() {
105 int display_rotation = DisplayServerAndroid::get_singleton()->get_display_rotation();
106 // reverse rotation
107 switch (display_rotation) {
108 case 90:
109 display_rotation = 270;
110 break;
111 case 270:
112 display_rotation = 90;
113 break;
114 default:
115 break;
116 }
117
118 int sign = position == CameraFeed::FEED_FRONT ? 1 : -1;
119 float imageRotation = (orientation - display_rotation * sign + 360) % 360;
120 transform.set_rotation(real_t(Math::deg_to_rad(imageRotation)));
121}
122
123void CameraFeedAndroid::_add_formats() {
124 // Get supported formats

Callers 1

onImageMethod · 0.45

Calls 3

deg_to_radFunction · 0.50
get_display_rotationMethod · 0.45
set_rotationMethod · 0.45

Tested by

no test coverage detected