Chafari i don't really understand how can i make the texturing possible between the this code which lets me add multiple objects into a scene
perform checklist for files
cq = checklist quantity()
numFiles = 0
dim files(-1) as string
for n = 1 to cq
s$ = checklist string$(n)
if right$(s$, 2) = ".x"
array insert at bottom files()
files(numFiles) = s$
inc numFiles
endif
next n
if numFiles = 0
print "put some .x files in the .exe's folder first. Press key..."
end
endif
`position camera 0,50,700,55
`rotate camera 90,0,0
ground = 1
if object exist (ground) = 0
make object plane ground, 10000, 10000 : xrotate object ground, 90
endif
fileDrag = -1
impobrot# = 0
kinarr = 0
do
update terrain
if object exist(65538) = 1
position object 65538,camera position x(0),0,camera position z(0)
endif
if object exist(8000) = 1
a# = get terrain ground height( 8000, object position x(65538), object position z(65538) )
position object 65538,camera position x(0),a#,camera position z(0)
endif
if keystate(1) = 1
if object exist(65538) = 1
delete object 65538
endif
endif
camstat()
camerasetup()
console()
if keystate(1) = 1
exit
ENDIF
oMc = mc
mx = mousex()
my = mousey()
mc = mouseclick()
ink 0xffffffff, 0 : box 0, 0, 160, scrH
line 161, 0, 161, scrH
y = 0
mouseOver = -1
nMax = numFiles-1
for n = 0 to nMax
if mx < 160 and my => y and my < y+15
if fileDrag = -1
ink 0, 0 : box 0, y, 160, y+14
ink 0xffffffff, 0 : text 0, y, files(n)
mouseOver = n
else
ink 0xff808080, 0 : box 0, y, 160, y+14
ink 0xffffffff, 0 : text 0, y, files(n)
endif
else
ink 0xffffffff, 0 : text 0, y, files(n)
endif
inc y, 15
next n
select mc
case 1
if oMc = 0
if mouseOver <> -1
fileDrag = mouseOver
`CUSTOM!
obj = newObjId()
load object files(fileDrag), obj
if object exist(8000) = 1
hide object ground
pick screen mousex(),mousey(), 30
x# = get pick vector x()+camera position x()
z# = get pick vector z()+camera position z()
a# = get terrain ground height( 8000, object position x(obj), object position z(obj) )
position object obj,x#,a#,z#
else
show object ground
pick screen mousex(),mousey(), 30
x# = get pick vector x()+camera position x()
z# = get pick vector z()+camera position z()
position object obj,x#,0,z#
endif
`pick screen mousex(),mousey(), 30
`x# = get pick vector x()+camera position x()
`z# = get pick vector z()+camera position z()
`position object obj,x#,0,z#
`END CUSTOM!
endif
endif
endcase
case 2
if oMc = 0
if mx > 160
pickedObj = pick object(mx, my, 2, 65535)
if pickedObj <> 0
delete object pickedObj
endif
endif
endif
endcase
case 0
if oMc = 1
if fileDrag <> -1
if mx > 160
pickedObj = pick object(mx, my, ground, ground)
if pickedObj <> 0
x# = camera position x() + get pick vector x()
y# = camera position y() + get pick vector y()
z# = camera position z() + get pick vector z()
obj = newObjId()
`load object files(fileDrag), obj
`position object obj, x#, y#, z#
endif
else
i = my / 15
if i > numFiles-1 then i = numFiles-1
if i <> fileDrag
item$ = files(fileDrag)
if fileDrag < numFiles-1
for n = fileDrag to numFiles-2
files(n) = files(n+1)
next n
endif
minN = i : if minN < 1 then minN = 1
for n = numFiles-1 to minN step -1
files(n) = files(n-1)
next n
files(i) = item$
endif
endif
fileDrag = -1
endif
endif
endcase
endselect
if mx > 160
pickedObj = pick object(mx,my,2,65535)
if keystate(19) = 1
inc impobrot#
yrotate object pickedObj,impobrot#
ENDIF
ENDIF
if mx > 160
pickedObj = pick object(mx,my,2,65535)
if upkey() = 1
move object pickedObj,2
ENDIF
ENDIF
if mx > 160
pickedObj = pick object(mx,my,2,65535)
if downkey() = 1
move object pickedObj,-2
ENDIF
ENDIF
if mx > 160
pickedObj = pick object(mx,my,2,65535)
if leftkey() = 1
dec kinarr
position object pickedObj,object position z(pickedObj) + kinarr,0,0
ENDIF
ENDIF
if mx > 160
pickedObj = pick object(mx,my,2,65535)
if rightkey() = 1
inc kinarr
position object pickedObj,object position z(pickedObj) + kinarr,0,0
ENDIF
ENDIF
sync
loop
endfunction
function newObjId()
for n = 1 to 65535
if object exist(n) = 0 then exitfunction n
next n
endfunction 0
And your code for textures
rem mask to clear screen
get image 100,0,0,640,480
rem looking for image files....YOU CAN CHANGE EXTENCION FOR .3DS .X .DBO or whatever you need
set cursor 0,20
find first
dim arch$(100) rem maximum quantity of files in array
arch=1
repeat
if get file type()=0
arch$(arch)=get file name$()
extension$=right$(arch$(arch),4)
if extension$=".bmp" or extension$=".jpg" or extension$=".tga" or extension$=".png" or extension$=".dds"
arch=arch+1
if arch>100 then arch=100
endif
endif
find next
until get file type()=-1
for t=1 to arch-1
inc file
ink rgb(0,100,0),0
print arch$(t)," ",file rem show us the number of image files we found in folder
next t
do
ink rgb(140,140,140),0
box 200,0,400,30
ink rgb(255,255,255),0
set cursor 205,5
if mousey()>items
print arch$(mousey()/15)
endif
if mousey()>20 and mousey()<arch*15
if mouseclick()=1
load image arch$(mousey()/15),1
paste image 100,200,50 rem mask to clear screen that we capture above
paste image 1,200,50
endif
endif
sync
loop
Alex Matei CEO
www.alexmatei.com