summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/cpu_particles_2d.cpp5
-rw-r--r--scene/3d/baked_lightmap.h2
-rw-r--r--scene/3d/cpu_particles.cpp4
-rw-r--r--scene/3d/particles.cpp2
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/resources/animation.cpp2
-rw-r--r--scene/resources/particles_material.cpp5
-rw-r--r--scene/resources/resource_format_text.cpp3
8 files changed, 14 insertions, 11 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 2091085420..591933d972 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -661,8 +661,9 @@ void CPUParticles2D::_particles_process(float p_delta) {
//do none
} break;
case EMISSION_SHAPE_SPHERE: {
- Vector3 sphere_shape = Vector3(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0).normalized() * emission_sphere_radius;
- p.transform[2] = Vector2(sphere_shape.x, sphere_shape.y);
+ float s = Math::randf(), t = 2.0 * Math_PI * Math::randf();
+ float radius = emission_sphere_radius * Math::sqrt(1.0 - s * s);
+ p.transform[2] = Vector2(Math::cos(t), Math::sin(t)) * radius;
} break;
case EMISSION_SHAPE_RECTANGLE: {
p.transform[2] = Vector2(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0) * emission_rect_extents;
diff --git a/scene/3d/baked_lightmap.h b/scene/3d/baked_lightmap.h
index fac4ad3908..3a9f4cf01d 100644
--- a/scene/3d/baked_lightmap.h
+++ b/scene/3d/baked_lightmap.h
@@ -179,7 +179,7 @@ public:
void set_extents(const Vector3 &p_extents);
Vector3 get_extents() const;
- void set_bake_default_texels_per_unit(const float &p_extents);
+ void set_bake_default_texels_per_unit(const float &p_bake_texels_per_unit);
float get_bake_default_texels_per_unit() const;
void set_propagation(float p_propagation);
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 358c4bdb44..86b407b9e6 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -643,7 +643,9 @@ void CPUParticles::_particles_process(float p_delta) {
//do none
} break;
case EMISSION_SHAPE_SPHERE: {
- p.transform.origin = Vector3(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0).normalized() * emission_sphere_radius;
+ float s = 2.0 * Math::randf() - 1.0, t = 2.0 * Math_PI * Math::randf();
+ float radius = emission_sphere_radius * Math::sqrt(1.0 - s * s);
+ p.transform.origin = Vector3(radius * Math::cos(t), radius * Math::sin(t), emission_sphere_radius * s);
} break;
case EMISSION_SHAPE_BOX: {
p.transform.origin = Vector3(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0) * emission_box_extents;
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 00a168fc39..a6ccdb5791 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -257,7 +257,7 @@ String Particles::get_configuration_warning() const {
SpatialMaterial *spat = Object::cast_to<SpatialMaterial>(draw_passes[i]->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == SpatialMaterial::BILLBOARD_PARTICLES);
}
- if (meshes_found && anim_material_found) break;
+ if (anim_material_found) break;
}
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 7a015f77db..3dcbf64e7c 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1191,7 +1191,7 @@ void LineEdit::set_cursor_position(int p_pos) {
if (cursor_pos <= window_pos) {
/* Adjust window if cursor goes too much to the left */
set_window_pos(MAX(0, cursor_pos - 1));
- } else if (cursor_pos > window_pos) {
+ } else {
/* Adjust window if cursor goes too much to the right */
int window_width = get_size().width - style->get_minimum_size().width;
bool display_clear_icon = !text.empty() && is_editable() && clear_button_enabled;
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 89cbf0becd..af2a8c931f 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -1815,7 +1815,7 @@ T Animation::_interpolate(const Vector<TKey<T> > &p_keys, float p_time, Interpol
next = idx;
}
- } else if (idx < 0) {
+ } else {
// only allow extending first key to anim start if looping
if (loop)
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index edca9e5171..b4818755b4 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -332,7 +332,10 @@ void ParticlesMaterial::_update_shader() {
//do none
} break;
case EMISSION_SHAPE_SPHERE: {
- code += " TRANSFORM[3].xyz = normalize(vec3(rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0 - 1.0)) * emission_sphere_radius;\n";
+ code += " float s = rand_from_seed(alt_seed) * 2.0 - 1.0;\n";
+ code += " float t = rand_from_seed(alt_seed) * 2.0 * pi;\n";
+ code += " float radius = emission_sphere_radius * sqrt(1.0 - s * s);\n";
+ code += " TRANSFORM[3].xyz = vec3(radius * cos(t), radius * sin(t), emission_sphere_radius * s);\n";
} break;
case EMISSION_SHAPE_BOX: {
code += " TRANSFORM[3].xyz = vec3(rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0 - 1.0) * emission_box_extents;\n";
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 339f008a3d..12bf007bb1 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1537,9 +1537,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
f->store_line("]\n"); //one empty line
}
- {
- }
-
#ifdef TOOLS_ENABLED
//keep order from cached ids
Set<int> cached_ids_found;