'Ashish Kushwaha
'28 Feb, 2020s
iteration = 3
size = 0.5
n = (20 ^ iteration) - 1
DIM SHARED glAllow
, cubeLoc
(n
) AS vec3
, fundamentalCubeSize
fundamentalCubeSize = size / (3 ^ iteration)
initFractal 0, 0, 0, size, iteration
PRINT (n
+ 1);
" Cubes will rendered with total of ";
8 * (n
+ 1);
" vertices" glAllow = 1
glInit = 1
_glClear _GL_DEPTH_BUFFER_BIT
OR _GL_COLOR_BUFFER_BIT
'LIGHTS CONFIG
clr(0) = 0.2: clr(1) = 0.2: clr(2) = 0.0
clr(0) = 0.8: clr(1) = 0.8: clr(2) = 0
drawFractal
SUB initFractal
(x
, y
, z
, s
, N
) 'x-position, y-position, z-position, size, N-> iteration cubeLoc(i).x = x
cubeLoc(i).y = y
cubeLoc(i).z = z
i = i + 1
' ? "Added #",i
' sleep
'top section
'sabse samne wali row, left to right
initFractal (x - s / 3), (y + s / 3), (z + s / 3), s / 3, N - 1
initFractal (x), (y + s / 3), (z + s / 3), s / 3, N - 1
initFractal (x + s / 3), (y + s / 3), (z + s / 3), s / 3, N - 1
'uske peeche wali row, left to right
initFractal (x - s / 3), (y + s / 3), (z), s / 3, N - 1
initFractal (x + s / 3), (y + s / 3), (z), s / 3, N - 1
'sabse peeche wali row, left to right
initFractal (x - s / 3), (y + s / 3), (z - s / 3), s / 3, N - 1
initFractal (x), (y + s / 3), (z - s / 3), s / 3, N - 1
initFractal (x + s / 3), (y + s / 3), (z - s / 3), s / 3, N - 1
'middle section
'sabse samne wali row, left to right
initFractal (x - s / 3), (y), (z + s / 3), s / 3, N - 1
initFractal (x + s / 3), (y), (z + s / 3), s / 3, N - 1
'sabse peeche wali row, left to right
initFractal (x - s / 3), (y), (z - s / 3), s / 3, N - 1
initFractal (x + s / 3), (y), (z - s / 3), s / 3, N - 1
'bottom section
'sabse samne wali row, left to right
initFractal (x - s / 3), (y - s / 3), (z + s / 3), s / 3, N - 1
initFractal (x), (y - s / 3), (z + s / 3), s / 3, N - 1
initFractal (x + s / 3), (y - s / 3), (z + s / 3), s / 3, N - 1
'uske peeche wali row, left to right
initFractal (x - s / 3), (y - s / 3), (z), s / 3, N - 1
initFractal (x + s / 3), (y - s / 3), (z), s / 3, N - 1
'sabse peeche wali row, left to right
initFractal (x - s / 3), (y - s / 3), (z - s / 3), s / 3, N - 1
initFractal (x), (y - s / 3), (z - s / 3), s / 3, N - 1
initFractal (x + s / 3), (y - s / 3), (z - s / 3), s / 3, N - 1
glutSolidCube fundamentalCubeSize