Hi all. I've decided to create a vertex manipulator, and need some help with it.
What I want to do, is have it so you can create ANY amount of vertices (spheres connected by lines) as you want, and still have it connect a line to each other vertex.
Here's the code:
Rem Project: 3dmodeler
Rem Created: Monday, January 03, 2011
Rem ***** Main Source File *****
sync on
sync rate 60
autocam off
position camera 0,1,0
rotate camera 0,45,0
make matrix 1000,1000,1000,20,20
global maxvertices as integer
maxvertices = 100000
type vertices
id as integer
x# as float
y# as float
z# as float
xrotation# as float
yrotation# as float
zrotation# as float
scale# as float
xscale# as float
yscale# as float
zscale# as float
endtype
type coords
id as integer
x# as float
y# as float
z# as float
xrotation# as float
yrotation# as float
zrotation# as float
scale# as float
xscale# as float
yscale# as float
zscale# as float
endtype
dim thevertices(maxvertices+1) as vertices
dim get_allcoords(maxcoords) as coords
get_allcoords(0).x#=10.0
global allvertices as integer
allvertices = 4
vertexid=get_vertexinfo()
make_vertex()
do
for x3=1 to allvertices
obj=find free object()
X1=thevertices(x3).x#
Y1=thevertices(x3).y#
Z1=thevertices(x3).z#
X2=thevertices(x3-1).x#
Y2=thevertices(x3-1).y#
Z2=thevertices(x3-1).z#
next x
Draw3DLine(obj,X1,Y1,Z1,X2,Y2,Z2,255,0,0)
move camera (keystate(17)-keystate(31) or upkey()-downkey())*1
turn camera left (keystate(30)-keystate(32) or leftkey()-rightkey())*1
sync
loop
function make_vertex()
for x3=1 to allvertices
id=thevertices(x3).id
x#=thevertices(x3).x#
y#=thevertices(x3).y#
z#=thevertices(x3).z#
xrotation#=thevertices(x3).xrotation#
yrotation#=thevertices(x3).yrotation#
zrotation#=thevertices(x3).zrotation#
scale#=thevertices(x3).scale#
xscale#=thevertices(x3).xscale#
yscale#=thevertices(x3).yscale#
zscale#=thevertices(x3).zscale#
make object sphere x3,scale#
fix object pivot x3
position object x3,x#,y#,z#
scale object x3,xscale#,yscale#,zscale#
rotate object x3,xrotation#,yrotation#,zrotation#
next x3
endfunction id
function Draw3DLine(obj,X1,Y1,Z1,X2,Y2,Z2,r,g,b)
If Object Exist(obj) Then Delete Object obj
if Object Exist(obj)=0
MAKE OBJECT TRIANGLE obj, X1, Y1, Z1, X2, Y2, Z2, X2, Y2, Z2
SET OBJECT WIREFRAME obj, 1
COLOR OBJECT obj,rgb(r,g,b)
set object ambient obj,1
endif
endfunction obj
function get_vertexinfo()
for x3=1 to allvertices
thevertices(x3).id=get_allcoords.id(x3)
thevertices(x3).x#=get_allcoords.x#(x3)
thevertices(x3).y#=get_allcoords.y#(x3)
thevertices(x3).z#=get_allcoords.z#(x3)
thevertices(x3).xrotation#=get_allcoords.xrotation#(x3)
thevertices(x3).yrotation#=get_allcoords.yrotation#(x3)
thevertices(x3).zrotation#=get_allcoords.zrotation#(x3)
thevertices(x3).scale#=get_allcoords.scale#(x3)
thevertices(x3).xscale#=get_allcoords.xscale#(x3)
thevertices(x3).yscale#=get_allcoords.yscale#(x3)
thevertices(x3).zscale#=get_allcoords.zscale#(x3)
next x3
endfunction id
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!