Primitives are cool...
primitiveid-number
A simple cube, texture mapped placement per face
(define mynewcube (build-cube))
primitiveid-number
Builds a raw polygon primitive with size vertices (everything is initially set to zero). Type is a number that refers to the way the vertices are interpreted to build polygons, and can be one of the following: 0=TRISTRIP, 1=QUADS, 2=TRILIST, 3=TRIFAN, 4=POLYGON
(define mynewshape (build-polygons 100 0))
primitiveid-number
A sphere with the resolution specified, texture mapped in normal "world map" style.
(define mynewshape (build-sphere 10 10))
primitiveid-number
A single quad plane, texture mapped from 0->1 in both dimensions.
(define mynewshape (build-plane))
primitiveid-number
A tesselated poly plane, texture mapped from 0->1 in both dimensions.
(define mynewshape (build-plane))
primitiveid-number
A capped cylinder, texture map wrapped around, and badly wrapped around the ends.
(define mynewshape (build-cylinder 10 10))
primitiveid-number
Builds a line consisting of numpoints points. The geometry is constantly camera facing and is texture mapped so the texture is stretched along the line from start to finish. You use the pdata functions to edit the postions and widths of the lines. If used lit, the normals are faked to approximate a circular cross section. Additionally, if solid rendering is cleared with (hint-none) and (hint-wire) is activated, a faster constant width line will be drawn - width specified by the (line-width) command.
(define mynewshape (build-line 10))
primitiveid-number
Builds a sequence of planes, texture mapped so that a font texture can be used to display text. Might also be useful for more abstract things. The font assumed to be non proportional - there is an example font shipped with fluxus Ok, so this isn't a very good font texture :)
(texture (texture-load "font.png")) (define mynewshape (build-text "hello"))
primitiveid-number
Builds a tesselated nurbs sphere, texture mapped in the same fashion as the poly sphere.
(define mynewshape (build-nurbs-sphere 10 10))
primitiveid-number
Builds a tesselated nurbs plane, texture mapped in uv direction.
(define mynewshape (build-nurbs-plane 10 10))
primitiveid-number
Builds a particles primitive containing num points, all initially set to the origin. You use the pdata functions to edit the postions, colours and sizes. Particles come in two flavors, camera facing sprites, which are the default, can be textured and individually scaled; and points (when hint-points is set), which cannot be textured but are much faster to render, as they are hardware supported gl points. By default these point particles are square, turn on hint-anti-alias to make them circular.
(define mynewshape (build-particles 100))
primitiveid-number
A locator is an empty primitive, useful for parenting to (when you don't want to have the parent object visible). This primitive can only be visualised with (hint-origin) to display it's local transform origin.
(define mynewshape (build-locator))
primitiveid-number
Makes a new pixel primitive. A pixel primitive is used for making procedural textures, which can then be applied to other primitives. For this reason, pixel primitives probably wont be rendered much, but you can render them to preview the texture on a flat plane.
(define mynewshape (build-pixels 100 100))
void
Uploads the texture data, you need to call this when you've finished writing to the pixelprim, and while it's grabbed.
(define mynewshape (build-pixels 100 100)) (upload-pixels mynewshape)
textureid-number
Returns a texture you can use exactly like a normal loaded one.
(define mynewshape (build-pixels 100 100)) (upload-pixels mynewshape) (texture (pixels->texture mynewshape))
primitiveid-number
Blobby primitives are a higher level implicit surface representation in fluxus which is defined using influences in 3 dimesional space. These infuences are then summed together, and a particular value is "meshed" (using the marching cubes algorithm) to form a smooth surface. The influences can be animated, and the smooth surface moves and deforms to adapt, giving the primitive it's blobby name. build-blobby returns a new blobby primitive. Numinfluences is the number of "blobs". Subdivisions allows you to control the resolution of the surface in each dimension, while boundingvec sets the bounding area of the primitive in local object space. The mesh will not be calculated outside of this area. Influence positions and colours need to be set using pdata-set.
(define mynewshape (build-blobby 7 (vector 30 30 30) (vector 3 3 3)))
void
Copies a retained mode primitive and draws it in the current state as an immediate mode primitive.
(define mynewshape (build-cube)) (colour (vector 1 0 0)) (draw-instance mynewshape) ; draws a copy of mynewshape
void
Draws a cube in the current state in immediate mode primitive.
(define (render) (draw-cube)) (every-frame (render))
void
Draws a plane in the current state in immediate mode primitive.
(define (render) (draw-plane)) (every-frame (render))
void
Draws a sphere in the current state in immediate mode primitive.
(define (render) (draw-sphere)) (every-frame (render))
void
Draws a cylinder in the current state in immediate mode primitive.
(define (render) (draw-cylinder)) (every-frame (render))
void
Deletes a built primitive from the renderer. primitive.
(define mynewshape (build-sphere 10 10)) (destroy mynewshape)