3. Syntax

The SCN format does not have sections like SFF, RTrace's input format, and it supports comments and even other preprocessor constructs (for example, cpp and m4 for UNIX and DOS). Another important difference is that it has default values for some scene parameters, which means that they do not have to be specified at all.

The basic components of SCN are:

comment - they start anywhere on the line with some special character like ; # or % and terminate in the end of line.

integer - any valid integer number, an integer expression inside parenthesis or the result of the int() function. Examples:

	0
	1
	-2
	(1 + 2)     ; 3
	int(10 / 3) ; 3

real - any valid integer or real number, a real expression inside parenthesis or the result of any real-valued function like sin(), cos(), etc. Examples:

	0.0
	1.5
	(1 + 2.1) ; 3.1
	log(2)    ; 0.6931

color - a triplet of RGB reals between 0 and 1. In certain cases, the RGB reals may be bigger than 1 or negative (color_extended). It is also possible to use names that represent the RGB values or the mono keyword followed by just one real. Examples:

	0 0 0    ; black
	1 1 1    ; white
	1 0 0    ; red
	white
	red
	mono 0.5 ; medium gray

point - a triplet of reals representing X Y and Z values or the result of any point-valued function like normvector(), addvector(), etc. Examples:

	0 0 0                     ; world origin
	10 5 1
	1 (2 + 1) (10 * sin(0.1)) ; 1 3 0.0175
	normvector(1.1 2.5 -2.3)  ; 0.3081 0.7001 -0.6441
	addvector(1 2 3, 4 5 6)   ; 5 7 9

vector - similar to a point, but cannot be equal to 0 0 0.

filename - a set of characters (letters, digits and others) with no blanks between. It is recommended to use only file names like those of DOS.

expression - anything inside parenthesis. An expression can be integer or real. The expression operators are + - * / ^ and | . Examples:

	(1 + 2) ; 3
	(1 - 2) ; -1
	(1 * 2) ; 2
	(1 / 2) ; 0.5
	(1 ^ 2) ; 1.0
	(5 | 3) ; 2

function - there are many functions available. The integer/real-valued with integer/real arguments are int(), sin(), cos(), tan(), asin(), acos(), atan(), sqrt(), rtod (), dtor (), exp(), log(), abs(), max() and min(). The dotvector() function has two vector arguments and returns a real number. There are also functions with point/vector arguments that return point/vector quantities like normvector(), addvector(), diffvector(), scalevector() and crossvector(). Examples:

	tan(dtor(45))             ; 1.0
	rtod(atan(1))             ; 45 degrees
	log(exp(2))               ; 2
	abs(-1.5)                 ; 1.5
	max(0, 1)                 ; 1
	dotvector(1 0 0, 0 1 0)   ; 0.0
	scalevector(1 0 0, 2)     ; 2 0 0
	scalevector(2 2 2, 1 2 3) ; 2 4 6
	crossvector(1 0 0, 0 1 0) ; 0 0 1


To Table of Contents
Back to 2. Overview
Forward to 3.1. Viewing
To 3.2. Ambient and Background
To 3.3. Lights
To 3.4. Surfaces
To 3.5. Objects
To 3.6. Transformations
To 3.7. Textures
To 4. Appendix A