Inline Code VEX node

Write VEX code that is put directly into your shader or operator definition.

All Parameters Inputs

See also: Print, Subnet, Subnet Input, Subnet Output

This operator lets you write VEX code that is put directly into your shader or operator definition.

Up to 64 inputs can be connected to this operator, and they can be of any data type. You can also use the parameters of this operator to define up to 32 outputs that can also be of any data type, and be given any name.

When writing your inline VEX code, you do not need to write variable declarations for any of the inputs or outputs to the operator. Any extra variables that you do declare should be prefixed with a “$”. This tells the VOPNET code generator that it is a variable name, and should be made unique. Similarly, when referring to input or output variables, their names should be prefixed with a “$”, or the code generator will not use the correct variable names. Do not use the “$” prefix for global variable names.

Although it is possible to assign values to input variables, it is strongly discouraged. There is no guarantee made about the order in which VOPs will generate their code, so assigning values to input variables may give unpredictable results.

You should use this operator only if you are familiar with VEX programming. It is very easy to introduce errors into your code using this operator. If there are errors in your code, you will be able to see what they are by middle-clicking on the icon of any VOP in the network.

As an example, the following inline code will output the length of the hypotenuse of a right angle triangle. Notice the semi-colon at the end of the statement:

$out1 = sqrt($in1 * $in1 + $in2 * $in2);

Parameters

Inline VEX Code

This parameter is where you write the VEX code that is to be put in your shader.

Include Files

List any files that need to be included at the start of your shader. You can use this facility to write complex functions, and then call them with a single line of VEX code in the Inline VEX Code parameter. This is simply a list of files, such as “voplib.h shading.h

Input Name/Label

For each input connected to this operator you can specify the name and label for the input. To change the name or label for an input, enter the new string directly in the table presented. If an empty string is specified in the table, the name and label will be copied from the operator connected to each input.

Output N Type, Name, and Label

These parameters specify the name, label, and data type for each output you wish to define.

Inputs

Next Input

Where the next input value should be connected. Up to 64 inputs can be specified.

Usages in other examples

Example name Example for