mirror of
https://github.com/godotengine/godot.git
synced 2024-12-26 12:53:47 +00:00
Refactor 'treshold' to 'threshold'
This commit is contained in:
parent
0067982f5e
commit
2fd204c35e
@ -1325,19 +1325,19 @@ void Image::create(const char **p_xpm) {
|
||||
line++;
|
||||
}
|
||||
}
|
||||
#define DETECT_ALPHA_MAX_TRESHOLD 254
|
||||
#define DETECT_ALPHA_MIN_TRESHOLD 2
|
||||
#define DETECT_ALPHA_MAX_THRESHOLD 254
|
||||
#define DETECT_ALPHA_MIN_THRESHOLD 2
|
||||
|
||||
#define DETECT_ALPHA(m_value) \
|
||||
{ \
|
||||
uint8_t value = m_value; \
|
||||
if (value < DETECT_ALPHA_MIN_TRESHOLD) \
|
||||
bit = true; \
|
||||
else if (value < DETECT_ALPHA_MAX_TRESHOLD) { \
|
||||
\
|
||||
detected = true; \
|
||||
break; \
|
||||
} \
|
||||
#define DETECT_ALPHA(m_value) \
|
||||
{ \
|
||||
uint8_t value = m_value; \
|
||||
if (value < DETECT_ALPHA_MIN_THRESHOLD) \
|
||||
bit = true; \
|
||||
else if (value < DETECT_ALPHA_MAX_THRESHOLD) { \
|
||||
\
|
||||
detected = true; \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DETECT_NON_ALPHA(m_value) \
|
||||
@ -1673,7 +1673,7 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co
|
||||
const uint8_t *src_data_ptr = rp.ptr();
|
||||
|
||||
int pixel_size = get_format_pixel_size(format);
|
||||
|
||||
|
||||
Ref<Image> msk = p_mask;
|
||||
msk->lock();
|
||||
|
||||
@ -1683,7 +1683,7 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co
|
||||
|
||||
int src_x = clipped_src_rect.position.x + j;
|
||||
int src_y = clipped_src_rect.position.y + i;
|
||||
|
||||
|
||||
if (msk->get_pixel(src_x, src_y).a != 0) {
|
||||
|
||||
int dst_x = dest_rect.position.x + j;
|
||||
@ -2434,7 +2434,7 @@ void Image::fix_alpha_edges() {
|
||||
unsigned char *data_ptr = wp.ptr();
|
||||
|
||||
const int max_radius = 4;
|
||||
const int alpha_treshold = 20;
|
||||
const int alpha_threshold = 20;
|
||||
const int max_dist = 0x7FFFFFFF;
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
@ -2443,7 +2443,7 @@ void Image::fix_alpha_edges() {
|
||||
const uint8_t *rptr = &srcptr[(i * width + j) * 4];
|
||||
uint8_t *wptr = &data_ptr[(i * width + j) * 4];
|
||||
|
||||
if (rptr[3] >= alpha_treshold)
|
||||
if (rptr[3] >= alpha_threshold)
|
||||
continue;
|
||||
|
||||
int closest_dist = max_dist;
|
||||
@ -2465,7 +2465,7 @@ void Image::fix_alpha_edges() {
|
||||
|
||||
const uint8_t *rp = &srcptr[(k * width + l) << 2];
|
||||
|
||||
if (rp[3] < alpha_treshold)
|
||||
if (rp[3] < alpha_threshold)
|
||||
continue;
|
||||
|
||||
closest_color[0] = rp[0];
|
||||
|
@ -272,8 +272,8 @@ void Face3::project_range(const Vector3 &p_normal, const Transform &p_transform,
|
||||
|
||||
void Face3::get_support(const Vector3 &p_normal, const Transform &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const {
|
||||
|
||||
#define _FACE_IS_VALID_SUPPORT_TRESHOLD 0.98
|
||||
#define _EDGE_IS_VALID_SUPPORT_TRESHOLD 0.05
|
||||
#define _FACE_IS_VALID_SUPPORT_THRESHOLD 0.98
|
||||
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.05
|
||||
|
||||
if (p_max <= 0)
|
||||
return;
|
||||
@ -281,7 +281,7 @@ void Face3::get_support(const Vector3 &p_normal, const Transform &p_transform, V
|
||||
Vector3 n = p_transform.basis.xform_inv(p_normal);
|
||||
|
||||
/** TEST FACE AS SUPPORT **/
|
||||
if (get_plane().normal.dot(n) > _FACE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (get_plane().normal.dot(n) > _FACE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
*p_count = MIN(3, p_max);
|
||||
|
||||
@ -318,7 +318,7 @@ void Face3::get_support(const Vector3 &p_normal, const Transform &p_transform, V
|
||||
// check if edge is valid as a support
|
||||
real_t dot = (vertex[i] - vertex[(i + 1) % 3]).normalized().dot(n);
|
||||
dot = ABS(dot);
|
||||
if (dot < _EDGE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (dot < _EDGE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
*p_count = MIN(2, p_max);
|
||||
|
||||
|
10
core/sort.h
10
core/sort.h
@ -46,7 +46,7 @@ class SortArray {
|
||||
|
||||
enum {
|
||||
|
||||
INTROSORT_TRESHOLD = 16
|
||||
INTROSORT_THRESHOLD = 16
|
||||
};
|
||||
|
||||
public:
|
||||
@ -180,7 +180,7 @@ public:
|
||||
|
||||
inline void introsort(int p_first, int p_last, T *p_array, int p_max_depth) const {
|
||||
|
||||
while (p_last - p_first > INTROSORT_TRESHOLD) {
|
||||
while (p_last - p_first > INTROSORT_THRESHOLD) {
|
||||
|
||||
if (p_max_depth == 0) {
|
||||
partial_sort(p_first, p_last, p_last, p_array);
|
||||
@ -273,9 +273,9 @@ public:
|
||||
|
||||
inline void final_insertion_sort(int p_first, int p_last, T *p_array) const {
|
||||
|
||||
if (p_last - p_first > INTROSORT_TRESHOLD) {
|
||||
insertion_sort(p_first, p_first + INTROSORT_TRESHOLD, p_array);
|
||||
unguarded_insertion_sort(p_first + INTROSORT_TRESHOLD, p_last, p_array);
|
||||
if (p_last - p_first > INTROSORT_THRESHOLD) {
|
||||
insertion_sort(p_first, p_first + INTROSORT_THRESHOLD, p_array);
|
||||
unguarded_insertion_sort(p_first + INTROSORT_THRESHOLD, p_last, p_array);
|
||||
} else {
|
||||
|
||||
insertion_sort(p_first, p_last, p_array);
|
||||
|
@ -4199,7 +4199,7 @@ void RasterizerGLES2::set_camera(const Transform &p_world, const CameraMatrix &p
|
||||
|
||||
void RasterizerGLES2::add_light(RID p_light_instance) {
|
||||
|
||||
#define LIGHT_FADE_TRESHOLD 0.05
|
||||
#define LIGHT_FADE_THRESHOLD 0.05
|
||||
|
||||
ERR_FAIL_COND(light_instance_count >= MAX_SCENE_LIGHTS);
|
||||
|
||||
@ -6481,7 +6481,7 @@ void RasterizerGLES2::_process_glow_bloom() {
|
||||
|
||||
copy_shader.bind();
|
||||
copy_shader.set_uniform(CopyShaderGLES2::BLOOM, float(current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM]));
|
||||
copy_shader.set_uniform(CopyShaderGLES2::BLOOM_TRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD]));
|
||||
copy_shader.set_uniform(CopyShaderGLES2::BLOOM_THRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_THRESHOLD]));
|
||||
glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE), 0);
|
||||
|
||||
if (current_vd && current_env->fx_enabled[VS::ENV_FX_HDR]) {
|
||||
@ -6491,7 +6491,7 @@ void RasterizerGLES2::_process_glow_bloom() {
|
||||
copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_EXPOSURE, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE]));
|
||||
copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_WHITE]));
|
||||
//copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,1.0);
|
||||
copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_TRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD]));
|
||||
copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_THRESHOLD, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_THRESHOLD]));
|
||||
copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_SCALE, float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE]));
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
@ -689,14 +689,14 @@ class RasterizerGLES2 : public Rasterizer {
|
||||
fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_STRENGTH] = 1.0;
|
||||
fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE] = 0;
|
||||
fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM] = 0.0;
|
||||
fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD] = 0.5;
|
||||
fx_param[VS::ENV_FX_PARAM_GLOW_BLOOM_THRESHOLD] = 0.5;
|
||||
fx_param[VS::ENV_FX_PARAM_DOF_BLUR_PASSES] = 1;
|
||||
fx_param[VS::ENV_FX_PARAM_DOF_BLUR_BEGIN] = 100.0;
|
||||
fx_param[VS::ENV_FX_PARAM_DOF_BLUR_RANGE] = 10.0;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_TONEMAPPER] = VS::ENV_FX_HDR_TONE_MAPPER_LINEAR;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE] = 0.4;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_WHITE] = 1.0;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD] = 0.95;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_GLOW_THRESHOLD] = 0.95;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE] = 0.2;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE] = 0.4;
|
||||
fx_param[VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE] = 8.0;
|
||||
|
@ -87,7 +87,7 @@ uniform sampler2D glow_source;
|
||||
|
||||
|
||||
#if defined(USE_HDR) && defined(USE_GLOW_COPY)
|
||||
uniform highp float hdr_glow_treshold;
|
||||
uniform highp float hdr_glow_threshold;
|
||||
uniform highp float hdr_glow_scale;
|
||||
#endif
|
||||
|
||||
@ -107,7 +107,7 @@ uniform vec3 bcs;
|
||||
#ifdef USE_GLOW_COPY
|
||||
|
||||
uniform float bloom;
|
||||
uniform float bloom_treshold;
|
||||
uniform float bloom_threshold;
|
||||
|
||||
#endif
|
||||
|
||||
@ -374,11 +374,11 @@ void main() {
|
||||
|
||||
#ifdef USE_GLOW_COPY
|
||||
|
||||
highp vec3 glowcol = color.rgb*color.a+step(bloom_treshold,dot(vec3(0.3333,0.3333,0.3333),color.rgb))*bloom*color.rgb;
|
||||
highp vec3 glowcol = color.rgb*color.a+step(bloom_threshold,dot(vec3(0.3333,0.3333,0.3333),color.rgb))*bloom*color.rgb;
|
||||
|
||||
#ifdef USE_HDR
|
||||
highp float collum = max(color.r,max(color.g,color.b));
|
||||
glowcol+=color.rgb*max(collum-hdr_glow_treshold,0.0)*hdr_glow_scale;
|
||||
glowcol+=color.rgb*max(collum-hdr_glow_threshold,0.0)*hdr_glow_scale;
|
||||
#endif
|
||||
color.rgb=glowcol;
|
||||
color.a=0.0;
|
||||
@ -500,7 +500,7 @@ void main() {
|
||||
|
||||
//lum_accum=exp(lum_accum);
|
||||
|
||||
#ifdef USE_8BIT_HDR
|
||||
#ifdef USE_8BIT_HDR
|
||||
|
||||
highp float vd_lum = dot(texture2D( source_vd_lum, vec2(0.0) ), _multcv );
|
||||
lum_accum = clamp( vd_lum + (lum_accum-vd_lum)*hdr_time_delta*hdr_exp_adj_speed,min_luminance*(1.0/LUM_RANGE),max_luminance*(1.0/LUM_RANGE));
|
||||
@ -555,4 +555,3 @@ void main() {
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -869,7 +869,7 @@ void RasterizerSceneGLES3::environment_set_dof_blur_near(RID p_env, bool p_enabl
|
||||
env->dof_blur_near_amount = p_amount;
|
||||
env->dof_blur_near_quality = p_quality;
|
||||
}
|
||||
void RasterizerSceneGLES3::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_treshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_treshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) {
|
||||
void RasterizerSceneGLES3::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
@ -878,9 +878,9 @@ void RasterizerSceneGLES3::environment_set_glow(RID p_env, bool p_enable, int p_
|
||||
env->glow_levels = p_level_flags;
|
||||
env->glow_intensity = p_intensity;
|
||||
env->glow_strength = p_strength;
|
||||
env->glow_bloom = p_bloom_treshold;
|
||||
env->glow_bloom = p_bloom_threshold;
|
||||
env->glow_blend_mode = p_blend_mode;
|
||||
env->glow_hdr_bleed_treshold = p_hdr_bleed_treshold;
|
||||
env->glow_hdr_bleed_threshold = p_hdr_bleed_threshold;
|
||||
env->glow_hdr_bleed_scale = p_hdr_bleed_scale;
|
||||
env->glow_bicubic_upscale = p_bicubic_upscale;
|
||||
}
|
||||
@ -3703,7 +3703,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->exposure.color);
|
||||
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_BLOOM, env->glow_bloom);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_HDR_TRESHOLD, env->glow_hdr_bleed_treshold);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_HDR_THRESHOLD, env->glow_hdr_bleed_threshold);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_HDR_SCALE, env->glow_hdr_bleed_scale);
|
||||
|
||||
} else {
|
||||
|
@ -381,7 +381,7 @@ public:
|
||||
float glow_strength;
|
||||
float glow_bloom;
|
||||
VS::EnvironmentGlowBlendMode glow_blend_mode;
|
||||
float glow_hdr_bleed_treshold;
|
||||
float glow_hdr_bleed_threshold;
|
||||
float glow_hdr_bleed_scale;
|
||||
bool glow_bicubic_upscale;
|
||||
|
||||
@ -467,7 +467,7 @@ public:
|
||||
glow_strength = 1.0;
|
||||
glow_bloom = 0.0;
|
||||
glow_blend_mode = VS::GLOW_BLEND_MODE_SOFTLIGHT;
|
||||
glow_hdr_bleed_treshold = 1.0;
|
||||
glow_hdr_bleed_threshold = 1.0;
|
||||
glow_hdr_bleed_scale = 2.0;
|
||||
glow_bicubic_upscale = false;
|
||||
|
||||
@ -522,7 +522,7 @@ public:
|
||||
|
||||
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality);
|
||||
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality);
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_treshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_treshold, float p_hdr_bleed_scale, bool p_bicubic_upscale);
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale);
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
|
||||
|
||||
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
|
||||
|
@ -14,7 +14,7 @@ uniform vec4 blur_section;
|
||||
|
||||
void main() {
|
||||
|
||||
uv_interp = uv_in;
|
||||
uv_interp = uv_in;
|
||||
gl_Position = vertex_attrib;
|
||||
#ifdef USE_BLUR_SECTION
|
||||
|
||||
@ -99,7 +99,7 @@ uniform highp float auto_exposure_grey;
|
||||
#endif
|
||||
|
||||
uniform float glow_bloom;
|
||||
uniform float glow_hdr_treshold;
|
||||
uniform float glow_hdr_threshold;
|
||||
uniform float glow_hdr_scale;
|
||||
|
||||
#endif
|
||||
@ -262,7 +262,7 @@ void main() {
|
||||
frag_color*=exposure;
|
||||
|
||||
float luminance = max(frag_color.r,max(frag_color.g,frag_color.b));
|
||||
float feedback = max( smoothstep(glow_hdr_treshold,glow_hdr_treshold+glow_hdr_scale,luminance), glow_bloom );
|
||||
float feedback = max( smoothstep(glow_hdr_threshold,glow_hdr_threshold+glow_hdr_scale,luminance), glow_bloom );
|
||||
|
||||
frag_color *= feedback;
|
||||
|
||||
@ -285,4 +285,3 @@ void main() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
Vector<Vector2> poly = node->get_polygon();
|
||||
|
||||
//first check if a point is to be added (segment split)
|
||||
real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
|
||||
switch (mode) {
|
||||
|
||||
@ -131,7 +131,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
|
||||
if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) {
|
||||
//wip closed
|
||||
_wip_close();
|
||||
|
||||
@ -185,7 +185,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
continue; //not valid to reuse point
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
@ -214,7 +214,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
Vector2 cp = xform.xform(poly[i]);
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
@ -259,7 +259,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
Vector2 cp = xform.xform(poly[i]);
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
|
@ -126,7 +126,7 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Vector<Vector2> poly = Variant(node->get_occluder_polygon()->get_polygon());
|
||||
|
||||
//first check if a point is to be added (segment split)
|
||||
real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
|
||||
switch (mode) {
|
||||
|
||||
@ -145,12 +145,12 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
|
||||
if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) {
|
||||
//wip closed
|
||||
_wip_close(true);
|
||||
|
||||
return true;
|
||||
} else if (wip.size() > 1 && xform.xform(wip[wip.size() - 1]).distance_to(gpoint) < grab_treshold) {
|
||||
} else if (wip.size() > 1 && xform.xform(wip[wip.size() - 1]).distance_to(gpoint) < grab_threshold) {
|
||||
//wip closed
|
||||
_wip_close(false);
|
||||
return true;
|
||||
@ -204,7 +204,7 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
continue; //not valid to reuse point
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
@ -233,7 +233,7 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Vector2 cp = xform.xform(poly[i]);
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
@ -278,7 +278,7 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Vector2 cp = xform.xform(poly[i]);
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
|
@ -62,12 +62,12 @@ Vector2 Line2DEditor::mouse_to_local_pos(Vector2 gpoint, bool alt) {
|
||||
int Line2DEditor::get_point_index_at(Vector2 gpos) {
|
||||
ERR_FAIL_COND_V(node == 0, -1);
|
||||
|
||||
real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
|
||||
|
||||
for (int i = 0; i < node->get_point_count(); ++i) {
|
||||
Point2 p = xform.xform(node->get_point_pos(i));
|
||||
if (gpos.distance_to(p) < grab_treshold) {
|
||||
if (gpos.distance_to(p) < grab_threshold) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
|
||||
|
||||
//first check if a point is to be added (segment split)
|
||||
real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
|
||||
switch (mode) {
|
||||
|
||||
@ -160,7 +160,7 @@ bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
|
||||
if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) {
|
||||
//wip closed
|
||||
_wip_close();
|
||||
|
||||
@ -211,7 +211,7 @@ bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
continue; //not valid to reuse point
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_outline = j;
|
||||
closest_pos = cp;
|
||||
@ -252,7 +252,7 @@ bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
Vector2 cp = xform.xform(poly[i]);
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_outline = j;
|
||||
@ -312,7 +312,7 @@ bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||
Vector2 cp = xform.xform(poly[i]);
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_outline = j;
|
||||
|
@ -220,7 +220,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Vector<Vector2> poly = Variant(node->get_polygon());
|
||||
|
||||
//first check if a point is to be added (segment split)
|
||||
real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
|
||||
|
||||
switch (mode) {
|
||||
|
||||
@ -239,7 +239,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (wip.size() > 1 && xform.xform(wip[0] + node->get_offset()).distance_to(gpoint) < grab_treshold) {
|
||||
if (wip.size() > 1 && xform.xform(wip[0] + node->get_offset()).distance_to(gpoint) < grab_threshold) {
|
||||
//wip closed
|
||||
_wip_close();
|
||||
|
||||
@ -293,7 +293,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
continue; //not valid to reuse point
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
@ -322,7 +322,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Vector2 cp = xform.xform(poly[i] + node->get_offset());
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
@ -367,7 +367,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Vector2 cp = xform.xform(poly[i] + node->get_offset());
|
||||
|
||||
real_t d = cp.distance_to(gpoint);
|
||||
if (d < closest_dist && d < grab_treshold) {
|
||||
if (d < closest_dist && d < grab_threshold) {
|
||||
closest_dist = d;
|
||||
closest_pos = cp;
|
||||
closest_idx = i;
|
||||
|
@ -1260,7 +1260,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
|
||||
// Echo characters in X11 are a keyrelease and a keypress
|
||||
// one after the other with the (almot) same timestamp.
|
||||
// To detect them, i use XPeekEvent and check that their
|
||||
// difference in time is below a treshold.
|
||||
// difference in time is below a threshold.
|
||||
|
||||
if (xkeyevent->type != KeyPress) {
|
||||
|
||||
@ -1272,7 +1272,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
|
||||
XEvent peek_event;
|
||||
XPeekEvent(x11_display, &peek_event);
|
||||
|
||||
// I'm using a treshold of 5 msecs,
|
||||
// I'm using a threshold of 5 msecs,
|
||||
// since sometimes there seems to be a little
|
||||
// jitter. I'm still not convinced that all this approach
|
||||
// is correct, but the xorg developers are
|
||||
|
@ -471,7 +471,7 @@ bool Environment::is_ssao_blur_enabled() const {
|
||||
void Environment::set_glow_enabled(bool p_enabled) {
|
||||
|
||||
glow_enabled = p_enabled;
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
_change_notify();
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ void Environment::set_glow_level(int p_level, bool p_enabled) {
|
||||
else
|
||||
glow_levels &= ~(1 << p_level);
|
||||
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
bool Environment::is_glow_level_enabled(int p_level) const {
|
||||
|
||||
@ -502,7 +502,7 @@ void Environment::set_glow_intensity(float p_intensity) {
|
||||
|
||||
glow_intensity = p_intensity;
|
||||
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
float Environment::get_glow_intensity() const {
|
||||
|
||||
@ -512,18 +512,18 @@ float Environment::get_glow_intensity() const {
|
||||
void Environment::set_glow_strength(float p_strength) {
|
||||
|
||||
glow_strength = p_strength;
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
float Environment::get_glow_strength() const {
|
||||
|
||||
return glow_strength;
|
||||
}
|
||||
|
||||
void Environment::set_glow_bloom(float p_treshold) {
|
||||
void Environment::set_glow_bloom(float p_threshold) {
|
||||
|
||||
glow_bloom = p_treshold;
|
||||
glow_bloom = p_threshold;
|
||||
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
float Environment::get_glow_bloom() const {
|
||||
|
||||
@ -534,29 +534,29 @@ void Environment::set_glow_blend_mode(GlowBlendMode p_mode) {
|
||||
|
||||
glow_blend_mode = p_mode;
|
||||
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
Environment::GlowBlendMode Environment::get_glow_blend_mode() const {
|
||||
|
||||
return glow_blend_mode;
|
||||
}
|
||||
|
||||
void Environment::set_glow_hdr_bleed_treshold(float p_treshold) {
|
||||
void Environment::set_glow_hdr_bleed_threshold(float p_threshold) {
|
||||
|
||||
glow_hdr_bleed_treshold = p_treshold;
|
||||
glow_hdr_bleed_threshold = p_threshold;
|
||||
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
float Environment::get_glow_hdr_bleed_treshold() const {
|
||||
float Environment::get_glow_hdr_bleed_threshold() const {
|
||||
|
||||
return glow_hdr_bleed_treshold;
|
||||
return glow_hdr_bleed_threshold;
|
||||
}
|
||||
|
||||
void Environment::set_glow_hdr_bleed_scale(float p_scale) {
|
||||
|
||||
glow_hdr_bleed_scale = p_scale;
|
||||
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
float Environment::get_glow_hdr_bleed_scale() const {
|
||||
|
||||
@ -566,7 +566,7 @@ float Environment::get_glow_hdr_bleed_scale() const {
|
||||
void Environment::set_glow_bicubic_upscale(bool p_enable) {
|
||||
|
||||
glow_bicubic_upscale = p_enable;
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_treshold, glow_hdr_bleed_treshold, glow_bicubic_upscale);
|
||||
VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_bicubic_upscale);
|
||||
}
|
||||
|
||||
bool Environment::is_glow_bicubic_upscale_enabled() const {
|
||||
@ -1064,8 +1064,8 @@ void Environment::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_glow_blend_mode", "mode"), &Environment::set_glow_blend_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_glow_blend_mode"), &Environment::get_glow_blend_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_glow_hdr_bleed_treshold", "treshold"), &Environment::set_glow_hdr_bleed_treshold);
|
||||
ClassDB::bind_method(D_METHOD("get_glow_hdr_bleed_treshold"), &Environment::get_glow_hdr_bleed_treshold);
|
||||
ClassDB::bind_method(D_METHOD("set_glow_hdr_bleed_threshold", "threshold"), &Environment::set_glow_hdr_bleed_threshold);
|
||||
ClassDB::bind_method(D_METHOD("get_glow_hdr_bleed_threshold"), &Environment::get_glow_hdr_bleed_threshold);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_glow_hdr_bleed_scale", "scale"), &Environment::set_glow_hdr_bleed_scale);
|
||||
ClassDB::bind_method(D_METHOD("get_glow_hdr_bleed_scale"), &Environment::get_glow_hdr_bleed_scale);
|
||||
@ -1087,7 +1087,7 @@ void Environment::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_strength", PROPERTY_HINT_RANGE, "0.0,2.0,0.01"), "set_glow_strength", "get_glow_strength");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_bloom", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_glow_bloom", "get_glow_bloom");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "glow_blend_mode", PROPERTY_HINT_ENUM, "Additive,Screen,Softlight,Replace"), "set_glow_blend_mode", "get_glow_blend_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_hdr_treshold", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_treshold", "get_glow_hdr_bleed_treshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_hdr_threshold", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_threshold", "get_glow_hdr_bleed_threshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_hdr_scale", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_scale", "get_glow_hdr_bleed_scale");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "glow_bicubic_upscale"), "set_glow_bicubic_upscale", "is_glow_bicubic_upscale_enabled");
|
||||
|
||||
@ -1185,7 +1185,7 @@ Environment::Environment() {
|
||||
glow_strength = 1.0;
|
||||
glow_bloom = 0.0;
|
||||
glow_blend_mode = GLOW_BLEND_MODE_SOFTLIGHT;
|
||||
glow_hdr_bleed_treshold = 1.0;
|
||||
glow_hdr_bleed_threshold = 1.0;
|
||||
glow_hdr_bleed_scale = 2.0;
|
||||
glow_bicubic_upscale = false;
|
||||
|
||||
|
@ -121,7 +121,7 @@ private:
|
||||
float glow_strength;
|
||||
float glow_bloom;
|
||||
GlowBlendMode glow_blend_mode;
|
||||
float glow_hdr_bleed_treshold;
|
||||
float glow_hdr_bleed_threshold;
|
||||
float glow_hdr_bleed_scale;
|
||||
bool glow_bicubic_upscale;
|
||||
|
||||
@ -275,14 +275,14 @@ public:
|
||||
void set_glow_strength(float p_strength);
|
||||
float get_glow_strength() const;
|
||||
|
||||
void set_glow_bloom(float p_treshold);
|
||||
void set_glow_bloom(float p_threshold);
|
||||
float get_glow_bloom() const;
|
||||
|
||||
void set_glow_blend_mode(GlowBlendMode p_mode);
|
||||
GlowBlendMode get_glow_blend_mode() const;
|
||||
|
||||
void set_glow_hdr_bleed_treshold(float p_treshold);
|
||||
float get_glow_hdr_bleed_treshold() const;
|
||||
void set_glow_hdr_bleed_threshold(float p_threshold);
|
||||
float get_glow_hdr_bleed_threshold() const;
|
||||
|
||||
void set_glow_hdr_bleed_scale(float p_scale);
|
||||
float get_glow_hdr_bleed_scale() const;
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
void AudioEffectCompressorInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
|
||||
|
||||
float treshold = Math::db2linear(base->treshold);
|
||||
float threshold = Math::db2linear(base->threshold);
|
||||
float sample_rate = AudioServer::get_singleton()->get_mix_rate();
|
||||
|
||||
float ratatcoef = exp(-1 / (0.00001f * sample_rate));
|
||||
@ -66,7 +66,7 @@ void AudioEffectCompressorInstance::process(const AudioFrame *p_src_frames, Audi
|
||||
|
||||
float peak = MAX(s.l, s.r);
|
||||
|
||||
float overdb = 2.08136898f * Math::linear2db(peak / treshold);
|
||||
float overdb = 2.08136898f * Math::linear2db(peak / threshold);
|
||||
|
||||
if (overdb < 0.0) //we only care about what goes over to compress
|
||||
overdb = 0.0;
|
||||
@ -125,14 +125,14 @@ Ref<AudioEffectInstance> AudioEffectCompressor::instance() {
|
||||
return ins;
|
||||
}
|
||||
|
||||
void AudioEffectCompressor::set_treshold(float p_treshold) {
|
||||
void AudioEffectCompressor::set_threshold(float p_threshold) {
|
||||
|
||||
treshold = p_treshold;
|
||||
threshold = p_threshold;
|
||||
}
|
||||
|
||||
float AudioEffectCompressor::get_treshold() const {
|
||||
float AudioEffectCompressor::get_threshold() const {
|
||||
|
||||
return treshold;
|
||||
return threshold;
|
||||
}
|
||||
|
||||
void AudioEffectCompressor::set_ratio(float p_ratio) {
|
||||
@ -208,8 +208,8 @@ void AudioEffectCompressor::_validate_property(PropertyInfo &property) const {
|
||||
|
||||
void AudioEffectCompressor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_treshold", "treshold"), &AudioEffectCompressor::set_treshold);
|
||||
ClassDB::bind_method(D_METHOD("get_treshold"), &AudioEffectCompressor::get_treshold);
|
||||
ClassDB::bind_method(D_METHOD("set_threshold", "threshold"), &AudioEffectCompressor::set_threshold);
|
||||
ClassDB::bind_method(D_METHOD("get_threshold"), &AudioEffectCompressor::get_threshold);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_ratio", "ratio"), &AudioEffectCompressor::set_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_ratio"), &AudioEffectCompressor::get_ratio);
|
||||
@ -229,7 +229,7 @@ void AudioEffectCompressor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_sidechain", "sidechain"), &AudioEffectCompressor::set_sidechain);
|
||||
ClassDB::bind_method(D_METHOD("get_sidechain"), &AudioEffectCompressor::get_sidechain);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "treshold", PROPERTY_HINT_RANGE, "-60,0,0.1"), "set_treshold", "get_treshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "threshold", PROPERTY_HINT_RANGE, "-60,0,0.1"), "set_threshold", "get_threshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ratio", PROPERTY_HINT_RANGE, "1,48,0.1"), "set_ratio", "get_ratio");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "gain", PROPERTY_HINT_RANGE, "-20,20,0.1"), "set_gain", "get_gain");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "attack_us", PROPERTY_HINT_RANGE, "20,2000,1"), "set_attack_us", "get_attack_us");
|
||||
@ -239,7 +239,7 @@ void AudioEffectCompressor::_bind_methods() {
|
||||
}
|
||||
|
||||
AudioEffectCompressor::AudioEffectCompressor() {
|
||||
treshold = 0;
|
||||
threshold = 0;
|
||||
ratio = 4;
|
||||
gain = 0;
|
||||
attack_us = 20;
|
||||
|
@ -51,7 +51,7 @@ class AudioEffectCompressor : public AudioEffect {
|
||||
GDCLASS(AudioEffectCompressor, AudioEffect)
|
||||
|
||||
friend class AudioEffectCompressorInstance;
|
||||
float treshold;
|
||||
float threshold;
|
||||
float ratio;
|
||||
float gain;
|
||||
float attack_us;
|
||||
@ -66,8 +66,8 @@ protected:
|
||||
public:
|
||||
Ref<AudioEffectInstance> instance();
|
||||
|
||||
void set_treshold(float p_treshold);
|
||||
float get_treshold() const;
|
||||
void set_threshold(float p_threshold);
|
||||
float get_threshold() const;
|
||||
|
||||
void set_ratio(float p_ratio);
|
||||
float get_ratio() const;
|
||||
|
@ -31,8 +31,8 @@
|
||||
|
||||
void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
|
||||
|
||||
float thresh = Math::db2linear(base->treshold);
|
||||
float threshdb = base->treshold;
|
||||
float thresh = Math::db2linear(base->threshold);
|
||||
float threshdb = base->threshold;
|
||||
float ceiling = Math::db2linear(base->ceiling);
|
||||
float ceildb = base->ceiling;
|
||||
float makeup = Math::db2linear(ceildb - threshdb);
|
||||
@ -81,14 +81,14 @@ Ref<AudioEffectInstance> AudioEffectLimiter::instance() {
|
||||
return ins;
|
||||
}
|
||||
|
||||
void AudioEffectLimiter::set_treshold_db(float p_treshold) {
|
||||
void AudioEffectLimiter::set_threshold_db(float p_threshold) {
|
||||
|
||||
treshold = p_treshold;
|
||||
threshold = p_threshold;
|
||||
}
|
||||
|
||||
float AudioEffectLimiter::get_treshold_db() const {
|
||||
float AudioEffectLimiter::get_threshold_db() const {
|
||||
|
||||
return treshold;
|
||||
return threshold;
|
||||
}
|
||||
|
||||
void AudioEffectLimiter::set_ceiling_db(float p_ceiling) {
|
||||
@ -123,8 +123,8 @@ void AudioEffectLimiter::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_ceiling_db", "ceiling"), &AudioEffectLimiter::set_ceiling_db);
|
||||
ClassDB::bind_method(D_METHOD("get_ceiling_db"), &AudioEffectLimiter::get_ceiling_db);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_treshold_db", "treshold"), &AudioEffectLimiter::set_treshold_db);
|
||||
ClassDB::bind_method(D_METHOD("get_treshold_db"), &AudioEffectLimiter::get_treshold_db);
|
||||
ClassDB::bind_method(D_METHOD("set_threshold_db", "threshold"), &AudioEffectLimiter::set_threshold_db);
|
||||
ClassDB::bind_method(D_METHOD("get_threshold_db"), &AudioEffectLimiter::get_threshold_db);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_soft_clip_db", "soft_clip"), &AudioEffectLimiter::set_soft_clip_db);
|
||||
ClassDB::bind_method(D_METHOD("get_soft_clip_db"), &AudioEffectLimiter::get_soft_clip_db);
|
||||
@ -133,13 +133,13 @@ void AudioEffectLimiter::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_soft_clip_ratio"), &AudioEffectLimiter::get_soft_clip_ratio);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ceiling_db", PROPERTY_HINT_RANGE, "-20,-0.1,0.1"), "set_ceiling_db", "get_ceiling_db");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "treshold_db", PROPERTY_HINT_RANGE, "-30,0,0.1"), "set_treshold_db", "get_treshold_db");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "threshold_db", PROPERTY_HINT_RANGE, "-30,0,0.1"), "set_threshold_db", "get_threshold_db");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "soft_clip_db", PROPERTY_HINT_RANGE, "0,6,0.1"), "set_soft_clip_db", "get_soft_clip_db");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "soft_clip_ratio", PROPERTY_HINT_RANGE, "3,20,0.1"), "set_soft_clip_ratio", "get_soft_clip_ratio");
|
||||
}
|
||||
|
||||
AudioEffectLimiter::AudioEffectLimiter() {
|
||||
treshold = 0;
|
||||
threshold = 0;
|
||||
ceiling = -0.1;
|
||||
soft_clip = 2;
|
||||
soft_clip_ratio = 10;
|
||||
|
@ -49,7 +49,7 @@ class AudioEffectLimiter : public AudioEffect {
|
||||
GDCLASS(AudioEffectLimiter, AudioEffect)
|
||||
|
||||
friend class AudioEffectLimiterInstance;
|
||||
float treshold;
|
||||
float threshold;
|
||||
float ceiling;
|
||||
float soft_clip;
|
||||
float soft_clip_ratio;
|
||||
@ -58,8 +58,8 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void set_treshold_db(float p_treshold);
|
||||
float get_treshold_db() const;
|
||||
void set_threshold_db(float p_threshold);
|
||||
float get_threshold_db() const;
|
||||
|
||||
void set_ceiling_db(float p_ceiling);
|
||||
float get_ceiling_db() const;
|
||||
|
@ -252,7 +252,7 @@ void AudioServer::_mix_step() {
|
||||
if (!bus->channels[k].used) {
|
||||
//see if any audio is contained, because channel was not used
|
||||
|
||||
if (MAX(peak.r, peak.l) > Math::db2linear(channel_disable_treshold_db)) {
|
||||
if (MAX(peak.r, peak.l) > Math::db2linear(channel_disable_threshold_db)) {
|
||||
bus->channels[k].last_mix_with_audio = mix_frames;
|
||||
} else if (mix_frames - bus->channels[k].last_mix_with_audio > channel_disable_frames) {
|
||||
bus->channels[k].active = false;
|
||||
@ -713,7 +713,7 @@ bool AudioServer::is_bus_channel_active(int p_bus, int p_channel) const {
|
||||
|
||||
void AudioServer::init() {
|
||||
|
||||
channel_disable_treshold_db = GLOBAL_DEF("audio/channel_disable_treshold_db", -60.0);
|
||||
channel_disable_threshold_db = GLOBAL_DEF("audio/channel_disable_threshold_db", -60.0);
|
||||
channel_disable_frames = float(GLOBAL_DEF("audio/channel_disable_time", 2.0)) * get_mix_rate();
|
||||
buffer_size = 1024; //harcoded for now
|
||||
switch (get_speaker_mode()) {
|
||||
|
@ -113,7 +113,7 @@ private:
|
||||
uint64_t mix_count;
|
||||
uint64_t mix_frames;
|
||||
|
||||
float channel_disable_treshold_db;
|
||||
float channel_disable_threshold_db;
|
||||
uint32_t channel_disable_frames;
|
||||
|
||||
int to_mix;
|
||||
|
@ -706,7 +706,7 @@ bool BodySW::sleep_test(real_t p_step) {
|
||||
else if (!can_sleep)
|
||||
return false;
|
||||
|
||||
if (Math::abs(angular_velocity.length()) < get_space()->get_body_angular_velocity_sleep_treshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_treshold() * get_space()->get_body_linear_velocity_sleep_treshold()) {
|
||||
if (Math::abs(angular_velocity.length()) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
|
||||
|
||||
still_time += p_step;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "collision_solver_sat.h"
|
||||
#include "geometry.h"
|
||||
|
||||
#define _EDGE_IS_VALID_SUPPORT_TRESHOLD 0.02
|
||||
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.02
|
||||
|
||||
struct _CollectorCallback {
|
||||
|
||||
|
@ -812,13 +812,13 @@ void PhysicsServerSW::body_get_collision_exceptions(RID p_body, List<RID> *p_exc
|
||||
}
|
||||
};
|
||||
|
||||
void PhysicsServerSW::body_set_contacts_reported_depth_treshold(RID p_body, real_t p_treshold) {
|
||||
void PhysicsServerSW::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {
|
||||
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
};
|
||||
|
||||
real_t PhysicsServerSW::body_get_contacts_reported_depth_treshold(RID p_body) const {
|
||||
real_t PhysicsServerSW::body_get_contacts_reported_depth_threshold(RID p_body) const {
|
||||
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body, 0);
|
||||
|
@ -200,8 +200,8 @@ public:
|
||||
virtual void body_remove_collision_exception(RID p_body, RID p_body_b);
|
||||
virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions);
|
||||
|
||||
virtual void body_set_contacts_reported_depth_treshold(RID p_body, real_t p_treshold);
|
||||
virtual real_t body_get_contacts_reported_depth_treshold(RID p_body) const;
|
||||
virtual void body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold);
|
||||
virtual real_t body_get_contacts_reported_depth_threshold(RID p_body) const;
|
||||
|
||||
virtual void body_set_omit_force_integration(RID p_body, bool p_omit);
|
||||
virtual bool body_is_omitting_force_integration(RID p_body) const;
|
||||
|
@ -32,8 +32,8 @@
|
||||
#include "quick_hull.h"
|
||||
#include "sort.h"
|
||||
#define _POINT_SNAP 0.001953125
|
||||
#define _EDGE_IS_VALID_SUPPORT_TRESHOLD 0.0002
|
||||
#define _FACE_IS_VALID_SUPPORT_TRESHOLD 0.9998
|
||||
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.0002
|
||||
#define _FACE_IS_VALID_SUPPORT_THRESHOLD 0.9998
|
||||
|
||||
void ShapeSW::configure(const Rect3 &p_aabb) {
|
||||
aabb = p_aabb;
|
||||
@ -165,7 +165,7 @@ Vector3 RayShapeSW::get_support(const Vector3 &p_normal) const {
|
||||
|
||||
void RayShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
|
||||
|
||||
if (Math::abs(p_normal.z) < _EDGE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (Math::abs(p_normal.z) < _EDGE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
r_amount = 2;
|
||||
r_supports[0] = Vector3(0, 0, 0);
|
||||
@ -306,7 +306,7 @@ void BoxShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_sup
|
||||
Vector3 axis;
|
||||
axis[i] = 1.0;
|
||||
real_t dot = p_normal.dot(axis);
|
||||
if (Math::abs(dot) > _FACE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (Math::abs(dot) > _FACE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
//Vector3 axis_b;
|
||||
|
||||
@ -350,7 +350,7 @@ void BoxShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_sup
|
||||
Vector3 axis;
|
||||
axis[i] = 1.0;
|
||||
|
||||
if (Math::abs(p_normal.dot(axis)) < _EDGE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (Math::abs(p_normal.dot(axis)) < _EDGE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
r_amount = 2;
|
||||
|
||||
@ -460,7 +460,7 @@ void CapsuleShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r
|
||||
|
||||
real_t d = n.z;
|
||||
|
||||
if (Math::abs(d) < _EDGE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (Math::abs(d) < _EDGE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
// make it flat
|
||||
n.z = 0.0;
|
||||
@ -655,7 +655,7 @@ void ConvexPolygonShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vect
|
||||
|
||||
for (int i = 0; i < fc; i++) {
|
||||
|
||||
if (faces[i].plane.normal.dot(p_normal) > _FACE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (faces[i].plane.normal.dot(p_normal) > _FACE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
int ic = faces[i].indices.size();
|
||||
const int *ind = faces[i].indices.ptr();
|
||||
@ -685,7 +685,7 @@ void ConvexPolygonShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vect
|
||||
|
||||
real_t dot = (vertices[edges[i].a] - vertices[edges[i].b]).normalized().dot(p_normal);
|
||||
dot = ABS(dot);
|
||||
if (dot < _EDGE_IS_VALID_SUPPORT_TRESHOLD && (edges[i].a == vtx || edges[i].b == vtx)) {
|
||||
if (dot < _EDGE_IS_VALID_SUPPORT_THRESHOLD && (edges[i].a == vtx || edges[i].b == vtx)) {
|
||||
|
||||
r_amount = 2;
|
||||
r_supports[0] = vertices[edges[i].a];
|
||||
@ -818,7 +818,7 @@ void FaceShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_su
|
||||
Vector3 n = p_normal;
|
||||
|
||||
/** TEST FACE AS SUPPORT **/
|
||||
if (normal.dot(n) > _FACE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (normal.dot(n) > _FACE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
r_amount = 3;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
@ -854,7 +854,7 @@ void FaceShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_su
|
||||
// check if edge is valid as a support
|
||||
real_t dot = (vertex[i] - vertex[nx]).normalized().dot(n);
|
||||
dot = ABS(dot);
|
||||
if (dot < _EDGE_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (dot < _EDGE_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
r_amount = 2;
|
||||
r_supports[0] = vertex[i];
|
||||
|
@ -597,8 +597,8 @@ void SpaceSW::set_param(PhysicsServer::SpaceParameter p_param, real_t p_value) {
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: body_angular_velocity_damp_ratio = p_value; break;
|
||||
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
|
||||
@ -612,8 +612,8 @@ real_t SpaceSW::get_param(PhysicsServer::SpaceParameter p_param) const {
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: return body_linear_velocity_sleep_threshold;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: return body_angular_velocity_sleep_threshold;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: return body_angular_velocity_damp_ratio;
|
||||
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
|
||||
|
@ -152,8 +152,8 @@ public:
|
||||
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
|
||||
_FORCE_INLINE_ real_t get_contact_max_allowed_penetration() const { return contact_max_allowed_penetration; }
|
||||
_FORCE_INLINE_ real_t get_constraint_bias() const { return constraint_bias; }
|
||||
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_threshold; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_threshold; }
|
||||
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_threshold() const { return body_linear_velocity_sleep_threshold; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_threshold() const { return body_angular_velocity_sleep_threshold; }
|
||||
_FORCE_INLINE_ real_t get_body_time_to_sleep() const { return body_time_to_sleep; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_damp_ratio() const { return body_angular_velocity_damp_ratio; }
|
||||
|
||||
|
@ -621,7 +621,7 @@ bool Body2DSW::sleep_test(real_t p_step) {
|
||||
else if (!can_sleep)
|
||||
return false;
|
||||
|
||||
if (Math::abs(angular_velocity) < get_space()->get_body_angular_velocity_sleep_treshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_treshold() * get_space()->get_body_linear_velocity_sleep_treshold()) {
|
||||
if (Math::abs(angular_velocity) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
|
||||
|
||||
still_time += p_step;
|
||||
|
||||
|
@ -636,7 +636,7 @@ BroadPhase2DHashGrid::BroadPhase2DHashGrid() {
|
||||
hash_table = memnew_arr(PosBin *, hash_table_size);
|
||||
|
||||
cell_size = GLOBAL_DEF("physics/2d/cell_size", 128);
|
||||
large_object_min_surface = GLOBAL_DEF("physics/2d/large_object_surface_treshold_in_cells", 512);
|
||||
large_object_min_surface = GLOBAL_DEF("physics/2d/large_object_surface_threshold_in_cells", 512);
|
||||
|
||||
for (int i = 0; i < hash_table_size; i++)
|
||||
hash_table[i] = NULL;
|
||||
|
@ -853,13 +853,13 @@ void Physics2DServerSW::body_get_collision_exceptions(RID p_body, List<RID> *p_e
|
||||
}
|
||||
};
|
||||
|
||||
void Physics2DServerSW::body_set_contacts_reported_depth_treshold(RID p_body, real_t p_treshold) {
|
||||
void Physics2DServerSW::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
};
|
||||
|
||||
real_t Physics2DServerSW::body_get_contacts_reported_depth_treshold(RID p_body) const {
|
||||
real_t Physics2DServerSW::body_get_contacts_reported_depth_threshold(RID p_body) const {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body, 0);
|
||||
|
@ -205,8 +205,8 @@ public:
|
||||
virtual void body_remove_collision_exception(RID p_body, RID p_body_b);
|
||||
virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions);
|
||||
|
||||
virtual void body_set_contacts_reported_depth_treshold(RID p_body, real_t p_treshold);
|
||||
virtual real_t body_get_contacts_reported_depth_treshold(RID p_body) const;
|
||||
virtual void body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold);
|
||||
virtual real_t body_get_contacts_reported_depth_threshold(RID p_body) const;
|
||||
|
||||
virtual void body_set_omit_force_integration(RID p_body, bool p_omit);
|
||||
virtual bool body_is_omitting_force_integration(RID p_body) const;
|
||||
|
@ -233,8 +233,8 @@ public:
|
||||
FUNC2(body_set_max_contacts_reported, RID, int);
|
||||
FUNC1RC(int, body_get_max_contacts_reported, RID);
|
||||
|
||||
FUNC2(body_set_contacts_reported_depth_treshold, RID, real_t);
|
||||
FUNC1RC(real_t, body_get_contacts_reported_depth_treshold, RID);
|
||||
FUNC2(body_set_contacts_reported_depth_threshold, RID, real_t);
|
||||
FUNC1RC(real_t, body_get_contacts_reported_depth_threshold, RID);
|
||||
|
||||
FUNC2(body_set_omit_force_integration, RID, bool);
|
||||
FUNC1RC(bool, body_is_omitting_force_integration, RID);
|
||||
|
@ -197,7 +197,7 @@ Variant RayShape2DSW::get_data() const {
|
||||
|
||||
void SegmentShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const {
|
||||
|
||||
if (Math::abs(p_normal.dot(n)) > _SEGMENT_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (Math::abs(p_normal.dot(n)) > _SEGMENT_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
r_supports[0] = a;
|
||||
r_supports[1] = b;
|
||||
r_amount = 2;
|
||||
@ -337,7 +337,7 @@ void RectangleShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_suppor
|
||||
Vector2 ag;
|
||||
ag[i] = 1.0;
|
||||
real_t dp = ag.dot(p_normal);
|
||||
if (Math::abs(dp) < _SEGMENT_IS_VALID_SUPPORT_TRESHOLD)
|
||||
if (Math::abs(dp) < _SEGMENT_IS_VALID_SUPPORT_THRESHOLD)
|
||||
continue;
|
||||
|
||||
real_t sgn = dp > 0 ? 1.0 : -1.0;
|
||||
@ -400,7 +400,7 @@ void CapsuleShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports
|
||||
|
||||
real_t d = n.y;
|
||||
|
||||
if (Math::abs(d) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_TRESHOLD)) {
|
||||
if (Math::abs(d) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_THRESHOLD)) {
|
||||
|
||||
// make it flat
|
||||
n.y = 0.0;
|
||||
@ -547,7 +547,7 @@ void ConvexPolygonShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_su
|
||||
}
|
||||
|
||||
//test segment
|
||||
if (points[i].normal.dot(p_normal) > _SEGMENT_IS_VALID_SUPPORT_TRESHOLD) {
|
||||
if (points[i].normal.dot(p_normal) > _SEGMENT_IS_VALID_SUPPORT_THRESHOLD) {
|
||||
|
||||
r_amount = 2;
|
||||
r_supports[0] = points[i].pos;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define SHAPE_2D_2DSW_H
|
||||
|
||||
#include "servers/physics_2d_server.h"
|
||||
#define _SEGMENT_IS_VALID_SUPPORT_TRESHOLD 0.99998
|
||||
#define _SEGMENT_IS_VALID_SUPPORT_THRESHOLD 0.99998
|
||||
|
||||
/*
|
||||
|
||||
@ -106,7 +106,7 @@ public:
|
||||
|
||||
if (r_amount == 1) {
|
||||
|
||||
if (Math::abs(p_normal.dot(p_cast.normalized())) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_TRESHOLD)) {
|
||||
if (Math::abs(p_normal.dot(p_cast.normalized())) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_THRESHOLD)) {
|
||||
//make line because they are parallel
|
||||
r_amount = 2;
|
||||
r_supports[1] = r_supports[0] + p_cast;
|
||||
@ -117,7 +117,7 @@ public:
|
||||
|
||||
} else {
|
||||
|
||||
if (Math::abs(p_normal.dot(p_cast.normalized())) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_TRESHOLD)) {
|
||||
if (Math::abs(p_normal.dot(p_cast.normalized())) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_THRESHOLD)) {
|
||||
//optimize line and make it larger because they are parallel
|
||||
if ((r_supports[1] - r_supports[0]).dot(p_cast) > 0) {
|
||||
//larger towards 1
|
||||
|
@ -1130,8 +1130,8 @@ void Space2DSW::set_param(Physics2DServer::SpaceParameter p_param, real_t p_valu
|
||||
case Physics2DServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: body_linear_velocity_sleep_treshold = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: body_angular_velocity_sleep_treshold = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
|
||||
case Physics2DServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
|
||||
}
|
||||
@ -1144,8 +1144,8 @@ real_t Space2DSW::get_param(Physics2DServer::SpaceParameter p_param) const {
|
||||
case Physics2DServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
|
||||
case Physics2DServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: return body_linear_velocity_sleep_treshold;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: return body_angular_velocity_sleep_treshold;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
|
||||
case Physics2DServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
|
||||
case Physics2DServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
|
||||
}
|
||||
@ -1186,8 +1186,8 @@ Space2DSW::Space2DSW() {
|
||||
contact_max_allowed_penetration = 0.3;
|
||||
|
||||
constraint_bias = 0.2;
|
||||
body_linear_velocity_sleep_treshold = GLOBAL_DEF("physics/2d/sleep_threashold_linear", 2.0);
|
||||
body_angular_velocity_sleep_treshold = GLOBAL_DEF("physics/2d/sleep_threshold_angular", (8.0 / 180.0 * Math_PI));
|
||||
body_linear_velocity_sleep_threshold = GLOBAL_DEF("physics/2d/sleep_threashold_linear", 2.0);
|
||||
body_angular_velocity_sleep_threshold = GLOBAL_DEF("physics/2d/sleep_threshold_angular", (8.0 / 180.0 * Math_PI));
|
||||
body_time_to_sleep = GLOBAL_DEF("physics/2d/time_before_sleep", 0.5);
|
||||
|
||||
broadphase = BroadPhase2DSW::create_func();
|
||||
|
@ -103,8 +103,8 @@ private:
|
||||
CollisionObject2DSW *intersection_query_results[INTERSECTION_QUERY_MAX];
|
||||
int intersection_query_subindex_results[INTERSECTION_QUERY_MAX];
|
||||
|
||||
real_t body_linear_velocity_sleep_treshold;
|
||||
real_t body_angular_velocity_sleep_treshold;
|
||||
real_t body_linear_velocity_sleep_threshold;
|
||||
real_t body_angular_velocity_sleep_threshold;
|
||||
real_t body_time_to_sleep;
|
||||
|
||||
bool locked;
|
||||
@ -152,8 +152,8 @@ public:
|
||||
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
|
||||
_FORCE_INLINE_ real_t get_contact_max_allowed_penetration() const { return contact_max_allowed_penetration; }
|
||||
_FORCE_INLINE_ real_t get_constraint_bias() const { return constraint_bias; }
|
||||
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_treshold; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_treshold; }
|
||||
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_threshold() const { return body_linear_velocity_sleep_threshold; }
|
||||
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_threshold() const { return body_angular_velocity_sleep_threshold; }
|
||||
_FORCE_INLINE_ real_t get_body_time_to_sleep() const { return body_time_to_sleep; }
|
||||
|
||||
void update();
|
||||
|
@ -607,8 +607,8 @@ void Physics2DServer::_bind_methods() {
|
||||
BIND_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS);
|
||||
BIND_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION);
|
||||
BIND_CONSTANT(SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION);
|
||||
BIND_CONSTANT(SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD);
|
||||
BIND_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD);
|
||||
BIND_CONSTANT(SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD);
|
||||
BIND_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD);
|
||||
BIND_CONSTANT(SPACE_PARAM_BODY_TIME_TO_SLEEP);
|
||||
BIND_CONSTANT(SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS);
|
||||
|
||||
|
@ -272,8 +272,8 @@ public:
|
||||
SPACE_PARAM_CONTACT_RECYCLE_RADIUS,
|
||||
SPACE_PARAM_CONTACT_MAX_SEPARATION,
|
||||
SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION,
|
||||
SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD,
|
||||
SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD,
|
||||
SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD,
|
||||
SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD,
|
||||
SPACE_PARAM_BODY_TIME_TO_SLEEP,
|
||||
SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS,
|
||||
};
|
||||
@ -454,8 +454,8 @@ public:
|
||||
virtual int body_get_max_contacts_reported(RID p_body) const = 0;
|
||||
|
||||
//missing remove
|
||||
virtual void body_set_contacts_reported_depth_treshold(RID p_body, float p_treshold) = 0;
|
||||
virtual float body_get_contacts_reported_depth_treshold(RID p_body) const = 0;
|
||||
virtual void body_set_contacts_reported_depth_threshold(RID p_body, float p_threshold) = 0;
|
||||
virtual float body_get_contacts_reported_depth_threshold(RID p_body) const = 0;
|
||||
|
||||
virtual void body_set_omit_force_integration(RID p_body, bool p_omit) = 0;
|
||||
virtual bool body_is_omitting_force_integration(RID p_body) const = 0;
|
||||
|
@ -261,8 +261,8 @@ public:
|
||||
SPACE_PARAM_CONTACT_RECYCLE_RADIUS,
|
||||
SPACE_PARAM_CONTACT_MAX_SEPARATION,
|
||||
SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION,
|
||||
SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD,
|
||||
SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD,
|
||||
SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD,
|
||||
SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD,
|
||||
SPACE_PARAM_BODY_TIME_TO_SLEEP,
|
||||
SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO,
|
||||
SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS,
|
||||
@ -447,8 +447,8 @@ public:
|
||||
virtual int body_get_max_contacts_reported(RID p_body) const = 0;
|
||||
|
||||
//missing remove
|
||||
virtual void body_set_contacts_reported_depth_treshold(RID p_body, float p_treshold) = 0;
|
||||
virtual float body_get_contacts_reported_depth_treshold(RID p_body) const = 0;
|
||||
virtual void body_set_contacts_reported_depth_threshold(RID p_body, float p_threshold) = 0;
|
||||
virtual float body_get_contacts_reported_depth_threshold(RID p_body) const = 0;
|
||||
|
||||
virtual void body_set_omit_force_integration(RID p_body, bool p_omit) = 0;
|
||||
virtual bool body_is_omitting_force_integration(RID p_body) const = 0;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) = 0;
|
||||
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) = 0;
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_treshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_treshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) = 0;
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) = 0;
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0;
|
||||
|
||||
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0;
|
||||
|
@ -657,7 +657,7 @@ public:
|
||||
GLOW_BLEND_MODE_SOFTLIGHT,
|
||||
GLOW_BLEND_MODE_REPLACE,
|
||||
};
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_treshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_treshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) = 0;
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) = 0;
|
||||
|
||||
enum EnvironmentToneMapper {
|
||||
ENV_TONE_MAPPER_LINEAR,
|
||||
|
Loading…
Reference in New Issue
Block a user