CParticleSamplerText

From PopcornFX
Jump to: navigation, search

Particle sampler text - Main page : Particle samplers Particle samplers


Available since v1.7.0
The text sampler allows you to sample a text file or text string set in the sampler itself, and get the ASCII code of each character. Useful to use as a TextureID and index a texture atlas to display text particles.


NOTE: a future iteration of the text sampler might allow to actually sample random positions on a text as if it was a 3D mesh sampler.


Sampler Text Viewport.png


Particle sampler text Node properties

Field name Default value Description
Particle sampler text General
SamplerName Auto-generated name Name of the sampler, published to the rest of the effect
SamplerDescription Empty Sampler Description (optional)
UserData Empty Use this if you need to pass custom data to your game engine's integration (custom PopcornFX SDK). If you're Using UE4 or Unity, you can ignore this.
DataSource Inline Specifies where the sampler fetches the text data
  • Inline : text is specified directly in the sampler properties
  • External : sampler will load an external text file
InlineText Text to be sampled
ExternalResource Path to the text file containing the text to be sampled
Text sampler properties


Particle sampler text Script bindings

for each sampler, the following functions are published to scripts:

int	charCode(int charId);
int	charCode(int2 lineAndCharId);
int	charCount();
int	charCount(int lineId);
int	lineCount();

charCode

int charCode(int charId);

'charId' is the index of the character to sample.
The function will return the ASCII code of the character. Pass 0 to get the first character, 14 to get the 15th character, etc...


int charCode(int2 lineAndCharId);

'lineAndCharId' is an int2, containing in its 'x' component, the index of the line to sample, and in its 'y' component, the index of the character to sample inside that line.
The function will return the ASCII code of the character. Pass int2(0,0) to get the first character of the first line, int2(3,14) to get the 15th character of the 4th line, etc...


charCount

int charCount();

returns the total number of characters in the full text (includes special characters like line-separators)


int charCount(int lineId);

returns the total number of characters of the line at index 'lineId'. (does not count line-separators)


lineCount

int lineCount();

returns the total number of lines in the full text.