Nebula
Loading...
Searching...
No Matches
Particles::EnvelopeCurve Class Reference

#include <envelopecurve.h>

Detailed Description

An Attack/Sustain/Release envelope curve class with optional sine/cosine modulation.

Used for animated particle emitter attributes.

Public Types

enum  ModFunc { Sine = 0 , Cosine }
 modulation enumerator More...
 

Public Member Functions

 EnvelopeCurve ()
 default constructor
 
void Setup (float val0, float val1, float val2, float val3, float keyPos0, float keyPos1, float freq, float amp, ModFunc mod)
 set parameters
 
float Sample (float t) const
 sample at specific time (0..1)
 
void PreSample (float *sampleBuffer, SizeT numSamples, SizeT sampleStride) const
 sample from t=0 to t=1 into array of values
 
float GetMaxValue () const
 get the max of val0, val1, val2, val3
 
float GetMinValue () const
 get the min of val0, v1l, val2, val3
 
const float * GetValues () const
 get values
 
void SetValues (float v0, float v1, float v2, float v3)
 set values
 
const float * GetLimits () const
 get limits in y
 
void SetLimits (float min, float max)
 set limits in y
 
const float GetKeyPos0 () const
 get keypos0
 
void SetKeyPos0 (float f)
 set keypos0
 
const float GetKeyPos1 () const
 get keypos1
 
void SetKeyPos1 (float f)
 set keypos1
 
const float GetFrequency () const
 get frequency
 
void SetFrequency (float f)
 set frequency
 
const float GetAmplitude () const
 get amplitude
 
void SetAmplitude (float f)
 set amplitude
 
const int GetModFunc () const
 get modFunction
 
void SetModFunc (int func)
 set mod function
 

Private Attributes

float values [4]
 
float limits [2]
 
float keyPos0
 
float keyPos1
 
float frequency
 
float amplitude
 
ModFunc modFunction: 1
 

Member Enumeration Documentation

◆ ModFunc

modulation enumerator

Enumerator
Sine 
Cosine 

Constructor & Destructor Documentation

◆ EnvelopeCurve()

Particles::EnvelopeCurve::EnvelopeCurve ( )

default constructor

Member Function Documentation

◆ GetAmplitude()

const float Particles::EnvelopeCurve::GetAmplitude ( ) const
inline

get amplitude

◆ GetFrequency()

const float Particles::EnvelopeCurve::GetFrequency ( ) const
inline

get frequency

◆ GetKeyPos0()

const float Particles::EnvelopeCurve::GetKeyPos0 ( ) const
inline

get keypos0

◆ GetKeyPos1()

const float Particles::EnvelopeCurve::GetKeyPos1 ( ) const
inline

get keypos1

◆ GetLimits()

const float * Particles::EnvelopeCurve::GetLimits ( ) const
inline

get limits in y

◆ GetMaxValue()

float Particles::EnvelopeCurve::GetMaxValue ( ) const

get the max of val0, val1, val2, val3

◆ GetMinValue()

float Particles::EnvelopeCurve::GetMinValue ( ) const

get the min of val0, v1l, val2, val3

◆ GetModFunc()

const int Particles::EnvelopeCurve::GetModFunc ( ) const
inline

get modFunction

◆ GetValues()

const float * Particles::EnvelopeCurve::GetValues ( ) const
inline

get values

◆ PreSample()

void Particles::EnvelopeCurve::PreSample ( float * sampleBuffer,
SizeT numSamples,
SizeT sampleStride ) const

sample from t=0 to t=1 into array of values

This samples N values from t=0 to t=1 into an array.

The array can then be used as a lookup table.

◆ Sample()

float Particles::EnvelopeCurve::Sample ( float t) const

sample at specific time (0..1)

NOTE: Sampling a single value is relatively expensive.

Consider pre-sampling into a lookup table!

◆ SetAmplitude()

void Particles::EnvelopeCurve::SetAmplitude ( float f)
inline

set amplitude

◆ SetFrequency()

void Particles::EnvelopeCurve::SetFrequency ( float f)
inline

set frequency

◆ SetKeyPos0()

void Particles::EnvelopeCurve::SetKeyPos0 ( float f)
inline

set keypos0

◆ SetKeyPos1()

void Particles::EnvelopeCurve::SetKeyPos1 ( float f)
inline

set keypos1

◆ SetLimits()

void Particles::EnvelopeCurve::SetLimits ( float min,
float max )
inline

set limits in y

◆ SetModFunc()

void Particles::EnvelopeCurve::SetModFunc ( int func)
inline

set mod function

◆ Setup()

void Particles::EnvelopeCurve::Setup ( float val0,
float val1,
float val2,
float val3,
float keyPos0,
float keyPos1,
float freq,
float amp,
ModFunc mod )

set parameters

◆ SetValues()

void Particles::EnvelopeCurve::SetValues ( float v0,
float v1,
float v2,
float v3 )
inline

set values

Member Data Documentation

◆ amplitude

float Particles::EnvelopeCurve::amplitude
private

◆ frequency

float Particles::EnvelopeCurve::frequency
private

◆ keyPos0

float Particles::EnvelopeCurve::keyPos0
private

◆ keyPos1

float Particles::EnvelopeCurve::keyPos1
private

◆ limits

float Particles::EnvelopeCurve::limits[2]
private

◆ modFunction

ModFunc Particles::EnvelopeCurve::modFunction
private

◆ values

float Particles::EnvelopeCurve::values[4]
private

The documentation for this class was generated from the following files: