point expression function

Returns the value of a point attribute.

All Usage Examples

See also: pointavg, vertex

Usage

point(surface_node, point_number, attribute, index)

surface_node is a path to a surface node, for example "/obj/geo1/grid1". point_number is the point number to read the attribute from.

attribute is the name of the attribute (for example, Cd for diffuse color). Two special attributes exist: P and Pw which represent the position of the point in space (Pw allows you to access the W component of the position).

index is the component number (0, 0 to 3, or 0-4, depending on the datatype of the attribute) to read if the attribute is a vector or vector4. For floats, the index argument is ignored (just use 0). For example, for a color value, 0 means red, 1 means green, and 2 means blue. To read the all three (red, green, and blue) components, you would need to call the function three times with 0, 1, and 2 as the values for index.

Note

This function will interpolate between point values if the point number is fractional, such as 3.35

Examples

point("/obj/geo1/facet1", 3, "P", 0)

Returns the X component of point 3 of the facet1 surface node in geo1.

point("/obj/geo1/facet1", 3, "N", 2)

Returns the Z component of the normal attribute of point 3 in the facet1 surface node of object geo1.