Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
This commit is contained in:
@@ -269,7 +269,7 @@ public:
|
||||
//spot
|
||||
radius *= shared->cone_overfit; // overfit icosphere
|
||||
|
||||
real_t len = Math::tan(Math::deg2rad(p_spot_aperture)) * radius;
|
||||
real_t len = Math::tan(Math::deg_to_rad(p_spot_aperture)) * radius;
|
||||
//approximate, probably better to use a cone support function
|
||||
float max_d = -1e20;
|
||||
float min_d = 1e20;
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
float dist = base_plane.distance_to(Vector3());
|
||||
if (dist >= 0 && dist < radius) {
|
||||
//inside, check angle
|
||||
float angle = Math::rad2deg(Math::acos((-xform.origin.normalized()).dot(-xform.basis.get_column(Vector3::AXIS_Z))));
|
||||
float angle = Math::rad_to_deg(Math::acos((-xform.origin.normalized()).dot(-xform.basis.get_column(Vector3::AXIS_Z))));
|
||||
e.touches_near = angle < p_spot_aperture * 1.05; //overfit aperture a little due to cone overfit
|
||||
} else {
|
||||
e.touches_near = false;
|
||||
|
||||
@@ -1604,7 +1604,7 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R
|
||||
ScreenSpaceReflectionFilterPushConstant push_constant;
|
||||
push_constant.view_index = v;
|
||||
push_constant.orthogonal = p_projections[v].is_orthogonal();
|
||||
push_constant.edge_tolerance = Math::sin(Math::deg2rad(15.0));
|
||||
push_constant.edge_tolerance = Math::sin(Math::deg_to_rad(15.0));
|
||||
push_constant.proj_info[0] = -2.0f / (p_screen_size.width * p_projections[v].matrix[0][0]);
|
||||
push_constant.proj_info[1] = -2.0f / (p_screen_size.height * p_projections[v].matrix[1][1]);
|
||||
push_constant.proj_info[2] = (1.0f - p_projections[v].matrix[0][2]) / p_projections[v].matrix[0][0];
|
||||
|
||||
@@ -1924,7 +1924,7 @@ void GI::SDFGI::pre_process_gi(const Transform3D &p_transform, RenderDataRD *p_r
|
||||
lights[idx].has_shadow = RSG::light_storage->light_has_shadow(li->light);
|
||||
lights[idx].attenuation = RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_ATTENUATION);
|
||||
lights[idx].radius = RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_RANGE);
|
||||
lights[idx].cos_spot_angle = Math::cos(Math::deg2rad(RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_SPOT_ANGLE)));
|
||||
lights[idx].cos_spot_angle = Math::cos(Math::deg_to_rad(RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_SPOT_ANGLE)));
|
||||
lights[idx].inv_spot_attenuation = 1.0f / RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_SPOT_ATTENUATION);
|
||||
|
||||
idx++;
|
||||
@@ -2362,7 +2362,7 @@ void GI::SDFGI::render_static_lights(RID p_render_buffers, uint32_t p_cascade_co
|
||||
lights[idx].has_shadow = RSG::light_storage->light_has_shadow(li->light);
|
||||
lights[idx].attenuation = RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_ATTENUATION);
|
||||
lights[idx].radius = RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_RANGE);
|
||||
lights[idx].cos_spot_angle = Math::cos(Math::deg2rad(RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_SPOT_ANGLE)));
|
||||
lights[idx].cos_spot_angle = Math::cos(Math::deg_to_rad(RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_SPOT_ANGLE)));
|
||||
lights[idx].inv_spot_attenuation = 1.0f / RSG::light_storage->light_get_param(li->light, RS::LIGHT_PARAM_SPOT_ATTENUATION);
|
||||
|
||||
idx++;
|
||||
@@ -2800,7 +2800,7 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vector<RID
|
||||
l.color[1] = color.g;
|
||||
l.color[2] = color.b;
|
||||
|
||||
l.cos_spot_angle = Math::cos(Math::deg2rad(RSG::light_storage->light_get_param(light, RS::LIGHT_PARAM_SPOT_ANGLE)));
|
||||
l.cos_spot_angle = Math::cos(Math::deg_to_rad(RSG::light_storage->light_get_param(light, RS::LIGHT_PARAM_SPOT_ANGLE)));
|
||||
l.inv_spot_attenuation = 1.0f / RSG::light_storage->light_get_param(light, RS::LIGHT_PARAM_SPOT_ATTENUATION);
|
||||
|
||||
Transform3D xform = p_scene_render->light_instance_get_base_transform(light_instance);
|
||||
|
||||
@@ -1232,7 +1232,7 @@ void SkyRD::setup(RID p_env, RID p_render_buffers, const PagedArray<RID> &p_ligh
|
||||
// I know tan(0) is 0, but let's not risk it with numerical precision.
|
||||
// technically this will keep expanding until reaching the sun, but all we care
|
||||
// is expand until we reach the radius of the near plane (there can't be more occluders than that)
|
||||
angular_diameter = Math::tan(Math::deg2rad(angular_diameter));
|
||||
angular_diameter = Math::tan(Math::deg_to_rad(angular_diameter));
|
||||
} else {
|
||||
angular_diameter = 0.0;
|
||||
}
|
||||
|
||||
@@ -1600,7 +1600,7 @@ void RendererCanvasRenderRD::light_update_shadow(RID p_rid, int p_shadow_index,
|
||||
real_t farp = p_far;
|
||||
real_t aspect = 1.0;
|
||||
|
||||
real_t ymax = nearp * Math::tan(Math::deg2rad(fov * 0.5));
|
||||
real_t ymax = nearp * Math::tan(Math::deg_to_rad(fov * 0.5));
|
||||
real_t ymin = -ymax;
|
||||
real_t xmin = ymin * aspect;
|
||||
real_t xmax = ymax * aspect;
|
||||
|
||||
@@ -2862,7 +2862,7 @@ void RendererSceneRenderRD::_setup_lights(const PagedArray<RID> &p_lights, const
|
||||
|
||||
float size = light_storage->light_get_param(base, RS::LIGHT_PARAM_SIZE);
|
||||
|
||||
light_data.size = 1.0 - Math::cos(Math::deg2rad(size)); //angle to cosine offset
|
||||
light_data.size = 1.0 - Math::cos(Math::deg_to_rad(size)); //angle to cosine offset
|
||||
|
||||
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_PSSM_SPLITS) {
|
||||
WARN_PRINT_ONCE("The DirectionalLight3D PSSM splits debug draw mode is not reimplemented yet.");
|
||||
@@ -2877,7 +2877,7 @@ void RendererSceneRenderRD::_setup_lights(const PagedArray<RID> &p_lights, const
|
||||
// I know tan(0) is 0, but let's not risk it with numerical precision.
|
||||
// technically this will keep expanding until reaching the sun, but all we care
|
||||
// is expand until we reach the radius of the near plane (there can't be more occluders than that)
|
||||
angular_diameter = Math::tan(Math::deg2rad(angular_diameter));
|
||||
angular_diameter = Math::tan(Math::deg_to_rad(angular_diameter));
|
||||
if (light_storage->light_has_shadow(base) && light_storage->light_get_param(base, RS::LIGHT_PARAM_SHADOW_BLUR) > 0.0) {
|
||||
// Only enable PCSS-like soft shadows if blurring is enabled.
|
||||
// Otherwise, performance would decrease with no visual difference.
|
||||
@@ -3092,7 +3092,7 @@ void RendererSceneRenderRD::_setup_lights(const PagedArray<RID> &p_lights, const
|
||||
|
||||
light_data.inv_spot_attenuation = 1.0f / light_storage->light_get_param(base, RS::LIGHT_PARAM_SPOT_ATTENUATION);
|
||||
float spot_angle = light_storage->light_get_param(base, RS::LIGHT_PARAM_SPOT_ANGLE);
|
||||
light_data.cos_spot_angle = Math::cos(Math::deg2rad(spot_angle));
|
||||
light_data.cos_spot_angle = Math::cos(Math::deg_to_rad(spot_angle));
|
||||
|
||||
light_data.mask = light_storage->light_get_cull_mask(base);
|
||||
|
||||
@@ -3193,7 +3193,7 @@ void RendererSceneRenderRD::_setup_lights(const PagedArray<RID> &p_lights, const
|
||||
// Only enable PCSS-like soft shadows if blurring is enabled.
|
||||
// Otherwise, performance would decrease with no visual difference.
|
||||
Projection cm = li->shadow_transform[0].camera;
|
||||
float half_np = cm.get_z_near() * Math::tan(Math::deg2rad(spot_angle));
|
||||
float half_np = cm.get_z_near() * Math::tan(Math::deg_to_rad(spot_angle));
|
||||
light_data.soft_shadow_size = (size * 0.5 / radius) / (half_np / cm.get_z_near()) * rect.size.width;
|
||||
} else {
|
||||
light_data.soft_shadow_size = 0.0;
|
||||
|
||||
@@ -352,7 +352,7 @@ AABB LightStorage::light_get_aabb(RID p_light) const {
|
||||
switch (light->type) {
|
||||
case RS::LIGHT_SPOT: {
|
||||
float len = light->param[RS::LIGHT_PARAM_RANGE];
|
||||
float size = Math::tan(Math::deg2rad(light->param[RS::LIGHT_PARAM_SPOT_ANGLE])) * len;
|
||||
float size = Math::tan(Math::deg_to_rad(light->param[RS::LIGHT_PARAM_SPOT_ANGLE])) * len;
|
||||
return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
|
||||
};
|
||||
case RS::LIGHT_OMNI: {
|
||||
|
||||
@@ -2146,7 +2146,7 @@ void RendererSceneCull::_light_instance_setup_directional_shadow(int p_shadow_in
|
||||
|
||||
if (soft_shadow_angle > 0.0) {
|
||||
float z_range = (z_vec.dot(center) + radius + pancake_size) - z_min_cam;
|
||||
soft_shadow_expand = Math::tan(Math::deg2rad(soft_shadow_angle)) * z_range;
|
||||
soft_shadow_expand = Math::tan(Math::deg_to_rad(soft_shadow_angle)) * z_range;
|
||||
|
||||
x_max += soft_shadow_expand;
|
||||
y_max += soft_shadow_expand;
|
||||
@@ -3125,8 +3125,8 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
|
||||
float radius = RSG::light_storage->light_get_param(ins->base, RS::LIGHT_PARAM_RANGE);
|
||||
float angle = RSG::light_storage->light_get_param(ins->base, RS::LIGHT_PARAM_SPOT_ANGLE);
|
||||
|
||||
float w = radius * Math::sin(Math::deg2rad(angle));
|
||||
float d = radius * Math::cos(Math::deg2rad(angle));
|
||||
float w = radius * Math::sin(Math::deg_to_rad(angle));
|
||||
float d = radius * Math::cos(Math::deg_to_rad(angle));
|
||||
|
||||
Vector3 base = ins->transform.origin - ins->transform.basis.get_column(2).normalized() * d;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user