Initialize particles based on mode.
548{
549 switch (mode) {
553 }
554 break;
555
559 }
560 break;
561
563 auto grid_size =
static_cast<size_t>(std::cbrt(
m_particles.size()));
565
566 size_t idx = 0;
567 for (
size_t x = 0; x < grid_size && idx <
m_particles.size(); ++x) {
568 for (
size_t y = 0; y < grid_size && idx <
m_particles.size(); ++y) {
569 for (
size_t z = 0; z < grid_size && idx <
m_particles.size(); ++z) {
570 glm::vec3 pos =
m_bounds_min + glm::vec3(x, y, z) * spacing;
572 }
573 }
574 }
575 break;
576 }
577
583 }
584 break;
585 }
586
592 }
593 break;
594 }
595
597 break;
598 }
599
601}
@ RANDOM_SURFACE
Random positions on bounds surface.
@ CUSTOM
User-provided initialization function.
@ RANDOM_VOLUME
Random positions in bounds volume.
@ GRID
Regular grid distribution.
@ SPHERE_VOLUME
Random in sphere.
@ SPHERE_SURFACE
Random on sphere surface.
glm::vec3 random_position_surface() const
Random position on bounds surface.
std::vector< ParticleNode > m_particles
glm::vec3 random_position_sphere(float radius) const
Random position in sphere.
glm::vec3 random_position_volume() const
Random position in bounds volume.
glm::vec3 random_position_sphere_surface(float radius) const
Random position on sphere surface.
void update_point_nodes()
Update PointNode states from physics.