Just a little snippet that creates an object and lets you modify it by moving its vertices. I know it can be optimized a great deal, this was just test code, but feel free to give your suggestions.
just replace the texture with one of your own
Rem Project: uvtexture
Rem Created: 1/13/2003 8:32:12 AM
Rem ***** Main Source File *****
sync on
sync rate 0
set ambient light 50
set text font "arial" : set text size 13
set text to bold : set text transparent
autocam off
color backdrop 0
position camera 0,0,0
`---------make initial object--------
make object sphere 2,50,3,3
position object 2,0,0,100
load image "firebal.bmp",2
texture object 2,2
ghost object on 2
`----------load the object into a memblock------------
make mesh from object 2,2
MAKE MEMBLOCK FROM MESH 2,2
`-------Extracting some data from the memblock header------------
fvf2 = memblock dword(2,0)
fvfsz2=memblock dword(2,4)
vcount2 = memblock dword(2,8)
memsz2=GET MEMBLOCK SIZE(2)
scwid# = screen width()
schi# = screen height()
`------------setting up variables-----------------
dim posx(vcount2-1)
dim posy(vcount2-1)
dim posz(vcount2-1)
dim vertx#(vcount2-1)
dim verty#(vcount2-1)
dim vertz#(vcount2-1)
dim sel(vcount2+3)
for v =0 to vcount2-1
` make some plains to visualize the vertexes
make object plain V+3,1,1
` Calc positions of vertices in memblock
posx(v)=12+(v*fvfsz2)
posy(v)=posx(v)+4
posz(v)=posx(v)+8
` store the vertex position values
vertx#(v) = memblock float(2,posx(v))
verty#(v) = memblock float(2,posy(v))
vertz#(v) = memblock float(2,posz(v))
position object v+3,vertx#(v),verty#(v),vertz#(v)+100
set object light v+3,0
next v
`-------------MAIN LOOP-----------------
do
` check function to see if a vertex is selected
selected = selectvertex(vcount2)
if selected
mmx# = mousemovex()
mmy# = mousemovey()
mmz# = mousemovez()
oldselected = selected
while mouseclick()=2
hide mouse
for vert = 0 to vcount2-1
mmx# = mousemovex()
mmy# = mousemovey()
mmz# = mousemovez()
mmy#= (mmy#-(mmy#*2))
vertx#(selected-3)= vertx#(selected-3)+ mmx#
verty#(selected-3)= verty#(selected-3)+ mmy#
vertz#(selected-3)= vertz#(selected-3)+ mmz#
mmx#=0
mmy#=0
mmz#=0
if sel(vert)>0
write memblock float 2,posx(vert),vertx#(selected-3)
write memblock float 2,posy(vert),verty#(selected-3)
write memblock float 2,posz(vert),vertz#(selected-3)
endif
position object selected,vertx#(selected-3),verty#(selected-3),vertz#(selected-3)+100
next vert
positobj(modelx#,modely#,modelz#,vcount2,memsz2)
show mouse
endwhile
endif
`-----------------------------------------------------
` if no longer selected, then reset
if oldselected
if selected = 0
for vert = 0 to vcount2-1
color object vert+3,RGB(255,255,255)
sel(vert)=0
next vert
oldselected=0
endif
endif
`------------------------------------------------------
if rightkey() then turn object right 2, 5
if leftkey() then turn object left 2, 5
if upkey() then pitch object up 2,5
if downkey()then pitch object down 2,5
modelx# = object position x(2)
modely# = object position y(2)
modelz# = object position z(2)
updtobj(vcount2)
sync
Display_UWProgramInfo()
loop
`--------------------------------------------------------------------------------------------------
function selectvertex(vcount2)
for vert = 0 to vcount2-1
if mousex() object screen x(vert+3)-5
if mousey() object screen y(vert+3)-5
color object vert+3,RGB(0,0,255)
selobj = vert+3
sel(vert)=vert+3
endif
endif
next vert
endfunction selobj
`----------------------------------------------------------------------------------------------------
`----------------------------------------------------------------------------------------------------
function positobj(modelx#,modely#,modelz#,vcount2,memsz2)
change mesh from memblock 2,2
delete memblock 2
delete object 2
make object 2,2,2
make memblock from mesh 2,2
set object 2,1,1,0
ghost object on 2
position object 2,modelx#,modely#,modelz#
sync
Display_UWProgramInfo()
endfunction
`----------------------------------------------------------------------------------------------------
`------------------------------------------------------------------------------------------------------
function updtobj(vcount2)
make mesh from object 2,2
delete memblock 2
make memblock from mesh 2,2
for v =0 to vcount2-1
vertx#(v) = memblock float(2,posx(v))
verty#(v) = memblock float(2,posy(v))
vertz#(v) = memblock float(2,posz(v))
position object v+3,vertx#(v),verty#(v),vertz#(v)+100
set object 2,0,1,0
next v
endfunction
`-----------------------------------------------------------------------------------------------------
Function Display_UWProgramInfo()
x=0: y=100: yh=15
set cursor 0,0
print "hold LMB to drag vertices"
print "arrow keys to rotate"
text x,y,"Example By: Jetmech": y=y+yh
text x,y,"Fps:"+str$(screen fps()): y=y+yh
EndFunction