ParticleAPI 3.0.0 Performant particle system API in C++ for interactive graphics

Public Member Functions | Public Attributes | List of all members
pSourceState Class Reference

These functions set the current state needed by Source() and Vertex() actions. More...

`#include <pSourceState.h>`

## Public Member Functions
| pSourceState ()
pSourceState & | operator= (const pSourceState &src)
void | Color (const pVec &color, const float alpha=1.0f)
| Specify the color of particles to be created. More...
void | Color (const float red, const float green, const float blue, const float alpha=1.0f)
| Specify the color of particles to be created. More...
void | Color (const pDomain &cdom)
| Specify the domain for colors and alpha value of new particles. More...
void | Color (const pDomain &cdom, const pDomain &adom)
| Specify the domain for colors and alpha value of new particles. More...
void | Data (const pdata_t data)
| Specify the user data of particles to be created. More...
void | Size (const pVec &size)
| Specify the size of particles to be created. More...
void | Size (const pDomain &dom)
| Specify the domain for the size of particles to be created. More...
void | Mass (const float mass)
| Specify the mass of particles to be created. More...
void | RotVelocity (const pVec &v)
| Specify the initial rotational velocity vector of particles to be created. More...
void | RotVelocity (const pDomain &dom)
| Specify the domain for the initial rotational velocity vector of particles to be created. More...
void | StartingAge (const float age, const float sigma=0.0f)
| Specify the initial age of particles to be created. More...
void | UpVec (const pVec &up)
| Specify the initial up vector of particles to be created. More...
void | UpVec (const pDomain &dom)
| Specify the domain for the initial up vector of particles to be created. More...
void | Velocity (const pVec &vel)
| Specify the initial velocity vector of particles to be created. More...
void | Velocity (const pDomain &dom)
| Specify the domain for the initial velocity vector of particles to be created. More...
void | VertexB (const pVec &v)
| Specify the initial secondary position of new particles. More...
void | VertexB (const pDomain &dom)
| Specify the domain for the initial secondary position of new particles. More...
void | VertexBTracks (const bool track_vertex=true)
| Specify that the initial secondary position of new particles be the same as their position. More...
void | Reset ()
| Reset all particle creation state to default values. More...

## Public Attributes
std::shared_ptr< pDomain > | Up_
std::shared_ptr< pDomain > | Vel_
std::shared_ptr< pDomain > | RotVel_
std::shared_ptr< pDomain > | VertexB_
std::shared_ptr< pDomain > | Size_
std::shared_ptr< pDomain > | Color_
std::shared_ptr< pDomain > | Alpha_
pdata_t | Data_
float | Age_
float | AgeSigma_
float | Mass_
bool | vertexB_tracks_

## Detailed Description

These functions set the current state needed by Source() and Vertex() actions.

These calls dictate the properties of particles to be created by Source() or Vertex(). When particles are created within a NewActionList() / EndActionList() block, they will receive attributes from the state that was current when the action list was created (unlike OpenGL). When in immediate mode (not creating or calling an action list), particles are created with attributes from the current state.

## Constructor & Destructor Documentation

## ◆ pSourceState()

pSourceState | ( |  | ) |
| inline

## Member Function Documentation

## ◆ Color() [1/4]

void Color | ( | const float | red,
|  | const float | green,
|  | const float | blue,
|  | const float | alpha = `1.0f`
| ) |  |
| inline

Specify the color of particles to be created.

