Confetti  0.1.0
A C++ particle system using Vulkan
Public Member Functions | List of all members
Confetti::EmitterSphere Class Reference

An EmitterVolume that emits particles from the interior of a sphere. More...

#include <Confetti/EmitterVolume.h>

Inheritance diagram for Confetti::EmitterSphere:
Inheritance graph
[legend]

Public Member Functions

 EmitterSphere (float radius)
 Constructor. More...
 
virtual ~EmitterSphere () override=default
 Destructor.
 
Overrides EmitterVolume
glm::vec3 operator() (std::minstd_rand &rng) const override
 Returns a value used to specify a particle's point of emission. More...
 
- Public Member Functions inherited from Confetti::EmitterVolume
virtual ~EmitterVolume ()=default
 Destructor.
 

Detailed Description

An EmitterVolume that emits particles from the interior of a sphere.

The points are distributed uniformly in the volume using this function:

    Given the radius r and the random values t:[0,1), u:[0,1), and v:[0,1),
    
        x = t * r * sin( u * PI ) * cos( v * TWO_PI )
        y = t * r * sin( u * PI ) * sin( v * TWO_PI )
        z = t * r * cos( u * PI )
    

Constructor & Destructor Documentation

◆ EmitterSphere()

Confetti::EmitterSphere::EmitterSphere ( float  radius)

Constructor.

Parameters
rngRandom number generator.
radiusradius of the sphere.

Member Function Documentation

◆ operator()()

glm::vec3 Confetti::EmitterSphere::operator() ( std::minstd_rand &  rng) const
overridevirtual

Returns a value used to specify a particle's point of emission.

Parameters
rngRandom number generator.
Note
This method must be overridden.

Implements Confetti::EmitterVolume.