diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-12-06 19:43:22 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-12-06 19:51:13 -0300 |
commit | 7b7ba584938a276f5fe118bf46a9a9e7aab22655 (patch) | |
tree | af84a33b749cc34f348e443a09c2330d9863e320 /scene/3d | |
parent | e334b0c4b29aa018dfa4a292598c3041f2a32730 (diff) |
-Fix particles with size==0, closes #13931
-Fixed material previews (dont show sphere unless for spatial)
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/particles.cpp | 6 | ||||
-rw-r--r-- | scene/3d/particles.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 2a032f5d96..f8685a7b7c 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -869,6 +869,7 @@ void ParticlesMaterial::_update_shader() { } //scale by scale code += " float base_scale = mix(scale*tex_scale,1.0,scale_random*scale_rand);\n"; + code += " if (base_scale==0.0) base_scale=0.000001;\n"; if (trail_size_modifier.is_valid()) { code += " if (trail_divisor > 1) { base_scale *= textureLod(trail_size_modifier,vec2(float(int(NUMBER)%trail_divisor)/float(trail_divisor-1),0.0),0.0).r; } \n"; } @@ -1360,6 +1361,11 @@ void ParticlesMaterial::_validate_property(PropertyInfo &property) const { } } +Shader::Mode ParticlesMaterial::get_shader_mode() const { + + return Shader::MODE_PARTICLES; +} + void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_spread", "degrees"), &ParticlesMaterial::set_spread); diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 30080360bb..5b8121e937 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -390,6 +390,8 @@ public: RID get_shader_rid() const; + virtual Shader::Mode get_shader_mode() const; + ParticlesMaterial(); ~ParticlesMaterial(); }; |