Liberty BASIC Community Forum
« 3D tool box is now Public Domain »

Welcome Guest. Please Login or Register.
Sep 21st, 2017, 11:03am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: 3D tool box is now Public Domain  (Read 287 times)
michael
Team Liberty BASIC


member is offline

Avatar




PM


Posts: 111
xx 3D tool box is now Public Domain
« Thread started on: Feb 11th, 2016, 11:19pm »

Like I said technically I am a public domain contributor. And I know a high profile person who may also do the same thing.
Each tool has an example with syntax beside it.

Do as you will with it. My code art forum also repeats the pubic domain thread for this tool.

All the commands allow you to custom design the way a sphere or game block or other 3D image may look.
The depth control with shading is the key.


Code:
call screen ' I made this for a generic screen call
call sphere 800,500,220,225,240,250,1'sphere h,v,size,R,G,B,dimmer  --syntax
call block 100,50,20,200,200,200,8' block x,y,size,R,G,B,dimmer
call ellipse 100,500,250,100,225,240,250,2 ' ellipse x,y,width,height,R,G,B,dimmer
call circle 900,500,20,"green" 'circle x,y,size,"color"
call chip 400,800,100,"lightgray","black","blue"'chip x,y,size, color$ , topcolor$,midcolor$ 
call star 100,200,"starhalf"  'star h,v,"half or full star"
call star 200,120,"starfull"
'**************H***V***S***NSEW***R***G***B**Dimmer,direction$
call triangle 650,300,220,"west",225,240,250,1,"top"
call triangle 100,100,100,"east",140,200,200,2,"bottom"
for t=500 to 1000 step 40
call triangle t,100,20,"south",200,200,200,8,"bottom"
next t
for t=50 to 1000 step 40
call triangle 950,t+40,20,"north",200,200,200,8,"top"
next t
'**************H***V***S***NSEW***R***G***B**Dimmer,direction$
call panel 401,500,220,100,"west",200,200,200,2,"bottom"
call panel 399,500,220,100,"east",200,200,200,2,"bottom"
call panel 400,499,220,100,"south",200,200,200,2,"bottom"
call panel 400,501,220,100,"north",200,200,200,2,"bottom"

'********x***y** h***v**R***G**B
call rect 100,100,200,200,220,220,220
call rect 210,100,400,200,255,200,0

'*************x***y***h***v***x1***y1**h1**v1**R***G***B**size
call userdef3D 500,500,750,500,900,600,650,600,200,200,200,200
wait
[quit]
 #1 "discard"
 close #1
 end
sub sphere h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
for y=1 to size
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 2"
#1 "circle ";y
#1 "flush"
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
next y
end sub
'block h,v,size,R,G,B,dimmer
sub block h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
p=size/2
for y=1 to size
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
print #1, "line ";h-y;" ";v-y;" ";h+y;" ";v-y
print #1, "line ";h+y;" ";v-y;" ";h+y;" ";v+y
print #1, "line ";h+y;" ";v+y;" ";h-y;" ";v+y
print #1, "line ";h-y;" ";v+y;" ";h-y;" ";v-y
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
p=p-1
next y
end sub
'ellipse h,v,sizex,sizey,R,G,B,dimmer
sub ellipse h,v,sizex,sizey,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
if sizex>sizey then limit=sizex
if sizey>sizex then limit=sizey
for y=1 to limit
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 2"
hi=hi+1:if sizex>sizey then hi=hi+1
wi=wi+1:if sizey>sizex then wi=wi+1
if hi>sizex then hi=sizex
if wi>sizey then wi=sizey
#1 "ellipse ";hi;" ";wi
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
next y
end sub
'initialize generic screen
sub screen
   nomainwin
   open "Another way of doing graphics !!" for graphics_nsb_fs as #1
   print #1, "Down trapclose [quit]"

    print #1, "fill black ; home ; down ; north"
end sub
' generic circle   syntax -  circle horizontal, vertical, size, color$
sub circle x, y, size, color$
   print #1," place  "; x;" ";y
   print #1," color "; color$
   print #1," circle "; size
end sub

sub color c$
print #1, "color ";c$
end sub
'chip x,y,size, color$,topcolor$,midcolor$
sub chip x,y,size, color$ , topcolor$,midcolor$            '******** HERE IS THE CHIP SUB FOR THIS PROJECT
print #1, "down"
if size< 30 then size =30
print #1, "color ";color$
for nloc= 1 to size/10
print #1,"place "; x;" ";y-nloc
print #1, "ellipsefilled ";size;" ";size/2
next nloc
print #1, "flush"
print #1, "color ";topcolor$
print #1, "ellipsefilled ";size;" ";size/2
print #1, "flush"
print #1, "color ";midcolor$
m= size/4
print #1, "ellipsefilled ";size/2;" ";m
print #1, "flush"
end sub
' ****************** RATING STARS **************

