Download ParCompMark User Manual

Transcript
3.5. WRITING DYNAMIC SCRIPTS
64
name = "Node #" + nodeCount++
buffers =[ buffer ]
processes =[ process ]
});
} // end of foreach
// Now, create a process for displaying the output
{
// Compositing host by default is the first host
local host = lowLevelScript.hosts[0];
if(DYNAMICSCRIPTPARAMETERS .rawin("displayHost")) {
host = findItemByName(lowLevelScript.hosts, DYNAMICSCRIPTPARAMETERS .
displayHost);
if(host == null) throw "Host \’" + name + "\’ not found."
}
// Create a buffer for the compositing
local buffer = {
name = "Buffer #" + bufferCount++
left = 0
top = 0
width = context.frameWidth // Use the sizes of the context
height = context.frameHeight
depth = PC_PF_Z32I
}
// Create process
local process = {
// Use the name of the low-level script
// This will be shown in the title bar
name = lowLevelScript.name
type = Process.COMPOSITE
buffer = buffer.name
display = true
// (No initialization or running procedure is needed)
// Set stop frame ID
stopID = DYNAMICSCRIPTPARAMETERS .frameCount
}
// Append this process to the context
context.processes.append(process.name);
// Create a node on the host
host.nodes.append({
name = "Node #" + nodeCount++
buffers =[ buffer ]
processes =[ process ]
});
}
// Return low-level script as a string
return objectToString(lowLevelScript);
}
Listing 3.9: Script example: Basic functionality
For comparison, the previous dynamic script generates the following low-