gumpymaker

08-09-2003, 06:32 AM

Ok it's written in a language called Turing 4.04c it imports triangular models in a raw format., Turing is near english., so i think it shouldn't be any trouble for anyone to understand

setscreen ("offscreenonly")

var final_X, final_Y, final_Z, calX1, calY1, calZ1, calX2, calY2, calZ2, X, Y, Z, DISTANCE, WORLD_X, WORLD_Y, WORLD_Z, XA, YA, ZA, ROTATE_ONE, ROTATE_TWO, ROTATE_THREE, SROTATE_ONE, SROTATE_TWO,

SROTATE_THREE, CROTATE_ONE, CROTATE_TWO, CROTATE_THREE : real := 0

var Screen_x, Screen_y : int

DISTANCE := 2200

ROTATE_THREE := 0

WORLD_Y := 90

SROTATE_ONE := sind (ROTATE_ONE)

CROTATE_ONE := cosd (ROTATE_ONE)

SROTATE_TWO := sind (ROTATE_TWO)

CROTATE_TWO := cosd (ROTATE_TWO)

SROTATE_THREE := sind (ROTATE_THREE)

CROTATE_THREE := cosd (ROTATE_THREE)

procedure cal (x, y, z : int)

X := x

Y := y

Z := z

SROTATE_ONE := sind (ROTATE_ONE)

CROTATE_ONE := cosd (ROTATE_ONE)

SROTATE_TWO := sind (ROTATE_TWO)

CROTATE_TWO := cosd (ROTATE_TWO)

SROTATE_THREE := sind (ROTATE_THREE)

CROTATE_THREE := cosd (ROTATE_THREE)

XA := CROTATE_ONE * X - SROTATE_ONE * Y

%YAW

YA := SROTATE_ONE * X + CROTATE_ONE * Y

X := CROTATE_TWO * XA + SROTATE_TWO * Z

%ROLL

ZA := CROTATE_TWO * Z - SROTATE_TWO * XA

Y := CROTATE_THREE * YA - SROTATE_THREE * ZA

%PITCH

Z := SROTATE_THREE * YA + CROTATE_THREE * ZA

X := X + WORLD_X

Y := Y + WORLD_Y

Z := Z + WORLD_Z

final_X := X

final_Y := Y

final_Z := Z

Screen_x := round (DISTANCE * X / Y)

Screen_y := round (DISTANCE * Z / Y)

Screen_x := (maxx div 2) - Screen_x

Screen_y := (maxy div 2) - Screen_y

end cal

proc Draw3DTriangle (x1, y1, z1, x2, y2, z2, x3, y3, z3 : real)

var xl, yl, zl, cC, xm, ym, zm, sx1, sy1, sx2, sy2, sx3, sy3 : int

cal (round (x1), round (y1), round (z1))

sx1 := Screen_x

sy1 := Screen_y

calX1 := final_X

calY1 := final_Y

calZ1 := final_Z

cal (round (x2), round (y2), round (z2))

sx2 := Screen_x

sy2 := Screen_y

calX2 := final_X

calY2 := final_Y

calZ2 := final_Z

cal (round (x3), round (y3), round (z3))

sx3 := Screen_x

sy3 := Screen_y

calX2 := final_X

calY2 := final_Y

calZ2 := final_Z

var px, py, shadow : array 1 .. 3 of int

px (1) := sx1

px (2) := sx2

px (3) := sx3

py (1) := sy1

py (2) := sy2

py (3) := sy3

shadow (1) := sy1 div 10

shadow (2) := sy2 div 10

shadow (3) := sy3 div 10

drawpolygon (px, py, 3, 30)

end Draw3DTriangle

var filename : string := "sphere.raw"

var data : int

var lines : int := 224

var coord : array 1 .. lines of real

proc cube

open : data, filename, get

for counter : 1 .. lines

get : data, coord (1), coord (2), coord (3), coord (4), coord (5), coord (6), coord (7), coord (8), coord (9)

Draw3DTriangle (coord (1), coord (2), coord (3), coord (4), coord (5), coord (6), coord (7), coord (8), coord (9))

end for

close (data)

end cube

var speed : real := 1.5

loop

View.Update

cls

cube

ROTATE_TWO += speed

locate (1, 1)

put ROTATE_THREE