sub star h, v, type$
    if type$ ="starhalf" then restore [starhalf]
    if type$ ="starfull" then restore [starfull]
    ost$ =""
    read x, y

    while nst$ <>"100000"
        read nst$, t
        if nst$ ="0" then r =  0: g=   0:  b=   0   'black         0   0   0
        if nst$ ="3" then r =128: g= 128:  b= 128   'dark grey   128 128 128
        if nst$ ="b" then r =224: g=  32:  b=  64   'light red   224  32  64
        if nst$ ="h" then r =255: g= 255:  b= 255   'white       255 255 255
        if nst$ ="i" then r =255: g= 255:  b=   0   'yellow      255 255   0
        #1 "color "; r; " "; g; " "; b
        for u =0 to t
            a =a +1
            #1 "set "; c +h; " "; a +v
            if a >x  then c =c +1: a =0
        next u
    wend
    #1 "flush"

  [starhalf]
    data 16,16
    data 0,5,b,0,0,15,b,1,0,14,b,0,h,0,b,0,0,13,b,0,i,0,b,0,0,4,b,1,0,6,b,0,i,1,b,0,0,0,b,3,0
    data 7,b,0,i,2,b,0,h,0,i,1,b,0,0,7,b,0,i,5,b,0,0,5,b,2,i,5,h,0,b,0,0,3,b,1,h,1,i,6,b,0
    data 100000,0

  [starfull]
    data 16,16
    data 0,5,b,0,0,15,b,1,0,14,b,0,h,0,b,0,0,13,b,0,i,0,b,0,0,4,b,1,0,6,b,0,i,1,b,0,0,0,b,3,0
    data 7,b,0,i,2,b,0,h,0,i,1,b,0,0,7,b,0,i,5,b,0,0,5,b,2,i,5,h,0,b,0,0,3,b,1,h,1,i,6,b,0
    data 0,6,b,2,h,0,i,5,b,0,0,8,b,0,i,2,h,1,i,0,b,0,0,8,b,0,i,1,h,0,b,0,h,2,b,0,0,7,b,0,i
    data 0,h,0,b,0,0,0,b,3,0,7,b,0,h,0,b,0,0,4,b,1,0,6,b,0,h,0,b,0,0,13,b,1,100000,0

end sub
sub triangle h,v,size,NESW$,x,c,a,dimmer,direction$ ' dimmer cannot be more than 24
#1 "place ";h;" ";v
p=size/2
if direction$="top" then rev=0
if direction$="bottom" then rev=size
for y=1 to size
if direction$="top" then rev=rev+1
if direction$="bottom" then rev=rev-1
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
if NESW$="south" then print #1, "line ";h-rev;" ";v-rev;" ";h+rev;" ";v-rev
if NESW$="west" then print #1, "line ";h+rev;" ";v-rev;" ";h+rev;" ";v+rev
if NESW$="north" then print #1, "line ";h+rev;" ";v+rev;" ";h-rev;" ";v+rev
if NESW$="east" then print #1, "line ";h-rev;" ";v+rev;" ";h-rev;" ";v-rev
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
p=p-1
next y
end sub
sub userdef3D x,y,h,v,h1,v1,x1,y1,r,g,b,size' dimmer cannot be more than 24
#1 "down"
r2=r : g2=g : b2=b
for up =1 to size
#1 "color ";r2;" ";g2;" ";b2
print #1, "line ";x;" ";y+up;" ";h;" ";v+up
r2=r2-1
g2=g2-1
b2=b2-1
next up
r1=r : g1=g : b1=b
for up =1 to size
#1 "color ";r1;" ";g1;" ";b1
if h1>h then print #1, "line ";h;" ";v+up;" ";h1;" ";v1+up'right side
if h1<h then print #1, "line ";x1;" ";y1+up;" ";x;" ";y+up'left side
r1=r1-1
g1=g1-1
b1=b1-1
next up
r1=r : g1=g : b1=b
for up =1 to size
#1 "color ";r;" ";g;" ";b
if h1<h then print #1, "line ";h;" ";v+up;" ";h1;" ";v1+up'right side
if h1>h then print #1, "line ";x1;" ";y1+up;" ";x;" ";y+up'left side
r=r-1
g=g-1
b=b-1
next up
for up =1 to size
#1 "color ";r1;" ";g1;" ";b1
print #1, "line ";h1;" ";v1+up;" ";x1;" ";y1+up

r1=r1-1
g1=g1-1
b1=b1-1
next up
end sub
sub rect x,y,h,v,r,g,b

#1 "down"
#1 "color ";r;" ";g;" ";b
#1 "size 1"
print #1, "line ";x;" ";y;" ";h;" ";y
print #1, "line ";h;" ";y;" ";h;" ";v
print #1, "line ";h;" ";v;" ";x;" ";v
print #1, "line ";x;" ";v;" ";x;" ";y
end sub
sub panel h,v,size,size2,NESW$,x,c,a,dimmer,direction$ ' dimmer cannot be more than 24
p=size/2
if direction$="top" then rev=size2
if direction$="bottom" then rev=size
for y=size2 to size
if direction$="top" then rev=rev+1
if direction$="bottom" then rev=rev-1
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
if NESW$="south" then print #1, "line ";h-rev;" ";v-rev;" ";h+rev;" ";v-rev
if NESW$="west" then print #1, "line ";h+rev;" ";v-rev;" ";h+rev;" ";v+rev
if NESW$="north" then print #1, "line ";h+rev;" ";v+rev;" ";h-rev;" ";v+rev
if NESW$="east" then print #1, "line ";h-rev;" ";v+rev;" ";h-rev;" ";v-rev
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
p=p-1
next y
end sub


 
« Last Edit: Feb 12th, 2016, 07:36am by michael » User IP Logged

I like making program generators and reinventing the wheel.. I never make mistakes.. Not ever.. (lie)
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls