XML Project File - tiagodinis/GParticles GitHub Wiki

To use GParticles, you need to provide an xml file that holds the configurations of the desired effects. The xml file must have the following tag structure:

Tags

The outer tag of the xml file. Works only as a first handle for the GParticles Loader.

Child tags: resources, psystem

The outer tag of the resources to load.

attribute type description
prefab string the prefab attribute

Child tags: private, global

Tag that holds every private resource. To learn more about the difference between private and global resources check this.

Child tags: buffer, atomic, uniform

Tag that holds every global resource. To learn more about the difference between private and global resources check this.

Child tags: buffer, atomic, uniform

Tag that holds the definition of a buffer to load. A buffer is a 1 dimensional container of a given number of elements and type.

attribute type description
name string the string that identifies the buffer
type string buffer element type (float, vec2 or vec4 )
elements uint number of elements of the indicated type

Example: <buffer name="lifetimes" elements=512 type="float"/>

Tag that holds the definition of an atomic to load. Atomics are unsigned int hardware counters that can only be incremented, decremented and have its value read. They can also be set in CPU with a given value;

attribute type description
name string the string that identifies the atomic
value uint atomic initial value

Example: <atomic name="aliveParticles" value=0 />

Tag that holds the definition of an unifom to load. Uniforms work as global variables on the programs that process particle data, and do not change during the execution of one of such programs.

attribute type description
name string the string that identifies the uniform
type string uniform type (float, vec2 or vec4 )
value float uniform float value
x float vector uniform x value
y float vector uniform y value
z float vector uniform z value
w float vector uniform w value

Example 1: <uniform name="maxParticles" type="float" value=10 />

Example 2: <uniform name="ligthDirection" type="vec4" x=0.3 y=0.1 z=0.3 w=0/>

Tag that holds all the relevant information of a single particle system.

attribute type description
name string the string that identifies the particle system
prefab string the prefab attribute

Child tags: properties, events

Tag that holds all the psystem properties. A property is a general piece of information relative to the particle system as a whole.

attribute type description
prefab string the prefab attribute

Child tags: position, rotation, scale, lifetime, numWorkGroups

Tag that contains the world space position of the corresponding particle system.

attribute type description
x float particle system's x coordinate
y float particle system's y coordinate
z float particle system's z coordinate

Tag that contains the rotation of the corresponding particle system. The rotation is indicated in degrees about a selected arbitrary axis.

attribute type description
x float axis x component
y float axis y component
z float axis z component
angle float rotation angle in degrees

Tag that contains the scale of the corresponding particle system.

attribute type description
x float x axis scale
y float y axis scale
z float z axis scale

Tag that contains the lifetime of the corresponding particle system.

Default behaviour is

attribute type description
x float x axis scale

Example:

<project>
  <resources>
    ...
  </resources>

  <psystem>
    ...
  </psystem>
</project>

END WITH A TABLE WITH ALL THE RELEVANT INFORMATION


To load the project, create a GPManager object and fill it with the parsed data from the GPLoader, like so:

GPManager gpManager;
GPLoader::loadProject(<xmlFilePath>, gpManager);

To update and render the indicated particle systems, call gpManager's processParticles method on your main application loop, passing in the required parameters:

while(!exit()) {
    ...
    gpManager.processParticles(c.getViewMatrix());
    ...
}
⚠️ **GitHub.com Fallback** ⚠️