Merge pull request #18374 from JFonS/fix_particles_animation

Fix particle animation controls
This commit is contained in:
Juan Linietsky 2018-05-08 11:34:34 -03:00 committed by GitHub
commit aacd7f012e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -552,7 +552,7 @@ void SpatialMaterial::_update_shader() {
//handle animation //handle animation
code += "\tint particle_total_frames = particles_anim_h_frames * particles_anim_v_frames;\n"; code += "\tint particle_total_frames = particles_anim_h_frames * particles_anim_v_frames;\n";
code += "\tint particle_frame = int(INSTANCE_CUSTOM.y * float(particle_total_frames));\n"; code += "\tint particle_frame = int(INSTANCE_CUSTOM.z * float(particle_total_frames));\n";
code += "\tif (particles_anim_loop) particle_frame=clamp(particle_frame,0,particle_total_frames-1); else particle_frame=abs(particle_frame)%particle_total_frames;\n"; code += "\tif (particles_anim_loop) particle_frame=clamp(particle_frame,0,particle_total_frames-1); else particle_frame=abs(particle_frame)%particle_total_frames;\n";
code += "\tUV /= vec2(float(particles_anim_h_frames),float(particles_anim_v_frames));\n"; code += "\tUV /= vec2(float(particles_anim_h_frames),float(particles_anim_v_frames));\n";
code += "\tUV += vec2(float(particle_frame % particles_anim_h_frames) / float(particles_anim_h_frames),float(particle_frame / particles_anim_h_frames) / float(particles_anim_v_frames));\n"; code += "\tUV += vec2(float(particle_frame % particles_anim_h_frames) / float(particles_anim_h_frames),float(particle_frame / particles_anim_h_frames) / float(particles_anim_v_frames));\n";