Just for kicks, here is the source. 2 days of work.
IncludeFile "plugin_const.pb"
;Data buffer
Global *buffer
ProcedureDLL AttachProcess(Instance)
EndProcedure
ProcedureDLL DetachProcess(Instance)
EndProcedure
ProcedureDLL AttachThread(Instance)
EndProcedure
ProcedureDLL DetachThread(Instance)
EndProcedure
;Indicate what the plugin does
ProcedureDLL PluginClass(*inbuffer,insize,*outbuffer,outsize)
PokeL(*outbuffer,#PLUGIN_BRUSHCREATION)
EndProcedure
;Label for program to use
ProcedureDLL PluginLabel(*inbuffer,insize,*outbuffer,outsize)
PokeS(*outbuffer,"Extended PrimitivesArch")
EndProcedure
Procedure.f Float(i)
f.f=i
ProcedureReturn f
EndProcedure
;Optional plugin parameters
ProcedureDLL PluginParameters(*inbuffer,insize,*outbuffer,outsize)
PokeL(*outbuffer+offset,4) : offset=offset+4
PokeL(*outbuffer+offset,#PLUGIN_BRUSHCREATION_SPINNER) : offset=offset+4
label$="Sides:"
PokeS(*outbuffer+offset,label$) : offset=offset+Len(label$)+1
PokeL(*outbuffer+offset,2) : offset=offset+4
PokeL(*outbuffer+offset,12) : offset=offset+4
PokeL(*outbuffer+offset,8) : offset=offset+4
PokeL(*outbuffer+offset,#PLUGIN_BRUSHCREATION_SPINNER) : offset=offset+4
label$="Thickness:"
PokeS(*outbuffer+offset,label$) : offset=offset+Len(label$)+1
PokeL(*outbuffer+offset,0) : offset=offset+4
PokeL(*outbuffer+offset,2048) : offset=offset+4
PokeL(*outbuffer+offset,64) : offset=offset+4
PokeL(*outbuffer+offset,#PLUGIN_BRUSHCREATION_CHECKBOX) : offset=offset+4
label$="Cut-out"
PokeS(*outbuffer+offset,label$) : offset=offset+Len(label$)+1
PokeL(*outbuffer+offset,0) : offset=offset+4
PokeL(*outbuffer+offset,#PLUGIN_BRUSHCREATION_COMBOBOX) : offset=offset+4
label$="Style:"
PokeS(*outbuffer+offset,label$) : offset=offset+Len(label$)+1
label$="Round|Gothic"
PokeS(*outbuffer+offset,label$) : offset=offset+Len(label$)+1
PokeL(*outbuffer+offset,0) : offset=offset+4
EndProcedure
;Clean up
Procedure ReleasePlugin(*inbuffer,insize,*outbuffer,outsize)
If *buffer
FreeMemory(*buffer)
*buffer=0
EndIf
EndProcedure
;Execute the plugin
ProcedureDLL RunPlugin(*inbuffer,insize,*outbuffer,outsize)
;Get drawing info
drawaxis=PeekL(*inbuffer+0)
drawboxx.f=PeekF(*inbuffer+4)
drawboxy.f=PeekF(*inbuffer+8)
drawboxz.f=PeekF(*inbuffer+12)
drawboxwidth.f=PeekF(*inbuffer+16)
drawboxheight.f=PeekF(*inbuffer+20)
drawboxdepth.f=PeekF(*inbuffer+24)
params=PeekL(*inbuffer+28)
If params<>4
MessageRequester("Error","Incorrect number of parameters.",0)
ProcedureReturn
EndIf
sides=PeekL(*inbuffer+32)
thickness.f=PeekL(*inbuffer+36)
cutout=PeekL(*inbuffer+40)
style=PeekL(*inbuffer+44)
;Allocate data buffer
objects=sides*2
If cutout
verts=6
faces=5
buffersize=(4+2*16+3*20)+(4+6*12)
buffersize=4+objects*buffersize
If thickness<>0
buffersize=buffersize+8*12+8*4+4*20
EndIf
Else
verts=8
faces=6
buffersize=(4+6*20)+(4+8*12)
buffersize=4+objects*buffersize
EndIf
If *buffer
FreeMemory(*buffer)
EndIf
*buffer=AllocateMemory(buffersize)
PokeL(*outbuffer+0,*buffer)
;Objects
PokeL(*buffer+offset,objects) : offset=offset+4
ox.f=drawboxx
oy.f=drawboxy
oz.f=drawboxz
ow.f=drawboxwidth
oh.f=drawboxheight
od.f=drawboxdepth
cos45.f=0.70710678
If cutout
For n=0 To objects-1
i.f=n
d.f=objects
a.f=(i/d*3.14159265*4.0)/4.0
i2.f=n+1
a2.f=(i2/d*3.14159265*4.0)/4.0
If style=1
drawboxx=ox
drawboxy=oy
drawboxz=oz
drawboxwidth=ow
drawboxheight=oh
drawboxdepth=od
If n<=objects/2-1
a=a/2.0
a2=a2/2.0
Select drawaxis
Case 1
drawboxz=drawboxz+drawboxdepth/2.0/cos45+drawboxdepth/2.0
drawboxdepth=drawboxdepth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
Case 2
drawboxx=drawboxx+drawboxwidth/2.0/cos45+drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxz=drawboxz+drawboxdepth*cos45-drawboxdepth/2.0
drawboxdepth=drawboxdepth/cos45
Case 3
drawboxx=drawboxx+drawboxwidth/2.0/cos45+drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
EndSelect
Else
half.f=0.5*3.14159265
a=(a-half)/2.0+half*1.5
a2=(a2-half)/2.0+half*1.5
Select drawaxis
Case 1
drawboxz=drawboxz-drawboxdepth/2.0/cos45-drawboxdepth/2.0
drawboxdepth=drawboxdepth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
Case 2
drawboxx=drawboxx-drawboxwidth/2.0/cos45-drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxz=drawboxz+drawboxdepth*cos45-drawboxdepth/2.0
drawboxdepth=drawboxdepth/cos45
Case 3
drawboxx=drawboxx-drawboxwidth/2.0/cos45-drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
EndSelect
EndIf
EndIf
sa.f=Sin(a)
sa2.f=Sin(a2)
ca.f=Cos(a)
ca2.f=Cos(a2)
If (thickness<>0) And (n=0 Or n=objects/2-1 Or n=objects/2 Or n=objects-1)
;Vertices
PokeL(*buffer+offset,verts+2) : offset=offset+4
Select n
Case 0
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Case objects/2-1
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz;drawboxz
Case 2
x.f=ox;drawboxx
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox;drawboxx
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Case objects/2
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz;drawboxz
Case 2
x.f=ox;drawboxx
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox;drawboxx
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Case objects-1
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
EndSelect
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a)*(drawboxdepth/2.0-thickness)
If n=objects/2
If style=1
z2.f=drawboxz-ca2*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dz.f=(z-z2)
dy.f=(y-y2)
y=((oz-z))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a)*(drawboxdepth-thickness)
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa2*(drawboxdepth-thickness)
dx.f=(x-x2)
dz.f=(z-z2)
z=((ox-x))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz+drawboxdepth/2.0
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dx.f=(x-x2)
dy.f=(y-y2)
y=((ox-x))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a2)*(drawboxdepth/2.0-thickness)
If n=objects/2-1
If style=1
z2.f=drawboxz-ca*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dz.f=(z2-z)
dy.f=(y2-y)
y=(1.0-(z-oz))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a2)*(drawboxdepth-thickness)
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa*(drawboxdepth-thickness)
dx.f=(x2-x)
dz.f=(z2-z)
z=(1.0-(x-ox))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz+drawboxdepth/2.0
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dx.f=(x2-x)
dy.f=(y2-y)
y=(1.0-(x-ox))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select n
Case 0
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Case objects/2-1
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz;drawboxz
Case 2
x.f=ox;drawboxx
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox;drawboxx
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Case objects/2
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz;drawboxz
Case 2
x.f=ox;drawboxx
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox;drawboxx
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Case objects-1
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
EndSelect
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a)*(drawboxdepth/2.0-thickness)
If n=objects/2
If style=1
z2.f=drawboxz-ca2*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dz.f=(z-z2)
dy.f=(y-y2)
y=((oz-z))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a)*(drawboxdepth-thickness)
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa2*(drawboxdepth-thickness)
dx.f=(x-x2)
dz.f=(z-z2)
z=((ox-x))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz-drawboxdepth/2.0
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dx.f=(x-x2)
dy.f=(y-y2)
y=((ox-x))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a2)*(drawboxdepth/2.0-thickness)
If n=objects/2-1
If style=1
z2.f=drawboxz-ca*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dz.f=(z2-z)
dy.f=(y2-y)
y=(1.0-(z-oz))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a2)*(drawboxdepth-thickness)
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa*(drawboxdepth-thickness)
dx.f=(x2-x)
dz.f=(z2-z)
z=(1.0-(x-ox))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz-drawboxdepth/2.0
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dx.f=(x2-x)
dy.f=(y2-y)
y=(1.0-(x-ox))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
;Faces
PokeL(*buffer+offset,6) : offset=offset+4
If drawaxis=3
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
Else
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
EndIf
Else
;Vertices
PokeL(*buffer+offset,verts) : offset=offset+4
If n<=objects/2-1
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Else
Select drawaxis
Case 1
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
EndIf
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a)*(drawboxdepth/2.0-thickness)
Case 2
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a)*(drawboxdepth-thickness)
Case 3
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a2)*(drawboxdepth/2.0-thickness)
Case 2
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a2)*(drawboxdepth-thickness)
Case 3
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
If n<=objects/2-1
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
Case 2
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Else
Select drawaxis
Case 1
x.f=ox-ow/2.0;drawboxx-drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 2
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy-oh/2.0;drawboxy-drawboxheight/2.0
z.f=oz+od/2.0;drawboxz+drawboxdepth/2.0
Case 3
x.f=ox+ow/2.0;drawboxx+drawboxwidth/2.0
y.f=oy+oh/2.0;drawboxy+drawboxheight/2.0
z.f=oz-od/2.0;drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
EndIf
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a)*(drawboxdepth/2.0-thickness)
Case 2
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a)*(drawboxdepth-thickness)
Case 3
x.f=drawboxx-Cos(a)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a)*(drawboxheight-thickness)
z.f=drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz-Cos(a2)*(drawboxdepth/2.0-thickness)
Case 2
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+Sin(a2)*(drawboxdepth-thickness)
Case 3
x.f=drawboxx-Cos(a2)*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+Sin(a2)*(drawboxheight-thickness)
z.f=drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
;Faces
PokeL(*buffer+offset,5) : offset=offset+4
If drawaxis=3
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
Else
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
EndIf
EndIf
Next
Else
If style=1
ox.f=drawboxx
oy.f=drawboxy
oz.f=drawboxz
ow.f=drawboxwidth
oh.f=drawboxheight
od.f=drawboxdepth
cos45.f=0.70710678
EndIf
If thickness<1.0
thickness=1.0
EndIf
verts=8
faces=6
For n=0 To objects-1
;Verts
PokeL(*buffer+offset,verts) : offset=offset+4
i.f=n
d.f=objects
a.f=(i/d*3.14159265*4.0)/4.0
i2.f=n+1
a2.f=(i2/d*3.14159265*4.0)/4.0
If style=1
drawboxx=ox
drawboxy=oy
drawboxz=oz
drawboxwidth=ow
drawboxheight=oh
drawboxdepth=od
If n<=objects/2-1
a=a/2.0
a2=a2/2.0
Select drawaxis
Case 1
drawboxz=drawboxz+drawboxdepth/2.0/cos45+drawboxdepth/2.0
drawboxdepth=drawboxdepth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
Case 2
drawboxx=drawboxx+drawboxwidth/2.0/cos45+drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxz=drawboxz+drawboxdepth*cos45-drawboxdepth/2.0
drawboxdepth=drawboxdepth/cos45
Case 3
drawboxx=drawboxx+drawboxwidth/2.0/cos45+drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
EndSelect
Else
half.f=0.5*3.14159265
a=(a-half)/2.0+half*1.5
a2=(a2-half)/2.0+half*1.5
Select drawaxis
Case 1
drawboxz=drawboxz-drawboxdepth/2.0/cos45-drawboxdepth/2.0
drawboxdepth=drawboxdepth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
Case 2
drawboxx=drawboxx-drawboxwidth/2.0/cos45-drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxz=drawboxz+drawboxdepth*cos45-drawboxdepth/2.0
drawboxdepth=drawboxdepth/cos45
Case 3
drawboxx=drawboxx-drawboxwidth/2.0/cos45-drawboxwidth/2.0
drawboxwidth=drawboxwidth/(1.0-cos45)
drawboxy=drawboxy+drawboxheight*cos45-drawboxheight/2.0
drawboxheight=drawboxheight/cos45
EndSelect
EndIf
EndIf
sa.f=Sin(a)
sa2.f=Sin(a2)
ca.f=Cos(a)
ca2.f=Cos(a2)
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
z.f=drawboxz-ca*(drawboxdepth/2.0-thickness)
If n=objects/2
If style=1
z2.f=drawboxz-ca2*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dz.f=(z-z2)
dy.f=(y-y2)
y=((oz-z))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa*(drawboxdepth-thickness)
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa2*(drawboxdepth-thickness)
dx.f=(x-x2)
dz.f=(z-z2)
z=((ox-x))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
z.f=drawboxz+drawboxdepth/2.0
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dx.f=(x-x2)
dy.f=(y-y2)
y=((ox-x))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
z.f=drawboxz-ca2*(drawboxdepth/2.0-thickness)
If n=objects/2-1
If style=1
z2.f=drawboxz-ca*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dz.f=(z2-z)
dy.f=(y2-y)
y=(1.0-(z-oz))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa2*(drawboxdepth-thickness)
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa*(drawboxdepth-thickness)
dx.f=(x2-x)
dz.f=(z2-z)
z=(1.0-(x-ox))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
z.f=drawboxz+drawboxdepth/2.0
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dx.f=(x2-x)
dy.f=(y2-y)
y=(1.0-(x-ox))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
Pokef(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa2*drawboxheight
z.f=drawboxz-ca2*drawboxdepth/2.0
Case 2
x.f=drawboxx-ca2*drawboxwidth/2.0
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa2*drawboxdepth
Case 3
x.f=drawboxx-ca2*drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa2*drawboxheight
z.f=drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx+drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa*drawboxheight
z.f=drawboxz-ca*drawboxdepth/2.0
Case 2
x.f=drawboxx-ca*drawboxwidth/2.0
y.f=drawboxy+drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa*drawboxdepth
Case 3
x.f=drawboxx-ca*drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa*drawboxheight
z.f=drawboxz+drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
z.f=drawboxz-ca*(drawboxdepth/2.0-thickness)
If n=objects/2
If style=1
z2.f=drawboxz-ca2*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dz.f=(z-z2)
dy.f=(y-y2)
y=((oz-z))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa*(drawboxdepth-thickness)
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa2*(drawboxdepth-thickness)
dx.f=(x-x2)
dz.f=(z-z2)
z=((ox-x))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
z.f=drawboxz-drawboxdepth/2.0
If n=objects/2
If style=1
x2.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
dx.f=(x-x2)
dy.f=(y-y2)
y=((ox-x))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
z.f=drawboxz-ca2*(drawboxdepth/2.0-thickness)
If n=objects/2-1
If style=1
z2.f=drawboxz-ca*(drawboxdepth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dz.f=(z2-z)
dy.f=(y2-y)
y=(1.0-(z-oz))/dz*dy+y
z=oz
EndIf
EndIf
Case 2
x.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa2*(drawboxdepth-thickness)
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
z2.f=drawboxz-drawboxdepth/2.0+sa*(drawboxdepth-thickness)
dx.f=(x2-x)
dz.f=(z2-z)
z=(1.0-(x-ox))/dx*dz+z
x=ox
EndIf
EndIf
Case 3
x.f=drawboxx-ca2*(drawboxwidth/2.0-thickness)
y.f=drawboxy-drawboxheight/2.0+sa2*(drawboxheight-thickness)
z.f=drawboxz-drawboxdepth/2.0
If n=objects/2-1
If style=1
x2.f=drawboxx-ca*(drawboxwidth/2.0-thickness)
y2.f=drawboxy-drawboxheight/2.0+sa*(drawboxheight-thickness)
dx.f=(x2-x)
dy.f=(y2-y)
y=(1.0-(x-ox))/dx*dy+y
x=ox
EndIf
EndIf
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa2*drawboxheight
z.f=drawboxz-ca2*drawboxdepth/2.0
Case 2
x.f=drawboxx-ca2*drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa2*drawboxdepth
Case 3
x.f=drawboxx-ca2*drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa2*drawboxheight
z.f=drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
Select drawaxis
Case 1
x.f=drawboxx-drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa*drawboxheight
z.f=drawboxz-ca*drawboxdepth/2.0
Case 2
x.f=drawboxx-ca*drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0
z.f=drawboxz-drawboxdepth/2.0+sa*drawboxdepth
Case 3
x.f=drawboxx-ca*drawboxwidth/2.0
y.f=drawboxy-drawboxheight/2.0+sa*drawboxheight
z.f=drawboxz-drawboxdepth/2.0
EndSelect
PokeF(*buffer+offset,x) : offset=offset+4
PokeF(*buffer+offset,y) : offset=offset+4
PokeF(*buffer+offset,z) : offset=offset+4
;Faces
PokeL(*buffer+offset,6) : offset=offset+4
If drawaxis=3
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
Else
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,6) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,2) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,7) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,3) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
PokeL(*buffer+offset,8) : offset=offset+4
PokeL(*buffer+offset,5) : offset=offset+4
PokeL(*buffer+offset,1) : offset=offset+4
PokeL(*buffer+offset,4) : offset=offset+4
EndIf
Next
EndIf
EndProcedure
WindowsXP Media Center Edition, Pentium 4 2.53 GHz CPU, 512 MB of RAM, GEForce4 MX 440