Nice.
btw, do you mind if I stick these in the examples folder of the full release ?
Here is a version using some specific features of Cobra
//
// Demonstration of the use of Rectangles.
// utilizing a snazzy BB Plotball Routine By Shockwave.
// Converted By Clyde January '07
// Cobradised By GrahamK
Program Uses Pure2D,keyset
Const XRES=640
Const YRES=480
Const XRES2=320
Const YRES2=240
Const Points=360
type point=record
cs,sn:real
vbx,vby,vbz:real
vbtx,vbty,vbtz:real
endtype
Var
size: Real=1.00
xr,yr,zr: Real
pointlist:list of point
cs:Array[ Points ] Of Real
sn:Array[ Points ] Of Real
Procedure DrawPlotball()
Var
a, Value
Rd, Grn, Blu, Col
sz:Real
apoint:^point
Begin
loop apoint through pointlist
If (apoint.vbtz<0) Then
Value=(Abs(apoint.vbtz))
sz =(Value/20)
Rd =(Value+50)
Grn =0
Blu =0
If (Rd>255) Then Rd=255
If (Grn>255) Then Grn=255
If (Blu>255) Then Blu=255
col=ToRGBA(rd,grn,blu,255)
Rect ( apoint.vbtx, apoint.vbty, sz, sz, Col, true )
EndIf
endloop
End
Procedure InitializePlotball()
Var
a
Ang, Rad, Long, Lat:Real
apoint:^point
Begin
OpenScreen(XRES,YRES)
//
// Setup SLUTS.
//
For a=0 To 360
cs[a]=Cos( a )
sn[a]=Sin( a )
Next
//
// Define Plotball Points.
//
rad=200
long=0
lat=0
For a=1 To points
apoint = newitem(pointlist)
If (long>360) Then
long=long-360
lat=lat+10
EndIf
apoint.vbx=rad*(Sin(long)*Sin( (lat*200)))
apoint.vby=rad*(Sin(long)*Cos( (lat*200)))
apoint.vbz=(Cos(long)*200)
long=long+10
Next
End
Procedure RotatePlotball()
Var
a
x1,y1,z1:Real
xx,yy,zz,dv:Real
apoint:^point
Begin
//
// Rotate And Scale Each Point! Store Result
//
loop apoint through pointlist
x1 = apoint.vbx
y1 = apoint.vby
z1 = apoint.vbz
//
// X,Y,Z rotations!
//
xx=x1
yy=y1*cs[xr]+z1*sn[xr]
zz=z1*cs[xr]-y1*sn[xr]
y1=yy
x1=xx*cs[yr]-zz*sn[yr]
z1=xx*sn[yr]+zz*cs[yr]
zz=z1
xx=x1*cs[zr]-y1*sn[zr]
yy=x1*sn[zr]+y1*cs[zr]
//
// Apply Perspective!
//
dv=(zz/1000)+1
xx=size*(xx/dv)+XRES2
yy=size*(yy/dv)+YRES2
apoint.vbtx=xx
apoint.vbty=yy
apoint.vbtz=zz
endloop
//
// Rotations!
//
xr=xr+0.5
yr=yr+0.5
zr=zr+0.5
If (xr>360) Then xr=xr-360
If (yr>360) Then yr=yr-360
If (zr>360) Then zr=zr-360
End
Procedure RunPlotball()
Begin
While Not KeyDown(VK_Escape)
Cls
RotatePlotball()
DrawPlotball()
Flip
Wend
End
Begin
InitializePlotball()
RunPlotball()
CloseScreen()
End