3.8.4 Language Directives

Control the parsing of sections of the scene file:
LANGUAGE_DIRECTIVE:
INCLUDE_DIRECTIVE | IDENTIFIER_DECLARATION | UNDEF_DIRECTIVE | FOPEN_DIRECTIVE | FCLOSE_DIRECTIVE | READ_DIRECTIVE | WRITE_DIRECTIVE | DEFAULT_DIRECTIVE | VERSION_DIRECTIVE | IF_DIRECTIVE | IFDEF_DIRECTIVE | IFNDEF_DIRECTIVE | SWITCH_DIRECTIVE | WHILE_DIRECTIVE | TEXT_STREAM_DIRECTIVE | MACRO_DEFINITION

Quick Reference Contents

3.8.4.1 File Inclusion

Insert content of another scene file:
INCLUDE_DIRECTIVE:
#include FILE_NAME
File inclusion may be nested at most 10 levels deep.
FILE_NAME:
STRING

Quick Reference Contents

3.8.4.2 Identifier Declaration

Create an identifier for a value, object, etc.
IDENTIFIER_DECLARATION:
#declare IDENTIFIER = RVALUE [;] |
#local IDENTIFIER = RVALUE [;]
Up to 127 characters, starting with a letter, consisting of letters, digits and/or the underscore. The semicolon is required for a FLOAT, VECTOR or COLOR declaration.
RVALUE:
FLOAT | VECTOR | COLOR | USER_FUNCTION | STRING | ARRAY_REFERENCE | SPLINE | TRANSFORM | CAMERA | LIGHT | OBJECT | MATERIAL | INTERIOR | TEXTURE | TEXTURE_MAP | PIGMENT | COLOR_MAP | PIGMENT_MAP | NORMAL | SLOPE_MAP | NORMAL_MAP | FINISH | MEDIA | DENSITY | DENSITY_MAP | FOG | RAINBOW | SKY_SPHERE
Destroy an identifier:
UNDEF_DIRECTIVE:
#undef IDENTIFIER

Quick Reference Contents

3.8.4.3 File Input/Output

Open a text file:
FOPEN_DIRECTIVE:
#fopen FILE_HANDLE_IDENTIFIER FILE_NAME OPEN_TYPE
OPEN_TYPE:
read | write | append
Close a text file:
FCLOSE_DIRECTIVE:
#fclose FILE_HANDLE_IDENTIFIER
Read string, float and/or vector values from a text file:
READ_DIRECTIVE:
#read ( FILE_HANDLE_IDENTIFIER, DATA_IDENTIFIER [, DATA_IDENTIFIER]... )
Use defined(FILE_HANDLE_IDENTIFIER) to detect end-of-file after a read.
DATA_IDENTIFIER:
UNDECLARED_IDENTIFIER | FLOAT_IDENTIFIER | VECTOR_IDENTIFIER | STRING_IDENTIFIER | ARRAY_REFERENCE
May read a value into an array reference if the array element's type has already been established.
Write string, float and/or vector values to a text file:
WRITE_DIRECTIVE:
#write ( FILE_HANDLE_IDENTIFIER, DATA_ITEM [, DATA_ITEM]... )
DATA_ITEM:
FLOAT | VECTOR | STRING

Quick Reference Contents

3.8.4.4 Default Texture

Specify a default texture, pigment, normal or finish:
DEFAULT_DIRECTIVE:
#default { DEFAULT_ITEM }
DEFAULT_ITEM:
PLAIN_TEXTURE | PIGMENT | NORMAL | FINISH

Quick Reference Contents

3.8.4.5 Version Identfier

Specify the POV-Ray compatibility version number:
VERSION_DIRECTIVE:
#version FLOAT;

Quick Reference Contents

3.8.4.6 Control Flow Directives

Conditionally parse a section of the scene file, depending on a boolean expression:
IF_DIRECTIVE:
#if ( BOOL ) TOKENS [#else TOKENS] #end
TOKENS:
Any number of POV-Ray keywords, identifiers, values and/or punctuation.
Conditionally parse a section of the scene file, depending on the existence of an identifier:
IFDEF_DIRECTIVE:
#ifdef ( IDENTIFIER ) TOKENS [#else TOKENS] #end
IFNDEF_DIRECTIVE:
#ifndef ( IDENTIFIER ) TOKENS [#else TOKENS] #end
Conditionally parse a section of the scene file, depending on the value of a float expression:
SWITCH_DIRECTIVE:
#switch ( FLOAT ) SWITCH_CLAUSE... [#else TOKENS] #end
SWITCH_CLAUSE:
#case ( FLOAT ) TOKENS [#break] |
#range ( F_LOW, F_HIGH ) TOKENS [#break]
Repeat a section of the scene file while a boolean condition is true:
WHILE_DIRECTIVE:
#while ( LOGICAL_EXPRESSION ) TOKENS #end

Quick Reference Contents

3.8.4.7 Message Streams

Send a message to a text stream:
TEXT_STREAM_DIRECTIVE:
#debug STRING | #error STRING | #warning STRING

Quick Reference Contents

3.8.4.8 Macro

Define a macro:
MACRO_DEFINITION:
#macro MACRO_IDENTIFIER ( [PARAM_IDENTIFIER [, PARAM_IDENTIFIER]...] ) TOKENS #end
A parameter identifier may not be repeated in the list.
Invoke a macro:
MACRO_INVOCATION:
MACRO_IDENTIFIER ( [ACTUAL_PARAM [, ACTUAL_PARAM]...] )
ACTUAL_PARAM:
IDENTIFIER | RVALUE

Quick Reference Contents

3.8.4.9 Embedded Directives

Some directives may be embedded in CAMERA, LIGHT, OBJECT and ATMOSPHERIC_EFFECT statements. However, the directives should only include items (if any) that are valid for a given statement. Also, they should not disrupt the required order of items, where applicable.
EMBEDDED_DIRECTIVE:
IDENTIFIER_DECLARATION | UNDEF_DIRECTIVE | READ_DIRECTIVE | WRITE_DIRECTIVE | IF_DIRECTIVE | IFDEF_DIRECTIVE | IFNDEF_DIRECTIVE | SWITCH_DIRECTIVE | WHILE_DIRECTIVE | TEXT_STREAM_DIRECTIVE

Quick Reference Contents