void TrailParticles::add(LineSegment<3> line_segment, const Vec3 & color) { const RealT DENSITY = 2.0; RealT density = DENSITY; while ((density -= real_random()) > 0) { Vec3 point = line_segment.point_at_time(density / DENSITY); point[X] += real_random(-0.2, 0.2); point[Y] += real_random(-0.2, 0.2); point[Z] += real_random(-0.2, 0.2); Particle particle; particle.velocity = Vec3(0.0, 0.0, 0.0); particle.set_position(point, Vec3(-0.1, -0.1, 0.0), Vec3(0.0, 0.0, -1.0), 0.0); particle.add_life(0.4 + real_random() * 0.4); particle.color = color; particle.set_random_mapping(4); _particles.push_back(particle); } }