carl
Nombre de messages : 6 Date d'inscription : 14/08/2010
| Sujet: editeur de monde 3d Dim 7 Nov 2010 - 12:58 | |
| bonjour a tous me revoici avec un nouveau programme un peu plus abouti que le précédent , il y encore pas mal de beug mais je progresse - Code:
-
error_french Dim dxx,dxy,screenh,time,camerax,cameray,cameraz,angle,rayon,souris,pointx,pointy,pointz,speed,speedcam,actor,mx,my,mx2,my2 Dim objetfile$(1000),objettex$(1000),pxobjet(1000),pyobjet(1000),pzobjet(1000),sxobjet(1000),syobjet(1000),szobjet(1000),rotxobjet(1000),rotyobjet(1000),rotzobjet(1000),objethide(1000) Dim objetmax,objet,x,objetencours,scale,a$,b$,dir$,info$,menu,b,r,s,file$,msg,posxactor,posyactor,poszactor,rotzactor,scaleactor dim chemin$,mesh,meshmax,meshtype$(1000),meshtexture$(1000),pxmesh(1000),pymesh(1000),pzmesh(1000),sxmesh(1000),symesh(1000),szmesh(1000),rxmesh(1000),rymesh(1000),rzmesh(1000),im$,t,m dim box%,terrain,terrain_on,terraintex$,u_tile,v_tile,box_on,a,n,fold,file2,folder$,g$,ir$,spx,spy,spz,spx2,spy2,spz2,f$,objliste,objliste2,obj$,soundliste,s$,snd$,play_once,numsky,pre_sky dim init,point_actor,point_objet,point_terrain,point_mesh,colmeshred(1000),colmeshgreen(1000),colmeshblue(1000),transparencemesh(1000),istexmesh(1000) dim campointx,campointy,campointz,camrotate ' ------------------------------------------------------------------------------ dxx = screen_x : dxy = screen_y : screenh = 20 : width 0,dxx : height 0,dxy : time = 5 : color 0,0,0,0 : border_hide 0 scene3d 1 : height 1,dxy : width 1,dxx : Left 1,0 : top 1,0 : full_space 1 : color 1,150,150,150 objet = 399 : objetmax = objet : speed = .2 : speedcam = .4 : cameray = 10 : terrain = 2 : u_tile = 50 : v_tile = 50 mesh= 599 : meshmax = mesh : point_actor = 1 : scaleactor = 0.01 : scale = 0.01 : dir$ = dir_current$ : dir_change "c:\panoramic3d\data" : chemin$="C:\panoramic3d\data" 3D_SKYBOX 2 : box_on = 0 ' ------------------------------------------------------------------------------ label quit,main,loadini,skybox,skybox2,events,controls,create_cube,create_sphere,create_cone,create_ligne_3d,create_cylindre,set_spin_terrain,get_spin_terrain,get_spin_camera,set_spin_camera label create_dodecahedre,create_3dactor,terrain,terrain2,terrain_texture,loadworld,saveworld,open3ds,open3ds_tex,openmd2,openmd2_tex,openmeshtexture,saveini,options,get_options,set_options label liste3d,listemd2,get_spin,set_spin,select_objet,select_mesh,delete_objet,menu3d,closemenu,param_cam,sons,skybox_preview,menumesh,set_spin_mesh,get_spin_mesh,aide ' ------------------------------------------------------------------------------ main_menu 10 sub_menu 11 : caption 11,"Fichiers" : parent 11,10 sub_menu 12 : caption 12,"Ouvrir" : parent 12,11 sub_menu 13 : caption 13,"Sauver" : parent 13,11 sub_menu 14 : caption 14,"Quitter" : parent 14,11 sub_menu 20 : caption 20,"mesh" : parent 20,10 sub_menu 21 : caption 21,"cube" : parent 21,20 sub_menu 22 : caption 22,"sphere" : parent 22,20 sub_menu 23 : caption 23,"cone" : parent 23,20 sub_menu 24 : caption 24,"ligne3d" : parent 24,20 sub_menu 25 : caption 25,"cylindre" : parent 25,20 sub_menu 26 : caption 26,"dodecahedre" : parent 26,20 sub_menu 27 : caption 27,"3d_actor" : parent 27,20 sub_menu 28 : caption 28,"3d_box" : parent 28,20 sub_menu 29 : caption 29,"3d_plane" : parent 29,20
sub_menu 30 : caption 30,"skybox" : parent 30,10 sub_menu 40 : caption 40,"terrain" : parent 40,10
button 41 : caption 41,"default" : Left 41,100 : top 41,dxy-160 : hide 41
sub_menu 50 : caption 50,"camera " : parent 50,10
sub_menu 60 : caption 60,"sons " : parent 60,10 sub_menu 70 : caption 70,"3DS liste " : parent 70,10 sub_menu 75 : caption 75,"MD2 liste " : parent 75,10 sub_menu 80 : caption 80,"3DS/MD2 menu " : parent 80,10 sub_menu 85 : caption 85,"mesh menu " : parent 85,10 sub_menu 90 : caption 90,"outils systemes " : parent 90,10 sub_menu 91 : caption 91,"task manager " : parent 91, 90 sub_menu 92 : caption 92,"Options " : parent 92,10 sub_menu 93 : caption 93,"Aide " : parent 93,10 ' ------------------------------------------------------------------------------ list 100 : Left 100,05 : top 100,10 : width 100,190 : height 100,80 : hide 100 list 101 : Left 101,05 : top 101,10 : width 101,190 : height 101,400 : hide 101 list 102 : Left 102,05 : top 102,10 : width 102,190 : height 102,400 : hide 102 list 103 : Left 103,05 : top 103,10 : width 103,190 : height 103,400 : hide 103 list 104 : Left 104,05 : top 104,10 : width 104,190 : height 104,80 : hide 104
spin 110: top 110,150: left 110, 100: width 110, 60 : hide 110 : max 110,10000 : min 110,-10000 spin 111: top 111,180: left 111, 100: width 111, 60 : hide 111 : max 111,10000 : min 111,-10000 spin 112: top 112,210: left 112, 100: width 112, 60 : hide 112 : max 112,10000 : min 112,-10000 spin 113: top 113,240: left 113, 100: width 113, 60 : hide 113 : max 113,1000 : min 113,0 spin 114: top 114,270: left 114, 100: width 114, 60 : hide 114 : max 114,1000 : min 114,0 spin 115: top 115,300: left 115, 100: width 115, 60 : hide 115 : max 115,1000 : min 115,0 spin 116: top 116,330: left 116, 100: width 116, 60 : hide 116 : max 116,360 : min 116,-360 spin 117: top 117,360: left 117, 100: width 117, 60 : hide 117 : max 117,360 : min 117,-360 spin 118: top 118,390: left 118, 100: width 118, 60 : hide 118 : max 118,360 : min 118,-360
list 130 : Left 130,05 : top 130,10 : width 130,190 : hide 130
spin 131: top 131,150: left 131, 100: width 131, 60 : hide 131 : max 131,255 : min 131,-250 spin 132: top 132,180: left 132, 100: width 132, 60 : hide 132 : max 132,255 : min 132,-250 spin 133: top 133,210: left 133, 100: width 133, 60 : hide 133 : max 133,255 : min 133,-250 spin 134: top 134,240: left 134, 100: width 134, 60 : hide 134 : max 134,255 : min 134,-250 spin 135: top 135,270: left 135, 100: width 135, 60 : hide 135 : max 135,255 : min 135,-250 spin 136: top 136,300: left 136, 100: width 136, 60 : hide 136 : max 136,255 : min 136,-250 spin 137: top 137,330: left 137, 100: width 137, 60 : hide 137 : max 137,255 : min 137,-250 spin 138: top 138,360: left 138, 100: width 138, 60 : hide 138 : max 138,255 : min 138,-250 spin 139: top 139,390: left 139, 100: width 139, 60 : hide 139 : max 139,255 : min 139,-250
spin 145 : top 145,10: left 145, 100: width 145, 60 : hide 145 : max 145,7 : min 145,0
button 146 : caption 146,"creer le box" : Left 146,100 : top 146,dxy-160 : hide 146 button 147 : caption 147,"charger le 3ds" : Left 147,100 : top 147,dxy-160 : hide 147 button 148 : caption 148,"jouer le son" : Left 148,100 : top 148,dxy-160 : hide 148 button 149 : caption 149,"charger le md2" : Left 149,100 : top 149,dxy-160 : hide 149 button 150 : caption 150,"Supprimer" : Left 150,100 : top 150,dxy-160 : hide 150 button 151 : caption 151,"texture" : Left 151,100 : top 151,dxy-190 : hide 151 button 200 : caption 200,"fermer" : Left 200,100 : top 200,dxy-120 : hide 200 button 201 : caption 201,"reset camera position 0,0,0" : Left 201,10 : top 201,20 : width 201,180 : hide 201
picture 300 : top 300,60 : left 300,70 : height 300,60 : width 300,60 : hide 300 picture 301 : top 301,120 : left 301,10 : height 301,60 : width 301,60 : hide 301 picture 302 : top 302,120 : left 302,70 : height 302,60 : width 302,60 : hide 302 picture 303 : top 303,120 : left 303,130 : height 303,60 : width 303,60 : hide 303 picture 304 : top 304,180 : left 304,70 : height 304,60 : width 304,60 : hide 304 picture 305 : top 305,240 : left 305,70 : height 305,60 : width 305,60 : hide 305
spin 310: top 310,150: left 310, 100: width 310, 60 : hide 310 : max 310,255 : min 310,-250 spin 311: top 311,180: left 311, 100: width 311, 60 : hide 311 : max 311,255 : min 311,-250 spin 312: top 312,210: left 312, 100: width 312, 60 : hide 312 : max 312,255 : min 312,-250 spin 313: top 313,240: left 313, 100: width 313, 60 : hide 313 : max 313,200 : min 313,0 spin 314: top 314,270: left 314, 100: width 314, 60 : hide 314 : max 314,200 : min 314,0 spin 315: top 315,300: left 315, 100: width 315, 60 : hide 315 : max 315,200 : min 315,0 spin 316: top 316,330: left 316, 100: width 316, 60 : hide 316 : max 316,255 : min 316,-250 spin 317: top 317,360: left 317, 100: width 317, 60 : hide 317 : max 317,255 : min 317,-250 spin 318: top 318,390: left 318, 100: width 318, 60 : hide 318 : max 318,255 : min 318,-250
button 320 : caption 320,"mesh-texture" : Left 320,100 : top 320,dxy-160 : hide 320
spin 321: top 321,420: left 321, 100: width 321, 60 : hide 321 : max 321,255 : min 321,0 spin 322: top 322,450: left 322, 100: width 322, 60 : hide 322 : max 322,255 : min 322,0 spin 323: top 323,480: left 323, 100: width 323, 60 : hide 323 : max 323,255 : min 323,0 spin 324: top 324,510: left 324, 100: width 324, 60 : hide 324 : max 324,255 : min 324,1
spin 330: top 330,150: left 330, 100: width 330, 60 : hide 330 spin 331: top 331,180: left 331, 100: width 331, 60 : hide 331 : max 331,255 : min 331,1 spin 332: top 332,210: left 332, 100: width 332, 60 : hide 332 : max 332,255 : min 332,1 spin 333: top 333,240: left 333, 100: width 333, 60 : hide 333 : max 333,200 : min 333,1
button 334 : caption 334,"texture" : Left 334,100 : top 334,280 : hide 334
spin 335: top 335,60: left 335, 100: width 335, 60 : hide 335 : max 335,100 : min 335,1 spin 340: top 340,80: left 340, 100: width 340, 60 : hide 340 : max 340,200 : min 340,1
' ------------------------------------------------------------------------------ While scancode <> 300 if init = 0 then gosub loadini gosub main end_while main: While scancode <> 300 gosub events wait time If CLICKED(14)=1 then gosub quit end_while return ' ------------------------------------------------------------------------------ quit: msg = message_confirmation_yes_no("Etes vous sur de vouloir quitter ? ") If msg = 1 Then gosub saveini : 3d_delete_all : delete 1 : terminate If msg = 0 Then Return If msg = 2 Then gosub main Return ' ------------------------------------------------------------------------------ saveini: file$ = "c:\panoramic3d\edi3D.ini" If file_exists(file$) = 1 file_open_write 350,"c:\panoramic3d\edi3D.ini" file_writeln 350,time file_writeln 350,speed file_close 350 end_if return ' ------------------------------------------------------------------------------ loadini: if dir_exists ("c:\panoramic3d") = 0 then dir_make "c:\panoramic3d" if dir_exists ("c:\panoramic3d\data") = 0 then dir_make "c:\panoramic3d\data" if dir_exists ("c:\panoramic3d\data\3ds") = 0 then dir_make "c:\panoramic3d\data\3ds" if dir_exists ("c:\panoramic3d\data\md2") = 0 then dir_make "c:\panoramic3d\data\md2" if dir_exists ("c:\panoramic3d\data\save") = 0 then dir_make "c:\panoramic3d\data\save" if dir_exists ("c:\panoramic3d\data\sfx") = 0 then dir_make "c:\panoramic3d\data\sfx" if dir_exists ("c:\panoramic3d\data\skybox") = 0 then dir_make "c:\panoramic3d\data\skybox" if dir_exists ("c:\panoramic3d\data\textures") = 0 then dir_make "c:\panoramic3d\data\textures" if dir_exists ("c:\panoramic3d\data\textures_3ds") = 0 then dir_make "c:\panoramic3d\data\textures_3ds" if dir_exists ("c:\panoramic3d\data\textures_md2") = 0 then dir_make "c:\panoramic3d\data\textures_md2" file$ = "c:\panoramic3d\edi3D.ini" If file_exists(file$) = 1 file_open_read 351,file$ file_readln 351,a$ : time = val(a$) : position 340,time file_readln 351,a$ : speed = val(a$) : position 335,speed file_close 351 init = 1 end_if If file_exists(file$) = 0 then file_open_write 351,file$ : file_close 351 return ' ------------------------------------------------------------------------------ closemenu: left 1,00 : full_space 1 hide 150 : inactive 150 hide 151 : inactive 151 hide 200 : inactive 200 hide 320 : inactive 320 hide 340 : inactive 340 hide 41 : inactive 41 hide 201 : inactive 201 for a = 100 to 104 : hide a : inactive a : next a for a = 110 to 118 : hide a : inactive a : next a for a = 145 to 149 : hide a : inactive a : next a for a = 300 to 305 : hide a : inactive a : next a for a = 310 to 318 : hide a : inactive a : next a for a = 321 to 324 : hide a : inactive a : next a for a = 330 to 335 : hide a : inactive a : next a menu = 0 point_objet = 0 point_mesh = 0 point_terrain = 0 point_actor = 1 return ' ------------------------------------------------------------------------------ aide: color 0,200,200,250 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 show 200 : active 200
font_color 0,00,190,190 print_locate 5,10 : print "Touche Z = avancer " print_locate 5,30 : print "Touche S = reculer " print_locate 5,50 : print "Touche Q = gauche " print_locate 5,70 : print "Touche D = droite " print_locate 5,90 : print "Touche A = monter" print_locate 5,110 : print "Touche E = descendre" print_locate 5,140 : print "Click droit modifie l'Axe Y" print_locate 5,160 : print "du pointage de la camera" return ' ------------------------------------------------------------------------------ events: If CLICKED(100)=1 then gosub select_objet If CLICKED(104)=1 then gosub select_mesh If CLICKED(146)=1 then gosub skybox2 If CLICKED(150)=1 then gosub delete_objet If CLICKED(151)=1 then gosub open3ds_tex If CLICKED(200)=1 then menu = 1 If CLICKED(320)=1 then gosub openmeshtexture If CLICKED(334)=1 then gosub terrain_texture If CLICKED(12)=1 then gosub loadworld If CLICKED(13)=1 then gosub saveworld If CLICKED(21)=1 then gosub create_cube If CLICKED(22)=1 then gosub create_sphere If CLICKED(23)=1 then gosub create_cone If CLICKED(24)=1 then gosub create_ligne_3d If CLICKED(25)=1 then gosub create_cylindre If CLICKED(26)=1 then gosub create_dodecahedre If CLICKED(27)=1 then gosub create_3dactor
If CLICKED(201)=1 then camerax=0 : cameray = 0 : cameraz = 0
If CLICKED(60)=1 then gosub closemenu : menu = 5 If CLICKED(70)=1 then gosub closemenu : menu = 2 If CLICKED(75)=1 then gosub closemenu : menu = 8 If CLICKED(80)=1 then gosub closemenu : menu = 3 If CLICKED(85)=1 then gosub closemenu : menu = 9 If CLICKED(50)=1 then gosub closemenu : menu = 4 If CLICKED(30)=1 then gosub closemenu : menu = 6 If CLICKED(40)=1 then gosub closemenu : menu = 7 If CLICKED(41)=1 then gosub terrain2 If CLICKED(91)=1 then execute "c:\windows\system32\taskmgr.exe" If CLICKED(92)=1 then gosub closemenu : menu = 10 If CLICKED(93)=1 then gosub closemenu : menu = 11 if menu = 1 then gosub closemenu if menu = 2 then gosub liste3d if menu = 3 then gosub menu3d if menu = 4 then gosub param_cam if menu = 5 then gosub sons if menu = 6 then gosub skybox if menu = 7 then gosub terrain if menu = 8 then gosub listemd2 if menu = 9 then gosub menumesh if menu = 10 then gosub options if menu = 11 then gosub aide if pre_sky <> position(145) then gosub skybox_preview gosub controls return ' ------------------------------------------------------------------------------ create_cube: meshmax = meshmax + 1 mesh = meshmax 3d_cube mesh,1.2 3d_x_position mesh,posxactor 3d_y_position mesh,posyactor 3d_z_position mesh,poszactor meshtype$(mesh) = "cube" item_add 104,mesh point_mesh = 1 return ' ------------------------------------------------------------------------------ create_sphere: meshmax = meshmax + 1 mesh = meshmax 3d_sphere mesh,1.2 3d_x_position mesh,posxactor + 10 3d_y_position mesh,posyactor 3d_z_position mesh,poszactor item_add 104,mesh meshtype$(mesh) = "sphere" point_mesh = 1 return ' ------------------------------------------------------------------------------ create_cone: meshmax = meshmax + 1 mesh = meshmax 3d_cone mesh,1.5,1.1 3d_x_position mesh,posxactor +10 3d_y_position mesh,posyactor 3d_z_position mesh,poszactor item_add 104,mesh meshtype$(mesh) = "cone" point_mesh = 1 return ' ------------------------------------------------------------------------------ create_ligne_3d: meshmax = meshmax + 1 mesh = meshmax 3d_line mesh,0,0,0 3d_line mesh,1,0,0 3d_x_position mesh,posxactor +10 3d_y_position mesh,posyactor 3d_z_position mesh,poszactor item_add 104,mesh meshtype$(mesh) = "ligne3d" point_mesh = 1 return ' ------------------------------------------------------------------------------ create_cylindre: meshmax = meshmax + 1 mesh = meshmax 3d_cylinder mesh,1.5,1.5,1.5 3d_x_position mesh,posxactor + 10 3d_y_position mesh,posyactor 3d_z_position mesh,poszactor item_add 104,mesh meshtype$(mesh) = "cylindre" point_mesh = 1 return ' ------------------------------------------------------------------------------ create_dodecahedre: meshmax = meshmax + 1 mesh = meshmax 3d_dodecahedron mesh 3d_x_position mesh,posxactor + 10 3d_y_position mesh,posyactor 3d_z_position mesh,poszactor item_add 104,mesh meshtype$(mesh) = "dodecahedre" point_mesh = 1 return ' ------------------------------------------------------------------------------ create_3dactor: actor = 0 3d_delete 5 open_dialog 352 filter 352,"fichiers 3ds|*.3ds|md2|*.md2" b$=file_name$(352) If Right$(b$,3) = "3ds" Or Right$(b$,3) ="md2" 3d_actor 5 3d_load_object 5,upper$(b$) If Right$(b$,3) = "3ds" folder$ = chemin$ +"textures_3ds" dir_change folder$ file2 =len(b$) g$ = left$(b$,file2-3) if file_exists(folder$ +""+g$ +"jpg") = 1 then 3d_load_texture 5,upper$(folder$ +""+g$ +"jpg") if file_exists(folder$ +""+g$ +"bmp") = 1 then 3d_load_texture 5,upper$(folder$ +""+g$ +"bmp") end_if If Right$(b$,3) = "md2" folder$ = chemin$ +"textures_md2" dir_change folder$ file2 =len(b$) g$ = left$(b$,file2-3) if file_exists(folder$ +""+g$ +"jpg") = 1 then 3d_load_texture 5,upper$(folder$ +""+g$ +"jpg") if file_exists(folder$ +""+g$ +"bmp") = 1 then 3d_load_texture 5,upper$(folder$ +""+g$ +"bmp") end_if scaleactor = 0.1 actor = 1 b$ = "" Delete 352 end_if if actor = 0 then 3d_actor 5 return ' ------------------------------------------------------------------------------ options: color 0,150,170,190 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 show 200 : show 340 active 200 : active 340 print_locate 7, 85 : print "Wait =" gosub get_options return ' ------------------------------------------------------------------------------ get_options: time = position (340) if time < 1 then time = 1 return ' ------------------------------------------------------------------------------ set_options: if time < 1 then time = 1 position 340,time return ' ------------------------------------------------------------------------------ param_cam: color 0,150,170,150 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 show 200 : show 201 : show 335 active 200 : active 201 : active 335 print_locate 7, 60 : print "vitesse =" print_locate 5,240 : print "camera X = " + str$(camerax) print_locate 5,270 : print "camera Y = " + str$(cameray) print_locate 5,300 : print "camera Z = " + str$(cameraz) print_locate 5,330 : print "point x = " + str$(campointx) print_locate 5,360 : print "point y = " + str$(campointy) print_locate 5,390 : print "point z = " + str$(campointz) gosub get_spin_camera return ' ------------------------------------------------------------------------------ set_spin_camera: position 335,speed return ' ------------------------------------------------------------------------------ get_spin_camera: speed = position (335) return ' ------------------------------------------------------------------------------ sons: color 0,220,220,10 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 show 200 : show 102 :show 148 active 200 : active 102 : active 148 if soundliste = 0 dir_change chemin$ +"sfx" s$ = file_find_first$ If Right$(s$,3) = "wav" or Right$(s$,3) = "WAV" or Right$(s$,3) = "mp3" or Right$(s$,3) = "MP3" then item_add 102,s$ while s$<>"_" s$ = file_find_next$ if Right$(s$,3) = "wav" or Right$(s$,3) = "WAV" or Right$(s$,3) = "mp3" or Right$(s$,3) = "MP3" then item_add 102,s$ end_while file_find_close soundliste = 1 end_if If CLICKED(148)=1 snd$ = item_index$(102) dir_change chemin$ +"sfx" sound 6 file_load 6,upper$(snd$) play_wait 6 delete 6 end_if dir_change chemin$ return ' ----------------------------------------------------------------------------- delete_objet: ir$ = item_index$(100) if objet >= 400 objet = ir$ item_delete 100,item_index$(100) if objet >= 400 : 3d_hide objet : objethide(objet) = 1 : end_if end_if return ' ------------------------------------------------------------------------------ menu3d: color 0,60,200,200 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 font_color 0,00,00,0 if ir$ <> str$(objet) then cls print_locate 5,100 : print "objet selectionné : " + ir$ print_locate 5,120 : print objetfile$(objet) print_locate 5,150 : print "position X =" print_locate 5,180 : print "position y =" print_locate 5,210 : print "position z =" print_locate 5,240 : print "taille x =" print_locate 5,270 : print "taille y =" print_locate 5,300 : print "taille z =" print_locate 5,330 : print "rotation x =" print_locate 5,360 : print "rotation y =" print_locate 5,390 : print "rotation z =" show 100 : show 200 : show 150 : show 151 active 100 : active 200 : active 150 : active 151 for a = 110 to 118 : show a : active a : next a if ir$ <>"" then gosub get_spin point_terrain = 0 point_objet = 1 point_actor = 0 point_mesh = 0 return ' ------------------------------------------------------------------------------ menumesh: color 0,60,150,200 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 font_color 0,100,00,0 for a = 310 to 318 : show a : active a : next a for a = 321 to 323 : show a : active a : next a show 324 : active 324
show 104 : show 200 : show 320 active 104 : active 200 : active 320 if str$(mesh) <> im$ then cls print_locate 5,130 : print "mesh selectionné = " + meshtype$(mesh)+" "+im$ print_locate 5, 150 : print "position X =" print_locate 5, 180 : print "position Y =" print_locate 5, 210 : print "position Z =" print_locate 5, 240 : print "taille X =" print_locate 5, 270 : print "taille Y =" print_locate 5, 300 : print "taille Z =" print_locate 5, 330 : print "rotation X =" print_locate 5, 360 : print "rotation Y =" print_locate 5, 390 : print "rotation Z ="
if istexmesh(mesh) = 0
print_locate 5, 420 : print "rouge = " print_locate 5, 450 : print "vert = " print_locate 5, 480 : print "bleu = "
end_if
print_locate 5, 510 : print "transparence = "
if mesh >= 600 then gosub get_spin_mesh point_terrain = 0 point_objet = 0 point_actor = 0 point_mesh = 1 return ' ------------------------------------------------------------------------------ liste3d: color 0,200,20,200 font_color 0,00,00,100 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 show 101 : show 147 : show 200 active 101 : active 147 : active 200 if objliste = 0 dir_change chemin$ +"3ds" f$ = file_find_first$ If Right$(f$,3) = "3ds" or Right$(f$,3) = "3DS" then item_add 101,f$ while f$<>"_" f$ = file_find_next$ if Right$(f$,3) = "3ds" or Right$(f$,3) = "3DS" then item_add 101,f$ end_while file_find_close objliste = 1 end_if dir_change chemin$ If CLICKED(147)=1 b$ = item_index$(101) dir_change chemin$ +"3ds" If Right$(b$,3) = "3ds" Or Right$(b$,3) ="3DS" objet = objet + 1 objetfile$(objet) = chemin$ + "3ds" + b$ pxobjet(objet)=camerax pyobjet(objet)=cameray pzobjet(objet)=cameraz sxobjet(objet)=scale syobjet(objet)=scale szobjet(objet)=scale 3d_mesh (objet) 3d_load_object objet,b$ folder$ = chemin$ +"textures_3ds" dir_change folder$ file2 =len(b$) g$ = left$(b$,file2-3) if file_exists(folder$ +""+g$ +"jpg") = 1 then 3d_load_texture objet,upper$(folder$ +""+g$ +"jpg") : objettex$(objet) = folder$ +""+g$ +"jpg" if file_exists(folder$ +""+g$ +"bmp") = 1 then 3d_load_texture objet,upper$(folder$ +""+g$ +"bmp") : objettex$(objet) = folder$ +""+g$ +"bmp" 3d_x_scale objet,sxobjet(objet) 3d_y_scale objet,syobjet(objet) 3d_z_scale objet,szobjet(objet) 3d_x_position objet,pxobjet(objet) 3d_y_position objet,pyobjet(objet) 3d_z_position objet,pzobjet(objet) 3d_x_rotate objet,rotxobjet(objet) 3d_y_rotate objet,rotyobjet(objet) 3d_z_rotate objet,rotzobjet(objet) end_if objetmax = objet item_add 100,objet b$ = "" end_if dir_change chemin$ return ' ------------------------------------------------------------------------------ listemd2: color 0,100,20,200 font_color 0,00,00,100 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 show 103 : show 149 : show 200 active 103 : active 149 : active 200 if objliste2 = 0 dir_change chemin$ +"md2" f$ = file_find_first$ If Right$(f$,3) = "md2" or Right$(f$,3) = "MD2" then item_add 103,f$ while f$<>"_" f$ = file_find_next$ if Right$(f$,3) = "md2" or Right$(f$,3) = "MD2" then item_add 103,f$ end_while file_find_close objliste2 = 1 end_if If CLICKED(149)=1 b$ = item_index$(103) dir_change chemin$ +"md2" If Right$(b$,3) = "md2" Or Right$(b$,3) ="MD2" objet = objet + 1 objetfile$(objet) = chemin$ + "MD2" + b$ pxobjet(objet)=camerax pyobjet(objet)=cameray pzobjet(objet)=cameraz sxobjet(objet)=scale syobjet(objet)=scale szobjet(objet)=scale 3d_mesh (objet) 3d_load_object objet,b$ folder$ = chemin$ +"textures_md2" dir_change folder$ file2 =len(b$) g$ = left$(b$,file2-3) if file_exists(folder$ +""+g$ +"jpg") = 1 then 3d_load_texture objet,upper$(folder$ +""+g$ +"jpg") : objettex$(objet) = folder$ +""+g$ +"jpg" if file_exists(folder$ +""+g$ +"bmp") = 1 then 3d_load_texture objet,upper$(folder$ +""+g$ +"bmp") : objettex$(objet) = folder$ +""+g$ +"bmp" 3d_x_scale objet,sxobjet(objet) 3d_y_scale objet,syobjet(objet) 3d_z_scale objet,szobjet(objet) 3d_x_position objet,pxobjet(objet) 3d_y_position objet,pyobjet(objet) 3d_z_position objet,pzobjet(objet) 3d_x_rotate objet,rotxobjet(objet) 3d_y_rotate objet,rotyobjet(objet) 3d_z_rotate objet,rotzobjet(objet) end_if objetmax = objet item_add 100,objet end_if dir_change chemin$ return ' ------------------------------------------------------------------------------ skybox: color 0,120,120,200 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 for a = 300 to 305 : show a : active a : next a : show 200 : show 145 : show 146 : active 200 : active 145 : active 146 Return ' ------------------------------------------------------------------------------ skybox2: if numsky <> position(145) then numsky = position(145) if numsky >= 0 if file_exists(chemin$+"skybox\sky"+str$(numsky)+"\SKY_up.jpg") = 1 then 3D_LOAD_TEXTURE_TOP 2,chemin$+"skybox\sky"+str$(numsky)+"\SKY_up.jpg" if file_exists(chemin$+"skybox\sky"+str$(numsky)+"\SKY_north.jpg") = 1 then 3D_LOAD_TEXTURE_LEFT 2,chemin$+"skybox\sky"+str$(numsky)+"\SKY_north.jpg" if file_exists(chemin$+"skybox\sky"+str$(numsky)+"\SKY_west.jpg") = 1 then 3D_LOAD_TEXTURE_BACK 2,chemin$+"skybox\sky"+str$(numsky)+"\SKY_west.jpg" if file_exists(chemin$+"skybox\sky"+str$(numsky)+"\SKY_east.jpg") = 1 then 3D_LOAD_TEXTURE_FRONT 2,chemin$+"skybox\sky"+str$(numsky)+"\SKY_east.jpg" if file_exists(chemin$+"skybox\sky"+str$(numsky)+"\SKY_south.jpg") = 1 then 3D_LOAD_TEXTURE_RIGHT 2,chemin$+"skybox\sky"+str$(numsky)+"\SKY_south.jpg" if file_exists(chemin$+"skybox\sky"+str$(numsky)+"\SKY_down.jpg") = 1 then 3D_LOAD_TEXTURE_BOTTOM 2,chemin$+"skybox\sky"+str$(numsky)+"\SKY_down.jpg" box_on = 1 end_if dir_change chemin$ return ' ------------------------------------------------------------------------------ skybox_preview: pre_sky = position(145) if file_exists(chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_up.jpg") = 1 then file_load 300,chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_up.jpg" if file_exists(chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_north.jpg") = 1 then file_load 301,chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_north.jpg" if file_exists(chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_west.jpg") = 1 then file_load 302,chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_west.jpg" if file_exists(chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_east.jpg") = 1 then file_load 303,chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_east.jpg" if file_exists(chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_south.jpg") = 1 then file_load 304,chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_south.jpg" if file_exists(chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_down.jpg") = 1 then file_load 305,chemin$+"skybox\sky"+str$(pre_sky)+"\SKY_down.jpg" return ' ------------------------------------------------------------------------------ terrain: color 0,120,220,120 height 1,dxy-screenh : width 1,dxx-200 : left 1,200 : top 1,0 for a = 330 to 334 : show a : active a : next a show 41 : show 200 : active 41 : active 200 print_locate 5, 150 : print "hauteur =" print_locate 5, 180 : print "U_tile =" print_locate 5, 210 : print "V_tile =" print_locate 5, 240 : print "taille =" gosub get_spin_terrain point_terrain = 1 point_objet = 0 point_actor = 0 point_mesh = 0 return ' ------------------------------------------------------------------------------ set_spin_terrain: if terrain_on = 1 position 330,o3d_y_position(3) position 331,u_tile position 332,v_tile position 333,o3d_y_scale(3) end_if return ' ------------------------------------------------------------------------------ get_spin_terrain: if terrain_on = 1 3d_y_position 3, position(330) u_tile = position(331) v_tile = position(332) 3D_U_TILE 3,u_tile 3D_V_TILE 3,v_tile 3d_x_scale 3, position(333) 3d_y_scale 3, position(333) 3d_z_scale 3, position(333) end_if return ' ------------------------------------------------------------------------------ terrain2: if terrain_on = 0 then 3d_plane 3 3D_show 3 3d_x_position 3,camerax 3d_y_position 3,position(330) 3d_z_position 3,cameraz 3d_x_scale 3,20 3d_y_scale 3,20 3d_z_scale 3,20 3d_x_rotate 3,90 terraintex$ = upper$(chemin$+"textures\grass.jpg") if file_exists (terraintex$) = 1 then 3d_load_texture 3,terraintex$ 3D_U_TILE 3,u_tile 3D_V_TILE 3,v_tile terrain_on = 1 gosub set_spin_terrain return ' ------------------------------------------------------------------------------ terrain_texture: open_dialog 355 dir_change chemin$ +"textures" filter 355,"fichiers jpg|*.jpg|bmp|*.bmp" b$=file_name$(355) If Right$(b$,3) = "bmp" or Right$(b$,3) ="BMP" or Right$(b$,3) ="jpg" or Right$(b$,3) ="JPG" folder$ = dir_current$ file2 =len(b$) fold = len(folder$) n =file2-fold g$ = right$(b$,n-1) if file_exists(folder$ +""+g$) = 1 then 3d_load_texture 2,folder$ +""+upper$(g$) terraintex$ = folder$ +""+upper$(g$) end_if b$ = "" g$ = "" Delete 355 return ' ------------------------------------------------------------------------------ controls: if scancode = 65 then cameray = cameray + (cos(camrotate*3.1415/180))/(speed*4) if scancode = 69 then cameray = cameray - (cos(camrotate*3.1415/180))/(speed*4) if scancode = 90 : cameraz = cameraz + (sin(camrotate*3.1415/180))/speed : camerax = camerax + (cos(camrotate*3.1415/180))/speed : end_if if scancode = 83 : cameraz = cameraz - (sin(camrotate*3.1415/180))/speed : camerax = camerax - (cos(camrotate*3.1415/180))/speed : end_if if scancode = 68 camrotate = camrotate + 1 if camrotate > 360 then camrotate = 0 end_if if scancode = 81 camrotate = camrotate - 1 if camrotate < 0 then camrotate = 360 end_if campointx = camerax+cos(camrotate*3.1415/180) campointz = cameraz+sin(camrotate*3.1415/180) cam_position camerax,cameray,cameraz if point_actor = 1 then point_position campointx,campointy,campointz if objetmax >= 400 if point_objet = 1 then point_position o3d_x_position(objet), o3d_y_position(objet),o3d_z_position(objet) end_if if meshmax >= 600 if point_mesh = 1 then point_position o3d_x_position(mesh), o3d_y_position(mesh),o3d_z_position(mesh) end_if if terrain_on = 1 if point_terrain = 1 then point_position o3d_x_position(3), o3d_y_position(3),o3d_z_position(3) end_if if mouse_right_down(1)=1 : souris = 1 : end_if if mouse_right_up(1)=1 : souris = 0 : end_if if souris = 1 if mouse_y_position(1) < dxy/4 then campointy = campointy + .01 if mouse_y_position(1) > dxy/2 then campointy = campointy - .01 end_if return ' ------------------------------------------------------------------------------ loadworld: clear 100 clear 104 objetmax = 400 objet = 400 mesh = 600 meshmax = 600 3d_delete_all dir_change chemin$ + "save" open_dialog 360 filter 360,"fichiers world|*.world" b$=file_name$(360) If Right$(b$,5) = "world" file$ = b$ If file_exists(file$) = 1 file_open_read 361,file$ file_readln 361,a$ : ' ciel file_readln 361,a$ : if a$ = "1" then box_on = 1 : if a$ ="" then end file_readln 361,a$ : numsky = val(a$) : position 145,numsky : if box_on = 1 then gosub skybox2 file_readln 361,a$ : ' terrain file_readln 361,a$ : if a$ = "1" then gosub terrain2 file_readln 361,a$ : terraintex$ = upper$(a$) : if a$ <> "" then 3d_load_texture 2,terraintex$ file_readln 361,a$ : position 330,val(a$) file_readln 361,a$ : position 331,val(a$) file_readln 361,a$ : position 332,val(a$) file_readln 361,a$ : position 333,val(a$) file_readln 361,a$ : ' camera file_readln 361,a$ : camerax = val(a$) file_readln 361,a$ : cameray = val(a$) file_readln 361,a$ : cameraz = val(a$) file_readln 361,a$ : ' "[nombre d'objet3d]" file_close 361 file_open_read 361,file$ repeat file_readln 361,a$ until a$ = "[nombre d'objet3d]" file_readln 361,a$ : objetmax = val(a$) If objetmax >= 400 For x = 400 To objetmax 3d_mesh x file_readln 361,a$ file_readln 361,a$ : objetfile$(x) = a$ : if file_exists (a$) = 1 then 3d_load_object x,objetfile$(x) file_readln 361,a$ : objettex$(x) = upper$(a$) : if a$ <> "" then 3d_load_texture x,objettex$(x) file_readln 361,a$ : ' "[position x,y,z]" file_readln 361,a$ : pxobjet(x)=a$ : 3d_x_position x,pxobjet(x) file_readln 361,a$ : pyobjet(x)=a$ : 3d_y_position x,pyobjet(x) file_readln 361,a$ : pzobjet(x)=a$ : 3d_z_position x,pzobjet(x) file_readln 361,a$ : ' "[taille x,y,z]" file_readln 361,a$ : sxobjet(x)=a$ : 3d_x_scale x,sxobjet(x) file_readln 361,a$ : syobjet(x)=a$ : 3d_y_scale x,syobjet(x) file_readln 361,a$ : szobjet(x)=a$ : 3d_z_scale x,szobjet(x) file_readln 361,a$ : ' "[rotation x,y,z]" file_readln 361,a$ : rotxobjet(x)=a$ : 3d_x_rotate x,rotxobjet(x) file_readln 361,a$ : rotyobjet(x)=a$ : 3d_y_rotate x,rotyobjet(x) file_readln 361,a$ : rotzobjet(x)=a$ : 3d_z_rotate x,rotzobjet(x) item_add 100,x objet = x gosub set_spin Next x end_if file_close 361 file_open_read 361,file$ repeat file_readln 361,a$ until a$ = "[fin objet 3D]" file_readln 361,a$ : ' [mesh] file_readln 361,a$ : meshmax = val(a$) if meshmax >= 600 for t = 600 to meshmax file_readln 361,a$ file_readln 361,a$ meshtype$(t) = a$ if meshtype$(t) = "cube" then 3d_cube t,1.2 if meshtype$(t) = "sphere" then 3d_sphere t,1.2 if meshtype$(t) = "cone" then 3d_cone t,1.5,1.1 if meshtype$(t) = "ligne3d" then 3d_line t,1,0,0 if meshtype$(t) = "cylindre" then 3d_cylinder t,1.5,1.5,1.5 if meshtype$(t) = "dodecahedre" then 3d_dodecahedron t item_add 104,t file_readln 361,a$ meshtexture$(t) = upper$(a$) if a$ <> "" then 3d_load_texture t,meshtexture$(t) file_readln 361,a$ file_readln 361,a$ : pxmesh(t)=a$ : 3d_x_position t,pxmesh(t) file_readln 361,a$ : pymesh(t)=a$ : 3d_y_position t,pymesh(t) file_readln 361,a$ : pzmesh(t)=a$ : 3d_z_position t,pzmesh(t) file_readln 361,a$ file_readln 361,a$ : sxmesh(t)=a$ : 3d_x_scale t,sxmesh(t) file_readln 361,a$ : symesh(t)=a$ : 3d_y_scale t,symesh(t) file_readln 361,a$ : szmesh(t)=a$ : 3d_z_scale t,szmesh(t) file_readln 361,a$ file_readln 361,a$ : rxmesh(t)=a$ : 3d_x_rotate t,rxmesh(t) file_readln 361,a$ : rymesh(t)=a$ : 3d_y_rotate t,rymesh(t) file_readln 361,a$ : rzmesh(t)=a$ : 3d_z_rotate t,rzmesh(t) file_readln 361,a$ file_readln 361,a$ : istexmesh(t) = val(a$) file_readln 361,a$ : colmeshred(t) = val(a$) file_readln 361,a$ : colmeshgreen(t) = val(a$) file_readln 361,a$ : colmeshblue(t) = val(a$) if istexmesh(t) = 0 then 3d_color t,colmeshred(t),colmeshgreen(t),colmeshblue(t) file_readln 361,a$ : transparencemesh(t) = val(a$) 3d_transparent t,transparencemesh(t) mesh = t next t gosub set_spin_mesh end_if file_readln 361,a$ file_close 361 end_if end_if b$ = "" Delete 360 dir_change chemin$ Return ' ------------------------------------------------------------------------------ saveworld: dir_change chemin$ + "save" save_dialog 365 filter 365,"fichiers world|*.world" b$=file_name$(365) file$ = b$ If Right$(b$,5) <> "world" then file$ = file$ + ".world" file_open_write 366,file$ file_writeln 366,"[ciel]" file_writeln 366,box_on file_writeln 366,numsky file_writeln 366,"[terrain]" file_writeln 366,terrain_on file_writeln 366,terraintex$ file_writeln 366,position(330) file_writeln 366,position(331) file_writeln 366,position(332) file_writeln 366,position(333) file_writeln 366,"[camera]" file_writeln 366,posxactor file_writeln 366,posyactor file_writeln 366,poszactor file_writeln 366,"[nombre d'objet3d]" If objetmax >= 400 file_writeln 366,objetmax For x = 400 To objetmax If objetfile$(x)="" : Return : end_if file_writeln 366,"[objet n° " + str$(x)+"]" file_writeln 366,objetfile$(x) file_writeln 366,objettex$(x) file_writeln 366,"[position x,y,z]" file_writeln 366,o3d_x_position(x) file_writeln 366,o3d_y_position(x) file_writeln 366,o3d_z_position(x) file_writeln 366,"[taille x,y,z]" file_writeln 366,o3d_x_scale(x) file_writeln 366,o3d_y_scale(x) file_writeln 366,o3d_z_scale(x) file_writeln 366,"[rotation x,y,z]" file_writeln 366,o3d_x_rotate(x) file_writeln 366,o3d_y_rotate(x) file_writeln 366,o3d_z_rotate(x) Next x else file_writeln 366,objetmax end_if file_writeln 366,"[fin objet 3D]" file_writeln 366,"[mesh]" if meshmax >= 600 file_writeln 366,meshmax for t = 600 to meshmax file_writeln 366,"[mesh n° " + str$(t)+"]" file_writeln 366,meshtype$(t) file_writeln 366,meshtexture$(t) file_writeln 366,"[position x,y,z]" file_writeln 366,o3d_x_position(t) file_writeln 366,o3d_y_position(t) file_writeln 366,o3d_z_position(t) file_writeln 366,"[taille x,y,z]" file_writeln 366,o3d_x_scale(t) file_writeln 366,o3d_y_scale(t) file_writeln 366,o3d_z_scale(t) file_writeln 366,"[rotation x,y,z]" file_writeln 366,o3d_x_rotate(t) file_writeln 366,o3d_y_rotate(t) file_writeln 366,o3d_z_rotate(t) file_writeln 366,"[color]" file_writeln 366,istexmesh(t) file_writeln 366,colmeshred(t) file_writeln 366,colmeshgreen(t) file_writeln 366,colmeshblue(t) file_writeln 366,transparencemesh(t) next t file_writeln 366,"[fin mesh]" else file_writeln 366,meshmax file_writeln 366,"[fin mesh]" end_if file_writeln 366,date$ + " " + time$ file_close 366 b$ = "" Delete 365 Return ' ------------------------------------------------------------------------------ open3ds: dir_change chemin$ +"3ds" open_dialog 367 filter 367,"fichiers 3ds|*.3ds" b$=file_name$(367) If Right$(b$,3) = "3ds" Or Right$(b$,3) ="3DS" objet = objet + 1 objetfile$(objet) = b$ pxobjet(objet)=camerax pyobjet(objet)=cameray pzobjet(objet)=cameraz sxobjet(objet)=scale syobjet(objet)=scale szobjet(objet)=scale 3d_mesh (objet) 3d_load_object objet,objetfile$(objet) gosub open3ds_tex 3d_x_scale objet,sxobjet(objet) 3d_y_scale objet,syobjet(objet) 3d_z_scale objet,szobjet(objet) 3d_x_position objet,pxobjet(objet) 3d_y_position objet,pyobjet(objet) 3d_z_position objet,pzobjet(objet) 3d_x_rotate objet,rotxobjet(objet) 3d_y_rotate objet,rotyobjet(objet) 3d_z_rotate objet,rotzobjet(objet) end_if objetmax = objet item_add 100,objet b$ = "" Delete 367 Return ' ------------------------------------------------------------------------------ open3ds_tex: dir_change chemin$ + "textures_3ds" if objet >= 400 open_dialog 368 filter 368,"fichiers jpg|*.jpg|bmp|*.bmp" b$=file_name$(368) If Right$(b$,3) = "bmp" or Right$(b$,3) ="BMP" or Right$(b$,3) ="jpg" or Right$(b$,3) ="JPG" folder$ = dir_current$ file2 =len(b$) fold = len(folder$) n =file2-fold g$ = right$(b$,n-1) if file_exists(folder$ +""+g$) = 1 then 3d_load_texture objet,folder$ +""+upper$(g$) objettex$(objet) = folder$ +""+g$ end_if b$ = "" Delete 368 end_if return ' ------------------------------------------------------------------------------ openmd2: open_dialog 369 filter 369,"fichiers md2|*.md2" b$=file_name$(369) If Right$(b$,3) ="md2" Or Right$(b$,3) ="MD2" objet = objet + 1 objetfile$(objet) = b$ pxobjet(objet)=camerax pyobjet(objet)=cameray pzobjet(objet)=cameraz sxobjet(objet)=scale syobjet(objet)=scale szobjet(objet)=scale 3d_mesh (objet) 3d_load_object objet,objetfile$(objet) gosub openmd2_tex 3d_x_scale objet,sxobjet(objet) 3d_y_scale objet,syobjet(objet) 3d_z_scale objet,szobjet(objet) 3d_x_position objet,pxobjet(objet) 3d_y_position objet,pyobjet(objet) 3d_z_position objet,pzobjet(objet) 3d_x_rotate objet,rotxobjet(objet) 3d_y_rotate objet,rotyobjet(objet) 3d_z_rotate objet,rotzobjet(objet) end_if objetmax = objet item_add 100,objet b$ = "" Delete 369 Return ' ------------------------------------------------------------------------------ openmd2_tex: if objet >= 400 open_dialog 370 filter 370,"fichiers jpg|*.jpg|bmp|*.bmp" b$=file_name$(370) If Right$(b$,3) = "bmp" or Right$(b$,3) ="BMP" or Right$(b$,3) ="jpg" or Right$(b$,3) ="JPG" folder$ = dir_current$ file2 =len(b$) fold = len(folder$) n =file2-fold g$ = right$(b$,n-1) if file_exists(folder$ +""+g$) = 1 then 3d_load_texture objet,folder$ +""+upper$(g$) objettex$(objet) = folder$ +""+g$ end_if b$ = "" Delete 370 end_if return ' ------------------------------------------------------------------------------ set_spin: if objet >= 400 position 110,o3d_x_position(objet) position 111,o3d_y_position(objet) position 112,o3d_z_position(objet) position 113,o3d_x_scale(objet)*100 position 114,o3d_y_scale(objet)*100 position 115,o3d_z_scale(objet)*100 position 116,o3d_x_rotate(objet) position 117,o3d_y_rotate(objet) position 118,o3d_z_rotate(objet) end_if return ' ------------------------------------------------------------------------------ get_spin: if objet >=400 3d_x_position objet, position(110) : 3d_y_position objet, position(111) : 3d_z_position objet, position(112) spx = position(113)/100 if spx < 0.1 then spx = 0.1 spy = position(114)/100 if spy < 0.1 then spy = 0.1 spz = position(115)/100 if spz < 0.1 then spz = 0.1 3d_x_scale objet, spx : 3d_y_scale objet, spy : 3d_z_scale objet, spz 3d_x_rotate objet, position(116) : 3d_y_rotate objet, position(117) : 3d_z_rotate objet, position(118) end_if return ' ------------------------------------------------------------------------------ select_objet: ir$ = item_index$(100) objet = ir$ gosub set_spin return ' ------------------------------------------------------------------------------ select_mesh: im$ = item_index$(104) mesh = im$ gosub set_spin_mesh return ' ------------------------------------------------------------------------------ set_spin_mesh: if meshmax >= 600 position 310,o3d_x_position(mesh) position 311,o3d_y_position(mesh) position 312,o3d_z_position(mesh) position 313,o3d_x_scale(mesh) position 314,o3d_y_scale(mesh) position 315,o3d_z_scale(mesh) position 316,o3d_x_rotate(mesh) position 317,o3d_y_rotate(mesh) position 318,o3d_z_rotate(mesh) position 321,colmeshred(mesh) position 322,colmeshgreen(mesh) position 323,colmeshblue(mesh) position 324,transparencemesh(mesh) end_if return ' ------------------------------------------------------------------------------ get_spin_mesh: if meshmax >= 600 3d_x_position mesh, position(310) 3d_y_position mesh, position(311) 3d_z_position mesh, position(312) spx2 = position(313) if spx2 < 0.1 then spx2 = 0.1 spy2 = position(314) if spy2 < 0.1 then spy2 = 0.1 spz2 = position(315) if spz2 < 0.1 then spz2 = 0.1 3d_x_scale mesh, spx2 3d_y_scale mesh, spy2 3d_z_scale mesh, spz2 3d_x_rotate mesh, position(316) 3d_y_rotate mesh, position(317) 3d_z_rotate mesh, position(318)
if position(321) > 255 then return if position(322) > 255 then return if position(323) > 255 then return
colmeshred(mesh) = position(321) colmeshgreen(mesh) = position(322) transparencemesh(mesh) = position(323)
if istexmesh(mesh) = 0 then 3d_color mesh,position(321),position(322),position(323) if position(324) > 255 then return 3d_transparent mesh,position(324) transparencemesh(mesh) = position(324) end_if return ' ------------------------------------------------------------------------------ openmeshtexture: if meshmax >= 600 if meshtype$(mesh) = "ligne3d" then return open_dialog 371 filter 371,"fichiers jpg|*.jpg|bmp|*.bmp" b$=file_name$(371) If Right$(b$,3) = "bmp" or Right$(b$,3) ="BMP" or Right$(b$,3) ="jpg" or Right$(b$,3) ="JPG" folder$ = dir_current$ file2 =len(b$) fold = len(folder$) n =file2-fold g$ = right$(b$,n-1) if file_exists(folder$ +""+g$) = 1 then 3d_load_texture mesh,folder$ +""+upper$(g$) meshtexture$(mesh) = folder$ +""+g$ istexmesh(mesh) = 1 end_if b$ = "" Delete 371 end_if return ' ------------------------------------------------------------------------------
| |
|