util-functions

Description

Handy functions to make your life easier...

(time)

Returns time-number

Returns the number of seconds (+ fraction) since midnight January 1st 1970. This is the simpest animation source for your scripts.

Example

 (define (animate)
     (rotate (vector (sin (time)) 0 0))
     (draw-cube))
 (every-frame (animate))    

(delta)

Returns time-number

Time in seconds since the last frame. Used to make animation frame rate independant.

Example

 (define (animate)
     (rotate (vector (* (delta) 10) 0 0))
     (draw-cube))
 (every-frame (animate))    

(flxrnd)

Returns random-number

Returns a random number between 0 and 1.

Example

 (define (animate)
     (colour (vector (flxrnd) (flxrnd) (flxrnd)))
     (draw-cube))
 (every-frame (animate))

(flxseed seed-number)

Returns void

Seeds the random number generator so we can get the same sequence.

Example

 (define (animate)
     (colour (vector (flxrnd) (flxrnd) (flxrnd)))
     (draw-cube))
 (flxseed 10) 
 (every-frame (animate)) ; the same sequence of colours will be generated

(set-searchpathss paths-list)

Returns void

Sets a list of search path strings to use for looking for fluxus related files, such as textures, shaders etc. Paths will be searched in order each time, and need trailing slashes.

Example

 (set-searchpaths (append (get-searchpaths) (list "/path/to/my/textures/" "/path/to/my/other/textures/")))

(get-searchpaths paths-list)

Returns void

Gets the list of search path strings to use for looking for fluxus related files, such as textures, shaders etc. Paths will be searched in order each time.

Example

 (display (get-searchpaths))(newline)

(fullpath filename-string)

Returns fullpath-string

Searches the search paths for the specified file and returns the first location it finds.

Example

 (fullpath "myfile")

(framedump filename)

Returns void

Saves out the current OpenGL front buffer to disk. Reads the filename extension to decide on the format used for saving, "tif", "jpg" or "ppm" are supported. This is the low level form of the frame dumping, use start-framedump and end-framedump instead.

Example

 (framedump "picture.jpg")

(tiled-framedump filename)

Returns void

For rendering images that are bigger than the screen, for printing or other similar stuff. This command uses a tiled rendering method to render bits of the image and splice them together into the image to save. Reads the filename extension to decide on the format used for saving, "tif", "jpg" or "ppm" are supported.

Example

 (tiled-framedump "picture.jpg" 3000 2000)