Axmol Engine 2.4.0-258ceca
Loading...
Searching...
No Matches
ParticleEmissionMaskCache Class Reference

Particle emission mask cache. More...

#include <ParticleSystem.h>

Public Member Functions

void bakeEmissionMask (std::string_view maskId, std::string_view texturePath, float alphaThreshold=0.5F, bool inverted=false, int inbetweenSamples=1)
 Bakes a particle emission mask from texture data on cpu and stores it in memory by it's name.
 
void bakeEmissionMask (std::string_view maskId, Image *imageTexture, float alphaThreshold=0.5F, bool inverted=false, int inbetweenSamples=1)
 Bakes a particle emission mask from texture data on cpu and stores it in memory by it's name.
 
const ParticleEmissionMaskDescriptorgetEmissionMask (uint32_t fourccId)
 Returns a baked mask with the specified name if it exists.
 
const ParticleEmissionMaskDescriptorgetEmissionMask (std::string_view maskId)
 Returns a baked mask with the specified name if it exists.
 
void removeMask (std::string_view maskId)
 Removes a baked mask and releases the data from memory with the specified name if it exists.
 
void removeAllMasks ()
 Remove all baked masks and releases their data from memory.
 

Detailed Description

Particle emission mask cache.

Since
axmol-1.0.0b8

Member Function Documentation

◆ bakeEmissionMask() [1/2]

void bakeEmissionMask ( std::string_view maskId,
std::string_view texturePath,
float alphaThreshold = 0.5F,
bool inverted = false,
int inbetweenSamples = 1 )

Bakes a particle emission mask from texture data on cpu and stores it in memory by it's name.

If the mask already exists then it will be overwritten.

Parameters
maskIdThe id of the mask, FOURCC starts with '#', such as "#abcd"
texturePathPath of the texture that holds alpha data.
alphaThresholdThe threshold at which pixels are picked, If a pixel's alpha channel is greater than alphaThreshold then it will be picked.
invertedInverts the pick condition so that If a pixel's alpha channel is lower than alphaThreshold then it will be picked.
inbetweenSamplesHow many times should pixels be filled inbetween, this value should be increased If you're planning to scale the emission shape up. WARNING: it will use more memory.

◆ bakeEmissionMask() [2/2]

void bakeEmissionMask ( std::string_view maskId,
Image * imageTexture,
float alphaThreshold = 0.5F,
bool inverted = false,
int inbetweenSamples = 1 )

Bakes a particle emission mask from texture data on cpu and stores it in memory by it's name.

If the mask already exists then it will be overwritten.

Parameters
maskIdThe id of the mask, FOURCC starts with '#', such as "#abcd"
imageTextureImage object containing texture data with alpha channel.
alphaThresholdThe threshold at which pixels are picked, If a pixel's alpha channel is greater than alphaThreshold then it will be picked.
invertedInverts the pick condition so that If a pixel's alpha channel is lower than alphaThreshold then it will be picked.
inbetweenSamplesHow many times should pixels be filled inbetween, this value should be increased If you're planning to scale the emission shape up. WARNING: it will use more memory.

◆ getEmissionMask() [1/2]

const ParticleEmissionMaskDescriptor & getEmissionMask ( uint32_t fourccId)

Returns a baked mask with the specified name if it exists.

otherwise, it will return a dummy mask.

Parameters
fourccIdThe unsigned integer id of the mask.

◆ getEmissionMask() [2/2]

const ParticleEmissionMaskDescriptor & getEmissionMask ( std::string_view maskId)

Returns a baked mask with the specified name if it exists.

otherwise, it will return a dummy mask.

Parameters
maskIdThe id of the mask, FOURCC starts with '#', such as "#abcd"

◆ removeMask()

void removeMask ( std::string_view maskId)

Removes a baked mask and releases the data from memory with the specified name if it exists.

Parameters
maskIdThe id of the mask, FOURCC starts with '#', such as "#abcd"

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