This call is short-hand for Color(PDPoint(color), PDPoint(pVec(alpha)).

The default color is 1,1,1,1 (opaque white if you interpret it as RGBA).

## ◆ Color() [2/4]

void Color | ( | const pDomain & | cdom | ) |
| inline

Specify the domain for colors and alpha value of new particles.

Your application can interpret the color triple in any color space you choose. RGB is the most common, with colors ranging on 0.0 -> 1.0. For example, the PDLine(pVec(1, 0, 0), pVec(1, 1, 0)) will choose points on a line between red and yellow. Points outside the 0.0 -> 1.0 range will not be clamped by the Particle System API. Some renderers may use colors on the range 0 -> 255, so the domain used to choose the colors can be on that range. The alpha value is usually used for transparency.

The particle color does not necessarily need to be used to represent color. It can be interpreted as an arbitrary three-vector.

The default color is 1,1,1,1 (opaque white).

Parameters

  cdom | The color domain.

## ◆ Color() [3/4]

void Color | ( | const pDomain & | cdom,
|  | const pDomain & | adom
| ) |  |
| inline

Specify the domain for colors and alpha value of new particles.

Your application can interpret the color triple in any color space you choose. RGB is the most common, with colors ranging on 0.0 -> 1.0. For example, the PDLine(pVec(1, 0, 0), pVec(1, 1, 0)) will choose points on a line between red and yellow. Points outside the 0.0 -> 1.0 range will not be clamped by the Particle System API. Some renderers may use colors on the range 0 -> 255, so the domain used to choose the colors can be on that range. The alpha value is usually used for transparency.

The particle color does not necessarily need to be used to represent color. It can be interpreted as an arbitrary three-vector.

The default color is 1,1,1,1 (opaque white).

Parameters

  cdom | The color domain.
  adom | The X dimension of the alpha domain is used for alpha.

## ◆ Color() [4/4]

void Color | ( | const pVec & | color,
|  | const float | alpha = `1.0f`
| ) |  |
| inline

Specify the color of particles to be created.

This call is short-hand for Color(PDPoint(color), PDPoint(pVec(alpha)).

The default color is 1,1,1,1 (opaque white if you interpret it as RGBA).

## ◆ Data()

void Data | ( | const pdata_t | data | ) |
| inline

Specify the user data of particles to be created.

All new particles will have the given user data value. This value could be cast from a pointer or could be any other useful value.

The default user data is 0.

## ◆ Mass()

void Mass | ( | const float | mass | ) |
| inline

Specify the mass of particles to be created.

The mass is used in the particle dynamics math, such as F=m*a. It doesn't affect size for bouncing, etc.

The default mass is 1.

## ◆ operator=()

pSourceState & operator= | ( | const pSourceState & | src | ) |
| inline

## ◆ Reset()

void Reset | ( |  | ) |
| inline

Reset all particle creation state to default values.

All state set by the pSourceState functions will be reset.

## ◆ RotVelocity() [1/2]

void RotVelocity | ( | const pDomain & | dom | ) |
| inline

Specify the domain for the initial rotational velocity vector of particles to be created.

For particles that will be rendered with complex shapes, like boulders, a rotation frame may be defined. The frame consists of the velocity vector, the Up vector, and the cross product of those, which you compute yourself.

The default rotational velocity is 0,0,0.

## ◆ RotVelocity() [2/2]

void RotVelocity | ( | const pVec & | v | ) |
| inline

Specify the initial rotational velocity vector of particles to be created.

## ◆ Size() [1/2]

void Size | ( | const pDomain & | dom | ) |
| inline

Specify the domain for the size of particles to be created.

All new particles will have a size chosen randomly from within the specified domain. The size values may be negative.

The size is not mass. It does not affect any particle dynamics, including acceleration and bouncing. It is merely a triple of rendering attributes, like color, and can be interpreted at the whim of the application programmer (that's you). In particular, the three components do not need to be used together as three dimensions of the particle's size. For example, one could be interpreted as radius, another as length, and another as density.

The default size is 1,1,1.

## ◆ Size() [2/2]

void Size | ( | const pVec & | size | ) |
| inline

Specify the size of particles to be created.

This call is short-hand for Size(PDPoint(size)).

The default size is 1,1,1.

## ◆ StartingAge()

void StartingAge | ( | const float | age,
|  | const float | sigma = `0.0f`
| ) |  |
| inline

Specify the initial age of particles to be created.

The age parameter can be positive, zero, or negative. Giving particles different starting ages allows KillOld() to distinguish between which to kill in interesting ways. Setting sigma to a non-zero value will give the particles an initial age with a normal distribution with mean age and standard deviation sigma. When many particles are created at once this allows a few particles to die at each time step, yielding a more natural effect.

The default age is 0 and its sigma is 0.

Parameters

  age | mean starting age of particles
  sigma | standard deviation of particle starting age

## ◆ UpVec() [1/2]

void UpVec | ( | const pDomain & | dom | ) |
| inline

Specify the domain for the initial up vector of particles to be created.

For particles that will be rendered with complex shapes, like boulders, a rotation frame may be defined. The frame consists of the velocity vector, the Up vector, and the cross product of those, which you compute yourself.

The default Up vector is 0,1,0.

## ◆ UpVec() [2/2]

void UpVec | ( | const pVec & | up | ) |
| inline

Specify the initial up vector of particles to be created.

This call is short-hand for UpVec(PDPoint(v)).

The default Up vector is 0,1,0.

## ◆ Velocity() [1/2]

void Velocity | ( | const pDomain & | dom | ) |
| inline

Specify the domain for the initial velocity vector of particles to be created.

The default Velocity vector is 0,0,0.

## ◆ Velocity() [2/2]

void Velocity | ( | const pVec & | vel | ) |
| inline

Specify the initial velocity vector of particles to be created.

This call is short-hand for Velocity(PDPoint(vel)).

The default Velocity vector is 0,0,0.

## ◆ VertexB() [1/2]

void VertexB | ( | const pDomain & | dom | ) |
| inline

Specify the domain for the initial secondary position of new particles.

The PositionB attribute is used to store a destination position for the particle. This is designed for actions such as Restore().

The default PositionB is 0,0,0.

## ◆ VertexB() [2/2]

void VertexB | ( | const pVec & | v | ) |
| inline

Specify the initial secondary position of new particles.

The PositionB attribute is used to store a destination position for the particle. This is designed for actions such as Restore().

The default PositionB is 0,0,0.

## ◆ VertexBTracks()

void VertexBTracks | ( | const bool | track_vertex = `true` | ) |
| inline

Specify that the initial secondary position of new particles be the same as their position.

If true, the PositionB attribute of new particles comes from their position, rather than from the VertexB domain.

The default value of VertexBTracks is true.

## Member Data Documentation

## ◆ Age_

float Age_

## ◆ AgeSigma_

float AgeSigma_

## ◆ Alpha_

std::shared_ptr<pDomain> Alpha_

## ◆ Color_

std::shared_ptr<pDomain> Color_

## ◆ Data_

pdata_t Data_

## ◆ Mass_

float Mass_

## ◆ RotVel_

std::shared_ptr<pDomain> RotVel_

## ◆ Size_

std::shared_ptr<pDomain> Size_

## ◆ Up_

std::shared_ptr<pDomain> Up_

## ◆ Vel_

std::shared_ptr<pDomain> Vel_

## ◆ VertexB_

std::shared_ptr<pDomain> VertexB_

## ◆ vertexB_tracks_

bool vertexB_tracks_

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

- pSourceState.h