Previous:Float Operators Main Index Next:Boolean Keywords

#### Built-in Float Identifiers

There are several built-in float identifiers. You can use them to specify values or to create expressions but you cannot re-declare them to change their values. They are:

FLOAT_BUILT-IN_IDENT:

`
  clock
` | `pi` | `version` | `true` | `yes` | `on` | `false` | `no` | `
  off
` | `clock_delta`

Most built-in identifiers never change value. They are defined as though the following lines were at the start of every scene.

     #declare pi = 3.1415926535897932384626;

     #declare true = 1;

     #declare yes = 1;

     #declare on = 1;

     #declare false = 0;

     #declare no = 0;

     #declare off = 0;

The built-in float identifier `pi` is obviously useful in math expressions involving circles. The built-in float identifiers `on`, `off`, `yes`, `no`, `true`, and `false` are designed for use as boolean constants.

The built-in float identifier `clock` is used to control animations in POV-Ray. Unlike some animation packages, the action in POV-Ray animated scenes does not depend upon the integer frame numbers. Rather you should design your scenes based upon the float identifier `clock`. For non-animated scenes its default value is 0 but you can set it to any float value using the INI file option `Clock=`n.n or the command-line switch `+K` n.n to pass a single float value your scene file.

Other INI options and switches may be used to animate scenes by automatically looping through the rendering of frames using various values for `clock`. By default, the clock value is 0 for the initial frame and 1 for the final frame. All other frames are interpolated between these values. For example if your object is supposed to rotate one full turn over the course of the animation you could specify `rotate 360*clock*y`. Then as clock runs from 0 to 1, the object rotates about the y-axis from 0 to 360 degrees.

Although the value of `clock` will change from frame-to-frame, it will never change throughout the parsing of a scene.

The built-in float identifier `clock_delta` returns the amount of time between clock values in animations in POV-Ray. While most animations only need the clock value itself, some animation calculations are easier if you know how long since the last frame. Caution must be used when designing such scenes. If you render a scene with too few frames, the results may be different than if you render with more frames in a given time period. On non-animated scenes, `clock_delta` defaults to 1.0. See section "Animation Options" for more details.

The built-in float identifier `version` contains the current setting of the version compatibility option. Although this value defaults to 3.1 which is the current POV-Ray version number, the initial value of `version` may be set by the INI file option `Version=`n.n or by the `+MV` n.n command-line switch. This tells POV-Ray to parse the scene file using syntax from an earlier version of POV-Ray.

The INI option or switch only affects the initial setting. Unlike other built-in identifiers, you may change the value of `version` throughout a scene file. You do not use `#declare` to change it though. The `#version` language directive is used to change modes. Such changes may occur several times within scene files.

Together with the built-in `version` identifier the `#version` directive allows you to save and restore the previous values of this compatibility setting. The new `#local` identifier option is especially useful here. For example suppose `mystuff.inc` is in version 1 format. At the top of the file you could put:

     #local Temp_Vers = version;  // Save previous value

     #version 1.0;         // Change to 1.0 mode

     ... // Version 1.0 stuff goes here...

     #version Temp_Vers;      // Restore previous version

Note that there should be a semi-colon after the float expression in a `#version` directive. This semi-colon is new with POV-Ray version 3.1. If omitted, it generates a warning and some macros may not work properly.

Previous:Float Operators Main Index Next:Boolean Keywords