Rainbow city
A simple demo.
/////////////////////////////////////////////////////////////////////////////////// BEGIN object DEMOCITY /////////////////////////////////////////////////////////////////////////////////// OBJECT Scripta = @ DEMO_city OBJECT Parent = APPLET ATOM Resolution = R640 ATOM FSRenderer = NORMAL END /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// branch init() /////////////////////////////////////////////////////////////////////////////////// @.init() FLOATS $.cubepts = {} cubepts = cubepts append { -1 -1 -1 } cubepts = cubepts append { 1 -1 -1 } cubepts = cubepts append { -1 1 -1 } cubepts = cubepts append { 1 1 -1 } cubepts = cubepts append { -1 -1 1 } cubepts = cubepts append { 1 -1 1 } cubepts = cubepts append { -1 1 1 } cubepts = cubepts append { 1 1 1 } cubepts = cubepts append { 1 4 1 } INTEGERS $.cubeline cubeline = { 1 2 1 3 2 4 3 4 5 6 5 7 6 8 7 8 1 5 2 6 3 7 4 8 } cubeline -= 1 IMATRIX $.world = newMatrix() IMATRIX $.proj = newMatrix() IMATRIX $.matrix = newMatrix() matrix . set2D(320, 240, 2, 20) proj . setPerspective(10, 1000, 100, -100) proj . mulL(matrix) FLOAT $.rot = 0.0 cubepts *= { 1 9 1 } end /////////////////////////////////////////////////////////////////////////////////// branch update() /////////////////////////////////////////////////////////////////////////////////// end /////////////////////////////////////////////////////////////////////////////////// branch render() rendSetColor(nul, rendColor(245, 245, 250)) rendSetBlending('mul') rendSetRenderer('fill') rendFill(0, 0, 640, 480) rendSetShape('smoothing', 4) rendSetShape('linewidth', 32) rendSetShape('lastpixel', 1) rendSetBlending('add') rot += 0.1 INTEGER x = 0 INTEGER y = 0 ICOLOR col = 0 ICOLORS colb = repeat(rendColor(0, 0, 0), 3) INTEGER pts = count cubepts / 3 VECTORS buffer = repeat(0, pts) while (y += 1) < 10 x = 0 while (x += 1) < 10 col = rendColor(x, y, 10 - x) rendSetColor(col) world.setRotationY(rot) world.translateLocal((10.0 * x) - 50.0, -6.0, (10.0 * y) - 50.0) world.translate(0.0, 0.0, 60.0) matrix.compose(proj, world) matrix.xform4wb3(pts, cubepts, buffer) rendSetCoords(buffer) rendLinesIndex(count cubeline, cubeline) rendTriangleIndex(7, 8, 9) endwhile endwhile end ///////////////////////////////////////////////////////////////////////////////////
