X-Git-Url: http://nitlanguage.org diff --git a/lib/gamnit/depth/particles.nit b/lib/gamnit/depth/particles.nit index e3be795..3c40ac1 100644 --- a/lib/gamnit/depth/particles.nit +++ b/lib/gamnit/depth/particles.nit @@ -39,6 +39,9 @@ import depth_core redef class App + # Graphics program to display static non-moving particles + var static_program = new ParticleProgram + # Graphics program to display blowing up particles var explosion_program = new ExplosionProgram @@ -153,7 +156,7 @@ end # # This program should be subclassed to create custom particle effects. # Either `vertex_shader_source` and `vertex_shader_core` can be refined. -abstract class ParticleProgram +class ParticleProgram super GamnitProgramFromSource redef var vertex_shader_source = """ @@ -249,12 +252,12 @@ abstract class ParticleProgram uniform bool use_texture; // Texture to apply on this particle - uniform sampler2D texture; + uniform sampler2D texture0; void main() { if (use_texture) { - gl_FragColor = texture2D(texture, gl_PointCoord) * v_color; + gl_FragColor = texture2D(texture0, gl_PointCoord) * v_color; if (gl_FragColor.a <= 0.01) discard; } else { gl_FragColor = v_color; @@ -269,7 +272,7 @@ abstract class ParticleProgram var use_texture = uniforms["use_texture"].as(UniformBool) is lazy # Visible texture unit - var texture = uniforms["texture"].as(UniformSampler2D) is lazy + var texture = uniforms["texture0"].as(UniformSampler2D) is lazy # Color tint per vertex var color = attributes["color"].as(AttributeVec4) is lazy