pipeline
Tag: pipeline
Parent tag: pipelines
Attributes:
name
(string): the name of the pipelinedefaultCamera
(string): the name of a previously defined camera. The specified camera will be the active camera. this is only useful for interface purposes. For instance, when programming with Nau this is the camera that will be returned when asked for the active camera. In Composer and GLUT demos the active camera is the one which can be controlled with the keyboard and mouse.frameCount
(uint): if defined the pipeline rans only for the given number of frames. This feature will only have an effect if the pipelinesmode
is set toRUN_ALL
.
Child tags:
preScript
testScript
pass+
postScript
This tag allows the definition of a rendering pipelines as a sequence of passes.
Scripts are Lua functions. Both the file and script names must be defined, see the examples below.
When preScript
or postScript
are defined they will be executed before entering and after leaving the pipeline, respectively. Note that preScript
and postScript
will only run once regardless of the number of frames the pipeline runs.
The postScript
will only run if the pipeline is changed as a result of testScript
returning false or when the frame counter reaches frameCount
. The frame counter will be reset when the active pipeline changes.
The testScript
must return a boolean indicating if the pipeline should be executed. If the parent tag pipelines
defines mode
as RUN_ALL
, and this test fails the next pipeline will become the active pipeline for the next frame..
In this example the pipeline will be executed until the application terminates (or the application changes the active pipeline). The preScript
will be executed once at the startup, allowing to perform some initializations. Note that in this case it does not make sense to have a postScript
as it will never be executed.
Example:
<pipeline name="ambient occlusion" defaultCamera="Cam1"> <preScript script="script1" file="test.lua" /> <pass name="P1"> ... </pass> <pass name="P2"> ... </pass> ... </pipeline>
This next example has three pipelines. The first will be executed 5 times. Its preScript
will be executed only once, when the pipeline is started. After 5 frames the second pipeline becomes the active pipeline.
The second pipeline pipeline will first run the preScript
. Then it will run while its testScript
returns true. Once it returns false the postScript
will be executed and we move on to the third pipeline.
This last pipeline will be executed until the frame counter reaches 3 or its testScript
returns false, whatever happens first. The postScript
will be run when any of these conditions is true. Afterwards the application terminates since there are no more pipelines.
<pipelines mode="RUN_ALL"> <pipeline name="Pip I" frameCount = 5> <preScript file="test.lua" script="startingPipI" /> <pass class="default" name="Pass I"> ... </pass> <pass class="default" name="Pass I"> ... </pass> </pipeline> <pipeline name="no script" defaultCamera="Master" > <testScript file="test.lua" script="testPipII" /> <pass class="default" name="Pass I"> </pass> <postScript file="test.lua" script="endPipII" /> </pipeline> <pipeline name="Pip III" defaultCamera="Master" frameCount = 3> <testScript file="test.lua" script="testPipIII" /> <pass class="default" name="Pass I"> </pass> <postScript file="test.lua" script="endPipIII" /> </pipeline> </pipelines>