end loop

The problem is I import objects but they become deformed once they're imported by my code did I make a mistake somewhere?

setscreen ("offscreenonly")

var final_X, final_Y, final_Z, calX1, calY1, calZ1, calX2, calY2, calZ2, X, Y, Z, DISTANCE, WORLD_X, WORLD_Y, WORLD_Z, XA, YA, ZA, ROTATE_ONE, ROTATE_TWO, ROTATE_THREE, SROTATE_ONE, SROTATE_TWO,

SROTATE_THREE, CROTATE_ONE, CROTATE_TWO, CROTATE_THREE : real := 0

var Screen_x, Screen_y : int

DISTANCE := 2200

ROTATE_THREE := 0

WORLD_Y := 90

SROTATE_ONE := sind (ROTATE_ONE)

CROTATE_ONE := cosd (ROTATE_ONE)

SROTATE_TWO := sind (ROTATE_TWO)

CROTATE_TWO := cosd (ROTATE_TWO)

SROTATE_THREE := sind (ROTATE_THREE)

CROTATE_THREE := cosd (ROTATE_THREE)

procedure cal (x, y, z : int)

X := x

Y := y

Z := z

SROTATE_ONE := sind (ROTATE_ONE)

CROTATE_ONE := cosd (ROTATE_ONE)

SROTATE_TWO := sind (ROTATE_TWO)

CROTATE_TWO := cosd (ROTATE_TWO)

SROTATE_THREE := sind (ROTATE_THREE)

CROTATE_THREE := cosd (ROTATE_THREE)

XA := CROTATE_ONE * X - SROTATE_ONE * Y

%YAW

YA := SROTATE_ONE * X + CROTATE_ONE * Y

X := CROTATE_TWO * XA + SROTATE_TWO * Z

%ROLL

ZA := CROTATE_TWO * Z - SROTATE_TWO * XA

Y := CROTATE_THREE * YA - SROTATE_THREE * ZA

%PITCH

Z := SROTATE_THREE * YA + CROTATE_THREE * ZA

X := X + WORLD_X

Y := Y + WORLD_Y

Z := Z + WORLD_Z

final_X := X

final_Y := Y

final_Z := Z

Screen_x := round (DISTANCE * X / Y)

Screen_y := round (DISTANCE * Z / Y)

Screen_x := (maxx div 2) - Screen_x

Screen_y := (maxy div 2) - Screen_y

end cal

proc Draw3DTriangle (x1, y1, z1, x2, y2, z2, x3, y3, z3 : real)

var xl, yl, zl, cC, xm, ym, zm, sx1, sy1, sx2, sy2, sx3, sy3 : int

cal (round (x1), round (y1), round (z1))

sx1 := Screen_x

sy1 := Screen_y

calX1 := final_X

calY1 := final_Y

calZ1 := final_Z

cal (round (x2), round (y2), round (z2))

sx2 := Screen_x

sy2 := Screen_y

calX2 := final_X

calY2 := final_Y

calZ2 := final_Z

cal (round (x3), round (y3), round (z3))

sx3 := Screen_x

sy3 := Screen_y

calX2 := final_X

calY2 := final_Y

calZ2 := final_Z

var px, py, shadow : array 1 .. 3 of int

px (1) := sx1

px (2) := sx2

px (3) := sx3

py (1) := sy1

py (2) := sy2

py (3) := sy3

shadow (1) := sy1 div 10

shadow (2) := sy2 div 10

shadow (3) := sy3 div 10

drawpolygon (px, py, 3, 30)

end Draw3DTriangle

var filename : string := "sphere.raw"

var data : int

var lines : int := 224

var coord : array 1 .. lines of real

proc cube

open : data, filename, get

for counter : 1 .. lines

get : data, coord (1), coord (2), coord (3), coord (4), coord (5), coord (6), coord (7), coord (8), coord (9)

Draw3DTriangle (coord (1), coord (2), coord (3), coord (4), coord (5), coord (6), coord (7), coord (8), coord (9))

end for

close (data)

end cube

var speed : real := 1.5

loop

View.Update

cls

cube

ROTATE_TWO += speed

locate (1, 1)

put ROTATE_THREE

end loop

The problem is I import objects but they become deformed once they're imported by my code did I make a mistake somewhere?