The prefab attribute - tiagodinis/GParticles GitHub Wiki
NOTE: This functionality is not fully implemented in every tag indicated on this page
Some tags have an optional prefab attribute. This attribute references another xml file with previously defined configurations for that tag. This promotes the reuse and readability of configurations throughout projects.
In case we want to use a prefab configuration with some more elements, we can expand the prefab attribute tag and add the desired information. In some cases, if the new element has the same identifier used on the prefab, the child tags in the main project file have precedence and override the corresponding tags in the prefab file.
The following tags can use the prefab attribute: resources, psystem, events, emission, update, collision, render.
Example 1: Using the prefab attribute on the emission event
>> myProject.xml
<emission prefab="prefabs/emission/simpleEmissionPrefab.xml" />
-----------------------------------------------------------------------------------
>> simpleEmissionPrefab.xml
<emission iterationStep=100>
<override type="atomic" name="emissionAttempts" value=0/>
<file path="modules/utilities.glsl" />
<file path="modules/emission.glsl" />
<file path="prefabs/emission/simpleEmission.comp" />
<file path="templates/emissionMain.glsl" />
</emission>Example 2: Overriding the maxParticles uniform and adding a new iteration atomic counter
>> myProject.xml
<resources prefab="prefabs/resources/defaultResources.xml">
<private>
<uniform name="maxParticles" type="float" value=200 />
</private>
<global>
<atomic name="iterationCounter" />
</global>
</resources>
-----------------------------------------------------------------------------------
>> defaultResources.xml
<resources>
<private>
...
<uniform name="maxParticles" type="float" value=10 />
...
</private>
<global>
<atomic name="randomCounter" />
</global>
</resources>