Hehee.. Got little speed boost with d3d.. 350 was static and 1000+ some times.. And dint change the code only the line command with d3d_line and the ink rgb with d3d_color and removed () bracets but i also modifed the code here's my try
(Need Cloggy's d3d Plugin)
sync on
sync rate 0
cls
hide mouse
type vec3
x as float
y as float
z as float
endtype
type vecvec3
x as vec3
y as vec3
z as vec3
endtype
type camera_type
angle as vec3 rem note: Y axis is the first angle (global), then X, then Z (relative/local)
axis as vecvec3
position as vec3
fov as float
aspect_ratio as float
endtype
global xmove#
global zmove#
global cx#
global cy#
global camera as camera_type
camera.fov=80
camera.aspect_ratio=(1.0*screen width())/screen height()
do
cls
Control_Camera()
print "FPS:",screen fps()
lock pixels
Cube3d(0,0,0)
Cube3d(10,10,10)
Pyramid3d(-10,-10,-10,0)
Pyramid3d(-20,-20,-20,10)
Circle3d(20,20,20,0)
unlock pixels
fastsync
loop
Function Cube3d(x#,y#,z#)
draw_line(-1+6+x#,0+6+y#,1+6+z#,1+6+x#,0+6+y#,1+6+z#)
draw_line(-1+6+x#,0+6+y#,3+6+z#,1+6+x#,0+6+y#,3+6+z#)
draw_line(-1+6+x#,2+6+y#,1+6+z#,1+6+x#,2+6+y#,1+6+z#)
draw_line(-1+6+x#,2+6+y#,3+6+z#,1+6+x#,2+6+y#,3+6+z#)
draw_line(-1+6+x#,0+6+y#,1+6+z#,-1+6+x#,2+6+y#,1+6+z#)
draw_line(-1+6+x#,0+6+y#,3+6+z#,-1+6+x#,2+6+y#,3+6+z#)
draw_line(-1+6+x#,0+6+y#,1+6+z#,-1+6+x#,2+6+y#,1+6+z#)
draw_line(-1+6+x#,0+6+y#,3+6+z#,-1+6+x#,2+6+y#,3+6+z#)
draw_line(1+6+x#,0+6+y#,1+6+z#,1+6+x#,2+6+y#,1+6+z#)
draw_line(1+6+x#,0+6+y#,3+6+z#,1+6+x#,2+6+y#,3+6+z#)
draw_line(1+6+x#,0+6+y#,1+6+z#,1+6+x#,2+6+y#,1+6+z#)
draw_line(1+6+x#,0+6+y#,3+6+z#,1+6+x#,2+6+y#,3+6+z#)
draw_line(-1+6+x#,0+6+y#,1+6+z#,-1+6+x#,0+6+y#,3+6+z#)
draw_line(1+6+x#,0+6+y#,1+6+z#,1+6+x#,0+6+y#,3+6+z#)
draw_line(-1+6+x#,2+6+y#,1+6+z#,-1+6+x#,2+6+y#,3+6+z#)
draw_line(1+6+x#,2+6+y#,1+6+z#,1+6+x#,2+6+y#,3+6+z#)
endfunction
Function Pyramid3d(x#,y#,z#,size)
draw_line(x#,y#,z#,2+size+x#,-4-size+y#,2+size+z#)
draw_line(x#,y#,z#,-2-size+x#,-4-size+y#,-2-size+z#)
draw_line(x#,y#,z#,2+size+x#,-4-size+y#,-2-size+z#)
draw_line(x#,y#,z#,-2-size+x#,-4-size+y#,2+size+z#)
draw_line(2+size+x#,-4-size+y#,2+size+z#,2+size+x#,-4-size+y#,-2-size+z#)
draw_line(-2-size+x#,-4-size+y#,-2-size+z#,-2-size+x#,-4-size+y#,2+size+z#)
draw_line(2+size+x#,-4-size+y#,2+size+z#,-2-size+x#,-4-size+y#,2+size+z#)
draw_line(-2-size+x#,-4-size+y#,-2-size+z#,2+size+x#,-4-size+y#,-2-size+z#)
endfunction
Function Circle3d(x0#,y0#,z0#,size)
size=size+6
x0#=x0#-camera.position.x:y0#=y0#-camera.position.y:z0#=z0#-camera.position.z
x00#=x0#*camera.axis.x.x+y0#*camera.axis.x.y+z0#*camera.axis.x.z
y00#=x0#*camera.axis.y.x+y0#*camera.axis.y.y+z0#*camera.axis.y.z
z00#=x0#*camera.axis.z.x+y0#*camera.axis.z.y+z0#*camera.axis.z.z
if z00#<=0 then exitfunction
x0=(x00#/z00#)/tan(camera.fov*0.5)*screen width()*0.5+screen width()*0.5
y0=(0-y00#/z00#)/tan(camera.fov*0.5)*camera.aspect_ratio*screen height()*0.5+screen height()*0.5
d3d_circle x0,y0,size,0
endfunction
Function Control_Camera()
cy#=cy#+mousemovex()*0.5
cx#=cx#+mousemovey()*0.5
camera.angle.y=curveangle(cy#,camera.angle.y,2)
camera.angle.x=curveangle(cx#,camera.angle.x,2)
camera.angle.z=camera.angle.z*0.99+(keystate(16)-keystate(18))
update_camera()
zmove#=(keystate(17)-keystate(31))*0.1
xmove#=(keystate(32)-keystate(30))*0.1
camera.position.x=camera.position.x+camera.axis.z.x*zmove#
camera.position.y=camera.position.y+camera.axis.z.y*zmove#
camera.position.z=camera.position.z+camera.axis.z.z*zmove#
camera.position.x=camera.position.x+camera.axis.x.x*xmove#
camera.position.y=camera.position.y+camera.axis.x.y*xmove#
camera.position.z=camera.position.z+camera.axis.x.z*xmove#
if camera.position.x<-30 then camera.position.x=-30
if camera.position.y<-30 then camera.position.y=-30
if camera.position.z<-30 then camera.position.z=-30
if camera.position.x>30 then camera.position.x=30
if camera.position.y>30 then camera.position.y=30
if camera.position.z>30 then camera.position.z=30
endfunction
function update_camera()
xx0#=1:xy0#=0:xz1#=0:yx0#=0:yy0#=1:yz1#=0:zx2#=0:zy1#=0:zz1#=1
xx2#=xx0#*cos(camera.angle.z):xy1#=xx0#*sin(camera.angle.z)
yx2#=-yy0#*sin(camera.angle.z):yy1#=yy0#*cos(camera.angle.z)
xy2#=xy1#*cos(camera.angle.x)-xz1#*sin(camera.angle.x)
xz2#=xz1#*cos(camera.angle.x)+xy1#*sin(camera.angle.x)
yy2#=yy1#*cos(camera.angle.x)-yz1#*sin(camera.angle.x)
yz2#=yz1#*cos(camera.angle.x)+yy1#*sin(camera.angle.x)
zy2#=zy1#*cos(camera.angle.x)-zz1#*sin(camera.angle.x)
zz2#=zz1#*cos(camera.angle.x)+zy1#*sin(camera.angle.x)
camera.axis.x.x=xx2#*cos(camera.angle.y)+xz2#*sin(camera.angle.y)
camera.axis.x.y=xy2#
camera.axis.x.z=xz2#*cos(camera.angle.y)-xx2#*sin(camera.angle.y)
camera.axis.y.x=yx2#*cos(camera.angle.y)+yz2#*sin(camera.angle.y)
camera.axis.y.y=yy2#
camera.axis.y.z=yz2#*cos(camera.angle.y)-yx2#*sin(camera.angle.y)
camera.axis.z.x=zx2#*cos(camera.angle.y)+zz2#*sin(camera.angle.y)
camera.axis.z.y=zy2#
camera.axis.z.z=zz2#*cos(camera.angle.y)-zx2#*sin(camera.angle.y)
endfunction
function draw_line(x0#,y0#,z0#,x1#,y1#,z1#)
x0#=x0#-camera.position.x:y0#=y0#-camera.position.y:z0#=z0#-camera.position.z
x1#=x1#-camera.position.x:y1#=y1#-camera.position.y:z1#=z1#-camera.position.z
x00#=x0#*camera.axis.x.x+y0#*camera.axis.x.y+z0#*camera.axis.x.z
y00#=x0#*camera.axis.y.x+y0#*camera.axis.y.y+z0#*camera.axis.y.z
z00#=x0#*camera.axis.z.x+y0#*camera.axis.z.y+z0#*camera.axis.z.z
if z00#<=0 then exitfunction
x0=(x00#/z00#)/tan(camera.fov*0.5)*screen width()*0.5+screen width()*0.5
y0=(0-y00#/z00#)/tan(camera.fov*0.5)*camera.aspect_ratio*screen height()*0.5+screen height()*0.5
x10#=x1#*camera.axis.x.x+y1#*camera.axis.x.y+z1#*camera.axis.x.z
y10#=x1#*camera.axis.y.x+y1#*camera.axis.y.y+z1#*camera.axis.y.z
z10#=x1#*camera.axis.z.x+y1#*camera.axis.z.y+z1#*camera.axis.z.z
if z10#<=0 then exitfunction
x1=(x10#/z10#)/tan(camera.fov*0.5)*screen width()*0.5+screen width()*0.5
y1=(0-y10#/z10#)/tan(camera.fov*0.5)*camera.aspect_ratio*screen height()*0.5+screen height()*0.5
d3d_line x0,y0,x1,y1
endfunction