Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too. - `var2str` -> `var_to_str` - `str2var` -> `str_to_var` - `bytes2var` -> `bytes_to_var` - `bytes2var_with_objects` -> `bytes_to_var_with_objects` - `var2bytes` -> `var_to_bytes` - `var2bytes_with_objects` -> `var_to_bytes_with_objects` - `linear2db` -> `linear_to_db` - `db2linear` -> `db_to_linear` - `deg2rad` -> `deg_to_rad` - `rad2deg` -> `rad_to_deg` - `dict2inst` -> `dict_to_inst` - `inst2dict` -> `inst_to_dict`
This commit is contained in:
@@ -185,7 +185,7 @@ void AudioStreamPlayer2D::_update_panning() {
|
||||
}
|
||||
|
||||
float multiplier = Math::pow(1.0f - dist / max_distance, attenuation);
|
||||
multiplier *= Math::db2linear(volume_db); //also apply player volume!
|
||||
multiplier *= Math::db_to_linear(volume_db); //also apply player volume!
|
||||
|
||||
float pan = relative_to_listener.x / screen_size.x;
|
||||
// Don't let the panning effect extend (too far) beyond the screen.
|
||||
|
||||
@@ -745,12 +745,12 @@ void CPUParticles2D::_particles_process(double p_delta) {
|
||||
p.start_color_rand = Color(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
real_t angle1_rad = direction.angle() + Math::deg2rad((Math::randf() * 2.0 - 1.0) * spread);
|
||||
real_t angle1_rad = direction.angle() + Math::deg_to_rad((Math::randf() * 2.0 - 1.0) * spread);
|
||||
Vector2 rot = Vector2(Math::cos(angle1_rad), Math::sin(angle1_rad));
|
||||
p.velocity = rot * Math::lerp(parameters_min[PARAM_INITIAL_LINEAR_VELOCITY], parameters_max[PARAM_INITIAL_LINEAR_VELOCITY], (real_t)Math::randf());
|
||||
|
||||
real_t base_angle = tex_angle * Math::lerp(parameters_min[PARAM_ANGLE], parameters_max[PARAM_ANGLE], p.angle_rand);
|
||||
p.rotation = Math::deg2rad(base_angle);
|
||||
p.rotation = Math::deg_to_rad(base_angle);
|
||||
|
||||
p.custom[0] = 0.0; // unused
|
||||
p.custom[1] = 0.0; // phase [0..1]
|
||||
@@ -912,7 +912,7 @@ void CPUParticles2D::_particles_process(double p_delta) {
|
||||
}
|
||||
real_t base_angle = (tex_angle)*Math::lerp(parameters_min[PARAM_ANGLE], parameters_max[PARAM_ANGLE], p.angle_rand);
|
||||
base_angle += p.custom[1] * lifetime * tex_angular_velocity * Math::lerp(parameters_min[PARAM_ANGULAR_VELOCITY], parameters_max[PARAM_ANGULAR_VELOCITY], rand_from_seed(alt_seed));
|
||||
p.rotation = Math::deg2rad(base_angle); //angle
|
||||
p.rotation = Math::deg_to_rad(base_angle); //angle
|
||||
p.custom[2] = tex_anim_offset * Math::lerp(parameters_min[PARAM_ANIM_OFFSET], parameters_max[PARAM_ANIM_OFFSET], p.anim_offset_rand) + tv * tex_anim_speed * Math::lerp(parameters_min[PARAM_ANIM_SPEED], parameters_max[PARAM_ANIM_SPEED], rand_from_seed(alt_seed));
|
||||
}
|
||||
//apply color
|
||||
|
||||
@@ -373,9 +373,9 @@ private:
|
||||
bool slide_on_ceiling = true;
|
||||
int max_slides = 4;
|
||||
int platform_layer = 0;
|
||||
real_t floor_max_angle = Math::deg2rad((real_t)45.0);
|
||||
real_t floor_max_angle = Math::deg_to_rad((real_t)45.0);
|
||||
real_t floor_snap_length = 1;
|
||||
real_t wall_min_slide_angle = Math::deg2rad((real_t)15.0);
|
||||
real_t wall_min_slide_angle = Math::deg_to_rad((real_t)15.0);
|
||||
Vector2 up_direction = Vector2(0.0, -1.0);
|
||||
uint32_t platform_floor_layers = UINT32_MAX;
|
||||
uint32_t platform_wall_layers = 0;
|
||||
|
||||
@@ -44,7 +44,7 @@ bool Bone2D::_set(const StringName &p_path, const Variant &p_value) {
|
||||
} else if (path.begins_with("length")) {
|
||||
set_length(p_value);
|
||||
} else if (path.begins_with("bone_angle")) {
|
||||
set_bone_angle(Math::deg2rad(real_t(p_value)));
|
||||
set_bone_angle(Math::deg_to_rad(real_t(p_value)));
|
||||
} else if (path.begins_with("default_length")) {
|
||||
set_length(p_value);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ bool Bone2D::_get(const StringName &p_path, Variant &r_ret) const {
|
||||
} else if (path.begins_with("length")) {
|
||||
r_ret = get_length();
|
||||
} else if (path.begins_with("bone_angle")) {
|
||||
r_ret = Math::rad2deg(get_bone_angle());
|
||||
r_ret = Math::rad_to_deg(get_bone_angle());
|
||||
} else if (path.begins_with("default_length")) {
|
||||
r_ret = get_length();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p
|
||||
|
||||
if (uniformity > 0.0) {
|
||||
float distance = listener_area_pos.length();
|
||||
float attenuation = Math::db2linear(_get_attenuation_db(distance));
|
||||
float attenuation = Math::db_to_linear(_get_attenuation_db(distance));
|
||||
|
||||
// Determine the fraction of sound that would come from each speaker if they were all driven uniformly.
|
||||
float center_val[3] = { 0.5f, 0.25f, 0.16666f };
|
||||
@@ -213,12 +213,12 @@ float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
|
||||
float att = 0;
|
||||
switch (attenuation_model) {
|
||||
case ATTENUATION_INVERSE_DISTANCE: {
|
||||
att = Math::linear2db(1.0 / ((p_distance / unit_size) + CMP_EPSILON));
|
||||
att = Math::linear_to_db(1.0 / ((p_distance / unit_size) + CMP_EPSILON));
|
||||
} break;
|
||||
case ATTENUATION_INVERSE_SQUARE_DISTANCE: {
|
||||
float d = (p_distance / unit_size);
|
||||
d *= d;
|
||||
att = Math::linear2db(1.0 / (d + CMP_EPSILON));
|
||||
att = Math::linear_to_db(1.0 / (d + CMP_EPSILON));
|
||||
} break;
|
||||
case ATTENUATION_LOGARITHMIC: {
|
||||
att = -20 * Math::log(p_distance / unit_size + CMP_EPSILON);
|
||||
@@ -443,7 +443,7 @@ Vector<AudioFrame> AudioStreamPlayer3D::_update_panning() {
|
||||
}
|
||||
}
|
||||
|
||||
float multiplier = Math::db2linear(_get_attenuation_db(dist));
|
||||
float multiplier = Math::db_to_linear(_get_attenuation_db(dist));
|
||||
if (max_distance > 0) {
|
||||
multiplier *= MAX(0, 1.0 - (dist / max_distance));
|
||||
}
|
||||
@@ -453,13 +453,13 @@ Vector<AudioFrame> AudioStreamPlayer3D::_update_panning() {
|
||||
if (emission_angle_enabled) {
|
||||
Vector3 listenertopos = global_pos - listener_node->get_global_transform().origin;
|
||||
float c = listenertopos.normalized().dot(get_global_transform().basis.get_column(2).normalized()); //it's z negative
|
||||
float angle = Math::rad2deg(Math::acos(c));
|
||||
float angle = Math::rad_to_deg(Math::acos(c));
|
||||
if (angle > emission_angle) {
|
||||
db_att -= -emission_angle_filter_attenuation_db;
|
||||
}
|
||||
}
|
||||
|
||||
linear_attenuation = Math::db2linear(db_att);
|
||||
linear_attenuation = Math::db_to_linear(db_att);
|
||||
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
|
||||
AudioServer::get_singleton()->set_playback_highshelf_params(playback, linear_attenuation, attenuation_filter_cutoff_hz);
|
||||
}
|
||||
|
||||
@@ -766,13 +766,13 @@ void CPUParticles3D::_particles_process(double p_delta) {
|
||||
}
|
||||
|
||||
if (particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
|
||||
real_t angle1_rad = Math::atan2(direction.y, direction.x) + Math::deg2rad((Math::randf() * 2.0 - 1.0) * spread);
|
||||
real_t angle1_rad = Math::atan2(direction.y, direction.x) + Math::deg_to_rad((Math::randf() * 2.0 - 1.0) * spread);
|
||||
Vector3 rot = Vector3(Math::cos(angle1_rad), Math::sin(angle1_rad), 0.0);
|
||||
p.velocity = rot * Math::lerp(parameters_min[PARAM_INITIAL_LINEAR_VELOCITY], parameters_max[PARAM_INITIAL_LINEAR_VELOCITY], (real_t)Math::randf());
|
||||
} else {
|
||||
//initiate velocity spread in 3D
|
||||
real_t angle1_rad = Math::deg2rad((Math::randf() * (real_t)2.0 - (real_t)1.0) * spread);
|
||||
real_t angle2_rad = Math::deg2rad((Math::randf() * (real_t)2.0 - (real_t)1.0) * ((real_t)1.0 - flatness) * spread);
|
||||
real_t angle1_rad = Math::deg_to_rad((Math::randf() * (real_t)2.0 - (real_t)1.0) * spread);
|
||||
real_t angle2_rad = Math::deg_to_rad((Math::randf() * (real_t)2.0 - (real_t)1.0) * ((real_t)1.0 - flatness) * spread);
|
||||
|
||||
Vector3 direction_xz = Vector3(Math::sin(angle1_rad), 0, Math::cos(angle1_rad));
|
||||
Vector3 direction_yz = Vector3(0, Math::sin(angle2_rad), Math::cos(angle2_rad));
|
||||
@@ -796,7 +796,7 @@ void CPUParticles3D::_particles_process(double p_delta) {
|
||||
}
|
||||
|
||||
real_t base_angle = tex_angle * Math::lerp(parameters_min[PARAM_ANGLE], parameters_max[PARAM_ANGLE], p.angle_rand);
|
||||
p.custom[0] = Math::deg2rad(base_angle); //angle
|
||||
p.custom[0] = Math::deg_to_rad(base_angle); //angle
|
||||
p.custom[1] = 0.0; //phase
|
||||
p.custom[2] = tex_anim_offset * Math::lerp(parameters_min[PARAM_ANIM_OFFSET], parameters_max[PARAM_ANIM_OFFSET], p.anim_offset_rand); //animation offset (0-1)
|
||||
p.transform = Transform3D();
|
||||
@@ -1007,7 +1007,7 @@ void CPUParticles3D::_particles_process(double p_delta) {
|
||||
}
|
||||
real_t base_angle = (tex_angle)*Math::lerp(parameters_min[PARAM_ANGLE], parameters_max[PARAM_ANGLE], p.angle_rand);
|
||||
base_angle += p.custom[1] * lifetime * tex_angular_velocity * Math::lerp(parameters_min[PARAM_ANGULAR_VELOCITY], parameters_max[PARAM_ANGULAR_VELOCITY], rand_from_seed(alt_seed));
|
||||
p.custom[0] = Math::deg2rad(base_angle); //angle
|
||||
p.custom[0] = Math::deg_to_rad(base_angle); //angle
|
||||
p.custom[2] = tex_anim_offset * Math::lerp(parameters_min[PARAM_ANIM_OFFSET], parameters_max[PARAM_ANIM_OFFSET], p.anim_offset_rand) + tv * tex_anim_speed * Math::lerp(parameters_min[PARAM_ANIM_SPEED], parameters_max[PARAM_ANIM_SPEED], rand_from_seed(alt_seed)); //angle
|
||||
}
|
||||
//apply color
|
||||
|
||||
@@ -149,7 +149,7 @@ AABB Light3D::get_aabb() const {
|
||||
|
||||
} else if (type == RenderingServer::LIGHT_SPOT) {
|
||||
real_t len = param[PARAM_RANGE];
|
||||
real_t size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len;
|
||||
real_t size = Math::tan(Math::deg_to_rad(param[PARAM_SPOT_ANGLE])) * len;
|
||||
return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
|
||||
}
|
||||
|
||||
|
||||
@@ -2284,13 +2284,13 @@ bool PhysicalBone3D::ConeJointData::_set(const StringName &p_name, const Variant
|
||||
}
|
||||
|
||||
if ("joint_constraints/swing_span" == p_name) {
|
||||
swing_span = Math::deg2rad(real_t(p_value));
|
||||
swing_span = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN, swing_span);
|
||||
}
|
||||
|
||||
} else if ("joint_constraints/twist_span" == p_name) {
|
||||
twist_span = Math::deg2rad(real_t(p_value));
|
||||
twist_span = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN, twist_span);
|
||||
}
|
||||
@@ -2326,9 +2326,9 @@ bool PhysicalBone3D::ConeJointData::_get(const StringName &p_name, Variant &r_re
|
||||
}
|
||||
|
||||
if ("joint_constraints/swing_span" == p_name) {
|
||||
r_ret = Math::rad2deg(swing_span);
|
||||
r_ret = Math::rad_to_deg(swing_span);
|
||||
} else if ("joint_constraints/twist_span" == p_name) {
|
||||
r_ret = Math::rad2deg(twist_span);
|
||||
r_ret = Math::rad_to_deg(twist_span);
|
||||
} else if ("joint_constraints/bias" == p_name) {
|
||||
r_ret = bias;
|
||||
} else if ("joint_constraints/softness" == p_name) {
|
||||
@@ -2364,13 +2364,13 @@ bool PhysicalBone3D::HingeJointData::_set(const StringName &p_name, const Varian
|
||||
}
|
||||
|
||||
} else if ("joint_constraints/angular_limit_upper" == p_name) {
|
||||
angular_limit_upper = Math::deg2rad(real_t(p_value));
|
||||
angular_limit_upper = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER, angular_limit_upper);
|
||||
}
|
||||
|
||||
} else if ("joint_constraints/angular_limit_lower" == p_name) {
|
||||
angular_limit_lower = Math::deg2rad(real_t(p_value));
|
||||
angular_limit_lower = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER, angular_limit_lower);
|
||||
}
|
||||
@@ -2408,9 +2408,9 @@ bool PhysicalBone3D::HingeJointData::_get(const StringName &p_name, Variant &r_r
|
||||
if ("joint_constraints/angular_limit_enabled" == p_name) {
|
||||
r_ret = angular_limit_enabled;
|
||||
} else if ("joint_constraints/angular_limit_upper" == p_name) {
|
||||
r_ret = Math::rad2deg(angular_limit_upper);
|
||||
r_ret = Math::rad_to_deg(angular_limit_upper);
|
||||
} else if ("joint_constraints/angular_limit_lower" == p_name) {
|
||||
r_ret = Math::rad2deg(angular_limit_lower);
|
||||
r_ret = Math::rad_to_deg(angular_limit_lower);
|
||||
} else if ("joint_constraints/angular_limit_bias" == p_name) {
|
||||
r_ret = angular_limit_bias;
|
||||
} else if ("joint_constraints/angular_limit_softness" == p_name) {
|
||||
@@ -2471,13 +2471,13 @@ bool PhysicalBone3D::SliderJointData::_set(const StringName &p_name, const Varia
|
||||
}
|
||||
|
||||
} else if ("joint_constraints/angular_limit_upper" == p_name) {
|
||||
angular_limit_upper = Math::deg2rad(real_t(p_value));
|
||||
angular_limit_upper = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER, angular_limit_upper);
|
||||
}
|
||||
|
||||
} else if ("joint_constraints/angular_limit_lower" == p_name) {
|
||||
angular_limit_lower = Math::deg2rad(real_t(p_value));
|
||||
angular_limit_lower = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER, angular_limit_lower);
|
||||
}
|
||||
@@ -2523,9 +2523,9 @@ bool PhysicalBone3D::SliderJointData::_get(const StringName &p_name, Variant &r_
|
||||
} else if ("joint_constraints/linear_limit_damping" == p_name) {
|
||||
r_ret = linear_limit_damping;
|
||||
} else if ("joint_constraints/angular_limit_upper" == p_name) {
|
||||
r_ret = Math::rad2deg(angular_limit_upper);
|
||||
r_ret = Math::rad_to_deg(angular_limit_upper);
|
||||
} else if ("joint_constraints/angular_limit_lower" == p_name) {
|
||||
r_ret = Math::rad2deg(angular_limit_lower);
|
||||
r_ret = Math::rad_to_deg(angular_limit_lower);
|
||||
} else if ("joint_constraints/angular_limit_softness" == p_name) {
|
||||
r_ret = angular_limit_softness;
|
||||
} else if ("joint_constraints/angular_limit_restitution" == p_name) {
|
||||
@@ -2649,13 +2649,13 @@ bool PhysicalBone3D::SixDOFJointData::_set(const StringName &p_name, const Varia
|
||||
}
|
||||
|
||||
} else if ("angular_limit_upper" == var_name) {
|
||||
axis_data[axis].angular_limit_upper = Math::deg2rad(real_t(p_value));
|
||||
axis_data[axis].angular_limit_upper = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT, axis_data[axis].angular_limit_upper);
|
||||
}
|
||||
|
||||
} else if ("angular_limit_lower" == var_name) {
|
||||
axis_data[axis].angular_limit_lower = Math::deg2rad(real_t(p_value));
|
||||
axis_data[axis].angular_limit_lower = Math::deg_to_rad(real_t(p_value));
|
||||
if (j.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT, axis_data[axis].angular_limit_lower);
|
||||
}
|
||||
@@ -2765,9 +2765,9 @@ bool PhysicalBone3D::SixDOFJointData::_get(const StringName &p_name, Variant &r_
|
||||
} else if ("angular_limit_enabled" == var_name) {
|
||||
r_ret = axis_data[axis].angular_limit_enabled;
|
||||
} else if ("angular_limit_upper" == var_name) {
|
||||
r_ret = Math::rad2deg(axis_data[axis].angular_limit_upper);
|
||||
r_ret = Math::rad_to_deg(axis_data[axis].angular_limit_upper);
|
||||
} else if ("angular_limit_lower" == var_name) {
|
||||
r_ret = Math::rad2deg(axis_data[axis].angular_limit_lower);
|
||||
r_ret = Math::rad_to_deg(axis_data[axis].angular_limit_lower);
|
||||
} else if ("angular_limit_softness" == var_name) {
|
||||
r_ret = axis_data[axis].angular_limit_softness;
|
||||
} else if ("angular_restitution" == var_name) {
|
||||
|
||||
@@ -414,8 +414,8 @@ private:
|
||||
uint32_t platform_floor_layers = UINT32_MAX;
|
||||
uint32_t platform_wall_layers = 0;
|
||||
real_t floor_snap_length = 0.1;
|
||||
real_t floor_max_angle = Math::deg2rad((real_t)45.0);
|
||||
real_t wall_min_slide_angle = Math::deg2rad((real_t)15.0);
|
||||
real_t floor_max_angle = Math::deg_to_rad((real_t)45.0);
|
||||
real_t wall_min_slide_angle = Math::deg_to_rad((real_t)15.0);
|
||||
Vector3 up_direction = Vector3(0.0, 1.0, 0.0);
|
||||
Vector3 velocity;
|
||||
Vector3 floor_normal;
|
||||
|
||||
@@ -1151,7 +1151,7 @@ void AnimationPlayer::_animation_update_transforms() {
|
||||
}
|
||||
#endif
|
||||
|
||||
static_cast<Node2D *>(pa->object)->set_rotation(Math::deg2rad((double)pa->value_accum));
|
||||
static_cast<Node2D *>(pa->object)->set_rotation(Math::deg_to_rad((double)pa->value_accum));
|
||||
} break;
|
||||
case SP_NODE2D_SCALE: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
@@ -1528,7 +1528,7 @@ void AnimationTree::_process_graph(double p_delta) {
|
||||
}
|
||||
}
|
||||
|
||||
real_t db = Math::linear2db(MAX(blend, 0.00001));
|
||||
real_t db = Math::linear_to_db(MAX(blend, 0.00001));
|
||||
if (t->object->has_method(SNAME("set_unit_db"))) {
|
||||
t->object->call(SNAME("set_unit_db"), db);
|
||||
} else {
|
||||
|
||||
@@ -256,7 +256,7 @@ Vector<AudioFrame> AudioStreamPlayer::_get_volume_vector() {
|
||||
channel_volume_db = AudioFrame(0, 0);
|
||||
}
|
||||
|
||||
float volume_linear = Math::db2linear(volume_db);
|
||||
float volume_linear = Math::db_to_linear(volume_db);
|
||||
|
||||
// Set the volume vector up according to the speaker mode and mix target.
|
||||
// TODO do we need to scale the volume down when we output to more channels?
|
||||
|
||||
@@ -362,7 +362,7 @@ void VideoStreamPlayer::set_volume_db(float p_db) {
|
||||
if (p_db < -79) {
|
||||
set_volume(0);
|
||||
} else {
|
||||
set_volume(Math::db2linear(p_db));
|
||||
set_volume(Math::db_to_linear(p_db));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ float VideoStreamPlayer::get_volume_db() const {
|
||||
if (volume == 0) {
|
||||
return -80;
|
||||
} else {
|
||||
return Math::linear2db(volume);
|
||||
return Math::linear_to_db(volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ Vector<Vector3> CapsuleShape3D::get_debug_mesh_lines() const {
|
||||
|
||||
Vector3 d(0, height * 0.5 - radius, 0);
|
||||
for (int i = 0; i < 360; i++) {
|
||||
float ra = Math::deg2rad((float)i);
|
||||
float rb = Math::deg2rad((float)i + 1);
|
||||
float ra = Math::deg_to_rad((float)i);
|
||||
float rb = Math::deg_to_rad((float)i + 1);
|
||||
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
|
||||
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
|
||||
|
||||
|
||||
@@ -763,7 +763,7 @@ void Curve2D::_bake_segment2d(RBMap<real_t, Vector2> &r_bake, real_t p_begin, re
|
||||
Vector2 nb = (end - mid).normalized();
|
||||
real_t dp = na.dot(nb);
|
||||
|
||||
if (dp < Math::cos(Math::deg2rad(p_tol))) {
|
||||
if (dp < Math::cos(Math::deg_to_rad(p_tol))) {
|
||||
r_bake[mp] = mid;
|
||||
}
|
||||
|
||||
@@ -1352,7 +1352,7 @@ void Curve3D::_bake_segment3d(RBMap<real_t, Vector3> &r_bake, real_t p_begin, re
|
||||
Vector3 nb = (end - mid).normalized();
|
||||
real_t dp = na.dot(nb);
|
||||
|
||||
if (dp < Math::cos(Math::deg2rad(p_tol))) {
|
||||
if (dp < Math::cos(Math::deg_to_rad(p_tol))) {
|
||||
r_bake[mp] = mid;
|
||||
}
|
||||
if (p_depth < p_max_depth) {
|
||||
|
||||
@@ -40,8 +40,8 @@ Vector<Vector3> CylinderShape3D::get_debug_mesh_lines() const {
|
||||
|
||||
Vector3 d(0, height * 0.5, 0);
|
||||
for (int i = 0; i < 360; i++) {
|
||||
float ra = Math::deg2rad((float)i);
|
||||
float rb = Math::deg2rad((float)i + 1);
|
||||
float ra = Math::deg_to_rad((float)i);
|
||||
float rb = Math::deg_to_rad((float)i + 1);
|
||||
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
|
||||
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
|
||||
|
||||
|
||||
@@ -301,9 +301,9 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
|
||||
}
|
||||
}
|
||||
|
||||
float normal_merge_threshold = Math::cos(Math::deg2rad(p_normal_merge_angle));
|
||||
float normal_pre_split_threshold = Math::cos(Math::deg2rad(MIN(180.0f, p_normal_split_angle * 2.0f)));
|
||||
float normal_split_threshold = Math::cos(Math::deg2rad(p_normal_split_angle));
|
||||
float normal_merge_threshold = Math::cos(Math::deg_to_rad(p_normal_merge_angle));
|
||||
float normal_pre_split_threshold = Math::cos(Math::deg_to_rad(MIN(180.0f, p_normal_split_angle * 2.0f)));
|
||||
float normal_split_threshold = Math::cos(Math::deg_to_rad(p_normal_split_angle));
|
||||
const Vector3 *normals_ptr = normals.ptr();
|
||||
|
||||
HashMap<Vector3, LocalVector<Pair<int, int>>> unique_vertices;
|
||||
|
||||
@@ -52,9 +52,9 @@ bool SkeletonModification2DCCDIK::_set(const StringName &p_path, const Variant &
|
||||
} else if (what == "enable_constraint") {
|
||||
set_ccdik_joint_enable_constraint(which, p_value);
|
||||
} else if (what == "constraint_angle_min") {
|
||||
set_ccdik_joint_constraint_angle_min(which, Math::deg2rad(float(p_value)));
|
||||
set_ccdik_joint_constraint_angle_min(which, Math::deg_to_rad(float(p_value)));
|
||||
} else if (what == "constraint_angle_max") {
|
||||
set_ccdik_joint_constraint_angle_max(which, Math::deg2rad(float(p_value)));
|
||||
set_ccdik_joint_constraint_angle_max(which, Math::deg_to_rad(float(p_value)));
|
||||
} else if (what == "constraint_angle_invert") {
|
||||
set_ccdik_joint_constraint_angle_invert(which, p_value);
|
||||
} else if (what == "constraint_in_localspace") {
|
||||
@@ -96,9 +96,9 @@ bool SkeletonModification2DCCDIK::_get(const StringName &p_path, Variant &r_ret)
|
||||
} else if (what == "enable_constraint") {
|
||||
r_ret = get_ccdik_joint_enable_constraint(which);
|
||||
} else if (what == "constraint_angle_min") {
|
||||
r_ret = Math::rad2deg(get_ccdik_joint_constraint_angle_min(which));
|
||||
r_ret = Math::rad_to_deg(get_ccdik_joint_constraint_angle_min(which));
|
||||
} else if (what == "constraint_angle_max") {
|
||||
r_ret = Math::rad2deg(get_ccdik_joint_constraint_angle_max(which));
|
||||
r_ret = Math::rad_to_deg(get_ccdik_joint_constraint_angle_max(which));
|
||||
} else if (what == "constraint_angle_invert") {
|
||||
r_ret = get_ccdik_joint_constraint_angle_invert(which);
|
||||
} else if (what == "constraint_in_localspace") {
|
||||
|
||||
@@ -41,15 +41,15 @@ bool SkeletonModification2DLookAt::_set(const StringName &p_path, const Variant
|
||||
if (path.begins_with("enable_constraint")) {
|
||||
set_enable_constraint(p_value);
|
||||
} else if (path.begins_with("constraint_angle_min")) {
|
||||
set_constraint_angle_min(Math::deg2rad(float(p_value)));
|
||||
set_constraint_angle_min(Math::deg_to_rad(float(p_value)));
|
||||
} else if (path.begins_with("constraint_angle_max")) {
|
||||
set_constraint_angle_max(Math::deg2rad(float(p_value)));
|
||||
set_constraint_angle_max(Math::deg_to_rad(float(p_value)));
|
||||
} else if (path.begins_with("constraint_angle_invert")) {
|
||||
set_constraint_angle_invert(p_value);
|
||||
} else if (path.begins_with("constraint_in_localspace")) {
|
||||
set_constraint_in_localspace(p_value);
|
||||
} else if (path.begins_with("additional_rotation")) {
|
||||
set_additional_rotation(Math::deg2rad(float(p_value)));
|
||||
set_additional_rotation(Math::deg_to_rad(float(p_value)));
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
@@ -67,15 +67,15 @@ bool SkeletonModification2DLookAt::_get(const StringName &p_path, Variant &r_ret
|
||||
if (path.begins_with("enable_constraint")) {
|
||||
r_ret = get_enable_constraint();
|
||||
} else if (path.begins_with("constraint_angle_min")) {
|
||||
r_ret = Math::rad2deg(get_constraint_angle_min());
|
||||
r_ret = Math::rad_to_deg(get_constraint_angle_min());
|
||||
} else if (path.begins_with("constraint_angle_max")) {
|
||||
r_ret = Math::rad2deg(get_constraint_angle_max());
|
||||
r_ret = Math::rad_to_deg(get_constraint_angle_max());
|
||||
} else if (path.begins_with("constraint_angle_invert")) {
|
||||
r_ret = get_constraint_angle_invert();
|
||||
} else if (path.begins_with("constraint_in_localspace")) {
|
||||
r_ret = get_constraint_in_localspace();
|
||||
} else if (path.begins_with("additional_rotation")) {
|
||||
r_ret = Math::rad2deg(get_additional_rotation());
|
||||
r_ret = Math::rad_to_deg(get_additional_rotation());
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
@@ -50,9 +50,9 @@ bool SkeletonModification3DCCDIK::_set(const StringName &p_path, const Variant &
|
||||
} else if (what == "enable_joint_constraint") {
|
||||
set_ccdik_joint_enable_constraint(which, p_value);
|
||||
} else if (what == "joint_constraint_angle_min") {
|
||||
set_ccdik_joint_constraint_angle_min(which, Math::deg2rad(real_t(p_value)));
|
||||
set_ccdik_joint_constraint_angle_min(which, Math::deg_to_rad(real_t(p_value)));
|
||||
} else if (what == "joint_constraint_angle_max") {
|
||||
set_ccdik_joint_constraint_angle_max(which, Math::deg2rad(real_t(p_value)));
|
||||
set_ccdik_joint_constraint_angle_max(which, Math::deg_to_rad(real_t(p_value)));
|
||||
} else if (what == "joint_constraint_angles_invert") {
|
||||
set_ccdik_joint_constraint_invert(which, p_value);
|
||||
}
|
||||
@@ -79,9 +79,9 @@ bool SkeletonModification3DCCDIK::_get(const StringName &p_path, Variant &r_ret)
|
||||
} else if (what == "enable_joint_constraint") {
|
||||
r_ret = get_ccdik_joint_enable_constraint(which);
|
||||
} else if (what == "joint_constraint_angle_min") {
|
||||
r_ret = Math::rad2deg(get_ccdik_joint_constraint_angle_min(which));
|
||||
r_ret = Math::rad_to_deg(get_ccdik_joint_constraint_angle_min(which));
|
||||
} else if (what == "joint_constraint_angle_max") {
|
||||
r_ret = Math::rad2deg(get_ccdik_joint_constraint_angle_max(which));
|
||||
r_ret = Math::rad_to_deg(get_ccdik_joint_constraint_angle_max(which));
|
||||
} else if (what == "joint_constraint_angles_invert") {
|
||||
r_ret = get_ccdik_joint_constraint_invert(which);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool SkeletonModification3DFABRIK::_set(const StringName &p_path, const Variant
|
||||
} else if (what == "use_target_basis") {
|
||||
set_fabrik_joint_use_target_basis(which, p_value);
|
||||
} else if (what == "roll") {
|
||||
set_fabrik_joint_roll(which, Math::deg2rad(real_t(p_value)));
|
||||
set_fabrik_joint_roll(which, Math::deg_to_rad(real_t(p_value)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ bool SkeletonModification3DFABRIK::_get(const StringName &p_path, Variant &r_ret
|
||||
} else if (what == "use_target_basis") {
|
||||
r_ret = get_fabrik_joint_use_target_basis(which);
|
||||
} else if (what == "roll") {
|
||||
r_ret = Math::rad2deg(get_fabrik_joint_roll(which));
|
||||
r_ret = Math::rad_to_deg(get_fabrik_joint_roll(which));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool SkeletonModification3DJiggle::_set(const StringName &p_path, const Variant
|
||||
} else if (what == "gravity") {
|
||||
set_jiggle_joint_gravity(which, p_value);
|
||||
} else if (what == "roll") {
|
||||
set_jiggle_joint_roll(which, Math::deg2rad(real_t(p_value)));
|
||||
set_jiggle_joint_roll(which, Math::deg_to_rad(real_t(p_value)));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@@ -98,7 +98,7 @@ bool SkeletonModification3DJiggle::_get(const StringName &p_path, Variant &r_ret
|
||||
} else if (what == "gravity") {
|
||||
r_ret = get_jiggle_joint_gravity(which);
|
||||
} else if (what == "roll") {
|
||||
r_ret = Math::rad2deg(get_jiggle_joint_roll(which));
|
||||
r_ret = Math::rad_to_deg(get_jiggle_joint_roll(which));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -39,9 +39,9 @@ bool SkeletonModification3DLookAt::_set(const StringName &p_path, const Variant
|
||||
set_lock_rotation_plane(p_value);
|
||||
} else if (p_path == "additional_rotation") {
|
||||
Vector3 tmp = p_value;
|
||||
tmp.x = Math::deg2rad(tmp.x);
|
||||
tmp.y = Math::deg2rad(tmp.y);
|
||||
tmp.z = Math::deg2rad(tmp.z);
|
||||
tmp.x = Math::deg_to_rad(tmp.x);
|
||||
tmp.y = Math::deg_to_rad(tmp.y);
|
||||
tmp.z = Math::deg_to_rad(tmp.z);
|
||||
set_additional_rotation(tmp);
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ bool SkeletonModification3DLookAt::_get(const StringName &p_path, Variant &r_ret
|
||||
r_ret = get_lock_rotation_plane();
|
||||
} else if (p_path == "additional_rotation") {
|
||||
Vector3 tmp = get_additional_rotation();
|
||||
tmp.x = Math::rad2deg(tmp.x);
|
||||
tmp.y = Math::rad2deg(tmp.y);
|
||||
tmp.z = Math::rad2deg(tmp.z);
|
||||
tmp.x = Math::rad_to_deg(tmp.x);
|
||||
tmp.y = Math::rad_to_deg(tmp.y);
|
||||
tmp.z = Math::rad_to_deg(tmp.z);
|
||||
r_ret = tmp;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,13 +54,13 @@ bool SkeletonModification3DTwoBoneIK::_set(const StringName &p_path, const Varia
|
||||
} else if (path == "joint_one/bone_idx") {
|
||||
set_joint_one_bone_idx(p_value);
|
||||
} else if (path == "joint_one/roll") {
|
||||
set_joint_one_roll(Math::deg2rad(real_t(p_value)));
|
||||
set_joint_one_roll(Math::deg_to_rad(real_t(p_value)));
|
||||
} else if (path == "joint_two/bone_name") {
|
||||
set_joint_two_bone_name(p_value);
|
||||
} else if (path == "joint_two/bone_idx") {
|
||||
set_joint_two_bone_idx(p_value);
|
||||
} else if (path == "joint_two/roll") {
|
||||
set_joint_two_roll(Math::deg2rad(real_t(p_value)));
|
||||
set_joint_two_roll(Math::deg_to_rad(real_t(p_value)));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -88,13 +88,13 @@ bool SkeletonModification3DTwoBoneIK::_get(const StringName &p_path, Variant &r_
|
||||
} else if (path == "joint_one/bone_idx") {
|
||||
r_ret = get_joint_one_bone_idx();
|
||||
} else if (path == "joint_one/roll") {
|
||||
r_ret = Math::rad2deg(get_joint_one_roll());
|
||||
r_ret = Math::rad_to_deg(get_joint_one_roll());
|
||||
} else if (path == "joint_two/bone_name") {
|
||||
r_ret = get_joint_two_bone_name();
|
||||
} else if (path == "joint_two/bone_idx") {
|
||||
r_ret = get_joint_two_bone_idx();
|
||||
} else if (path == "joint_two/roll") {
|
||||
r_ret = Math::rad2deg(get_joint_two_roll());
|
||||
r_ret = Math::rad_to_deg(get_joint_two_roll());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -128,7 +128,7 @@ float ProceduralSkyMaterial::get_ground_energy() const {
|
||||
|
||||
void ProceduralSkyMaterial::set_sun_angle_max(float p_angle) {
|
||||
sun_angle_max = p_angle;
|
||||
RS::get_singleton()->material_set_param(_get_material(), "sun_angle_max", Math::deg2rad(sun_angle_max));
|
||||
RS::get_singleton()->material_set_param(_get_material(), "sun_angle_max", Math::deg_to_rad(sun_angle_max));
|
||||
}
|
||||
|
||||
float ProceduralSkyMaterial::get_sun_angle_max() const {
|
||||
|
||||
@@ -38,8 +38,8 @@ Vector<Vector3> SphereShape3D::get_debug_mesh_lines() const {
|
||||
Vector<Vector3> points;
|
||||
|
||||
for (int i = 0; i <= 360; i++) {
|
||||
float ra = Math::deg2rad((float)i);
|
||||
float rb = Math::deg2rad((float)i + 1);
|
||||
float ra = Math::deg_to_rad((float)i);
|
||||
float rb = Math::deg_to_rad((float)i + 1);
|
||||
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r;
|
||||
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user