Global state is really anything that controls the renderer globally, so it affects all primitives or controls the renderer directly - ie camera control or full screen effects like blurring.
void
Clears the renderer, and physics system. This command should not be called directly, use clear instead, as this clears a few other things, and calls clear-engine itself.
(clear-engine) ; woo hoo!
void
Sets the full screen blur setting. Less is more, but if you set it too low it will make the on screen editing impossible to read, so save your script first :)
(blur 0.1) ; for nice trails
void
Sets the fogging parameters to give a visual depth cue (aerial perspective in painter's jargon). This can obscure the on screen editing, so keep the amount small.
(clear-colour (vector 0 0 1)) ; looks nice if the background matches (fog (vector 0 0 1) 0.01 1 100) ; blue fog
void
Full screen feedback for Jeff Minter style crazyness (renders the last frame in the background, including the previous feedback background...). This allocates large amounts of texture space and seems to be unstable, so it's probably better not to use it. If you do, use with feedback-transform, but don't say I didn't warn you.
(feedback 0.1) ; set the feedback amount (build-cube) (define (animate) (feedback-transform (mrotate (vector 1 1 (* 45 (sin (time))))))) ; change the transform (every-frame (animate))
void
Sets the transform for the feedback plane. See feedback for more details, probably shouldn't be used.
(feedback 0.1) ; set the feedback amount (build-cube) (define (animate) (feedback-transform (mrotate (vector 1 1 (* 45 (sin (time))))))) ; change the transform (every-frame (animate))
void
Shows the worldspace origin axis. used.
(show-axis 1)
void
Shows an fps count in the lower left of the screen. used.
(show-fps 1)
void
Locks the camera transform onto the specified primitive's transform. It's like parenting the camera to the object. This is the easiest way to procedurally drive the camera. Use an id number of 0 to unlock the camera.
(clear) (define obj (build-cube)) ; make a cube for the camera to lock to (push) ; make a background cube so we can tell what's happening (hint-wire) (hint-unlit) (colour (vector 0 0.4 0)) (scale (vector -50 -50 -50)) (build-cube) (pop) (lock-camera obj) ; lock the camera to our first cube (define (animate) (grab obj) (rotate (vector 1 0 0)) ; rotate the cube (ungrab)) (every-frame (animate))
void
The camera locking has an inbuilt lagging which means it will smoothly blend the movement relative to the primitive it's locked to.
(clear) (define obj (build-cube)) ; make a cube for the camera to lock to (push) ; make a background cube so we can tell what's happening (hint-wire) (hint-unlit) (colour (vector 0 0.4 0)) (scale (vector -50 -50 -50)) (build-cube) (pop) (lock-camera obj) ; lock the camera to our first cube (camera-lag 0.1) ; set the lag amount, this will smooth out the cube jittery movement (define (animate) (grab obj) (identity) (translate (vector (modulo (round (inexact->exact (time))) 6) 0 0)) ; make a jittery movement (ungrab)) (every-frame (animate))
textureid-number
Loads a texture from disk, converts it to a texture, and returns the id number. The texture loading is memory cached, so repeatedly calling this will not cause it to load again. Use force-load-texture if you are changing the texture while running the script. The png may be RGB or RGBA to use alpha transparency.
(texture (load-texture "mytexture.png")) (build-cube) ; the cube will be texture mapped with the image
textureid-number
Uncached loading of textures from disk, converts it to a texture, and returns the id number. Useful if you are changing the texture while running the script, otherwise use load-texture, which will be much faster. The png may be RGB or RGBA to use alpha transparency.
(texture (force-load-texture "mytexture.png")) (build-cube) ; the cube will be texture mapped with the image
void
Sets the camera frustum, and thus the aspect ratio of the frame.
(frustum -1 1 -0.75 0.75) ; default settings
void
Sets the front & back clipping planes for the camera frustum, and thus the viewing angle. Change the front clipping distance to alter the perspective from telephoto to fisheye.
(clip 1 10000) ; default settings
void
Sets orthographic projection - i.e. no perspective.
(ortho)
void
Sets perspective projection (the default) after ortho has been set.
(persp)
void
Sets the zoom level for the orthographic projection.
(set-ortho-zoom 2)
void
Turns backface culling on or off. Backface culling speeds up rendering by removing faces not orientated towards the camera. Defaults to on, but this is not always desired, eg for double sided polygons.
(backfacecull 0)
void
Sets the colour we clear the renderer with, this forms the background colour for the scene.
(clear-colour (vector 1 0 0)) ; RED!!!
void
Sets the frame and zbuffer clearing on or off.
(clear-frame 0)
matrix-vector
Gets the current camera transform matrix. This is the low level function, use get-camera-transform instead.
(get-camera)
void
Sets the camera transform matrix. This is the low level interface used by set-camera-transform, which you should generally use instead.
(set-camera)
projection-matrix
Gets the current projection matrix.
(get-projection-transfrom)
size-vector
Returns a vector containing the current width and height of the window.
(get-screen-size)
void
Sets the window width and height.
(set-screen-size (vector 10 10)) ; small window time :)
primitiveid-number
Looks in the region specified and returns the id of the closest primitive to the camera rendered there, or 0 if none exist.
(display (select 10 10 2))(newline)
void
Throttles the renderer so as to not take 100% cpu. This gives an upper limit on the fps rate, which doesn't quite match the given number, but I'm working on it...
(desiredfps 100000) ; makes fluxus render as fast as it can, and take 100% cpu.