§ Скриншот
§ Исходный код
SCREEN 13
DATA -1, 1, 1
DATA 1, 1, 1
DATA 1,-1, 1
DATA -1,-1, 1
DATA -1, 1,-1
DATA 1, 1,-1
DATA 1,-1,-1
DATA -1,-1,-1
DATA 1,0,3,2
DATA 4,5,6,7
DATA 0,1,5,4
DATA 2,3,7,6
DATA 5,1,2,6
DATA 0,4,7,3
TYPE vec2
x AS SINGLE
y AS SINGLE
END TYPE
TYPE vec3
x AS SINGLE
y AS SINGLE
z AS SINGLE
END TYPE
DIM v(0 TO 7) AS vec3
DIM f(0 TO 5, 0 TO 3) AS INTEGER
DIM p(0 TO 3) AS vec2
DIM c AS vec3, t AS vec3, r AS vec3, cam AS vec3
cam.x = 0: r.x = 0
cam.y = 0: r.y = 1
cam.z = 3: r.z = 0
FOR i = 0 TO 7: READ v(i).x, v(i).y, v(i).z: NEXT
FOR i = 0 TO 5: READ f(i, 0), f(i, 1), f(i, 2), f(i, 3): NEXT
DO
FOR i = 0 TO 5
FOR j = 0 TO 3
c = v(f(i, j))
t.x = c.x
t.y = c.y * COS(r.x) + c.z * SIN(r.x)
t.z = c.z * COS(r.x) - c.y * SIN(r.x)
c = t
t.x = c.x * COS(r.y) + c.z * SIN(r.y)
t.y = c.y
t.z = c.z * COS(r.y) - c.x * SIN(r.y)
c = t
c.x = c.x + cam.x
c.y = c.y + cam.y
c.z = c.z + cam.z
p(j).x = 160 + 100 * c.x / c.z
p(j).y = 100 - 100 * c.y / c.z
NEXT
FOR j = 0 TO 3
ABx = p(1).x - p(0).x: ABy = p(1).y - p(0).y
ACx = p(2).x - p(0).x: ACy = p(2).y - p(0).y
IF ACx * ABy < ACy * ABx THEN
n = (j + 1) MOD 4
LINE (p(j).x, p(j).y)-(p(n).x, p(n).y)
END IF
NEXT
NEXT
DO: i$ = INKEY$: LOOP WHILE i$ = ""
CLS
st = .05
IF i$ = "w" THEN r.x = r.x + st
IF i$ = "s" THEN r.x = r.x - st
IF i$ = "a" THEN r.y = r.y + st
IF i$ = "d" THEN r.y = r.y - st
IF i$ = "q" THEN r.x = r.x + st: r.y = r.y + st
IF i$ = "e" THEN r.x = r.x - st: r.y = r.y - st
LOCATE 2, 2: PRINT i$
LOOP WHILE i$ <> CHR$(27)