Marc
Nombre de messages : 2466 Age : 63 Localisation : TOURS (37) Date d'inscription : 17/03/2014
| Sujet: Roue à n faces Dim 15 Juil 2018 - 22:16 | |
| Bonjour à tous ! Voici une autre sorte de roue 3D qui peut servir de base de travail. Le nombre de faces est configurable de 2 à 24 => ligne 9. Vous pouvez ajuster le zoom => ligne 11. Chaque face est un 3D_PLANE personnalisable par dessin avec les commandes 2D... ou habillable avec un fichier externe .BMP : dans ce cas, il y a lieu d'utiliser la commande 3D_LOAD_TEXTURE au lieu des 3D_IMAGE_TEXTURE.Même avec 24 objets 3D à déplacer simultanément, la vélocité et la fluidité restent excellente. - Code:
-
' ------------------------------------------------------------------------------ ' PANORAMIC 3D Roue n Faces/ 3D n-sided Wheel ' Marc - July 2018 - Panoramic v.0.9.28 ' http://panoramic-language.pagesperso-orange.fr/French/index.html ' http://panoramic.top-forum.net ' ------------------------------------------------------------------------------ ' main Init() Faces(24) :' <<<<<<-------------------------------------<<<< 2 à 24 faces Instructions() CAM_MOVE -70 :' <<<<<<<<--------------------------------<<<< Zoom ON_MOUSE_MOVE 100,Move END ' ------------------------------------------------------------------------------ SUB Init() LABEL Move,Quit DEGREES DIM Nb%,i%,Teta,y,z HEIGHT 0,540 + HEIGHT(0)-HEIGHT_CLIENT(0) WIDTH 0,500 + WIDTH(0)-WIDTH_CLIENT(0) LEFT 0,(screen_x-WIDTH(0))/2 TOP 0,(screen_y-HEIGHT(0))/2 COLOR 0,0,0,0 PICTURE 1 WIDTH 1,200 HEIGHT 1,200 ON_CLOSE 0, Quit END_SUB ' ------------------------------------------------------------------------------ SUB Faces(n%) DIM_LOCAL i% Nb%=n% y=0 z=5/tan(360/n%/2) Teta=360/n% SCENE3D 100 HEIGHT 100,500 WIDTH 100,500 COLOR 100,0,0,0 CAM_POSITION 0,0,6 2D_TARGET_IS 1 Face1(1) IF n% > 1 THEN Face2(2) IF n% > 2 THEN Face3(3) IF n% > 3 THEN Face4(4) IF n% > 4 THEN Face5(5) IF n% > 5 THEN Face6(6) IF n% > 6 THEN Face7(7) IF n% > 7 THEN Face8(8) IF n% > 8 THEN Face9(9) IF n% > 9 THEN Face10(10) IF n% > 10 THEN Face11(11) IF n% > 11 THEN Face12(12) IF n% > 12 THEN Face13(13) IF n% > 13 THEN Face14(14) IF n% > 14 THEN Face15(15) IF n% > 15 THEN Face16(16) IF n% > 16 THEN Face17(17) IF n% > 17 THEN Face18(18) IF n% > 18 THEN Face19(19) IF n% > 19 THEN Face20(20) IF n% > 20 THEN Face21(21) IF n% > 21 THEN Face22(22) IF n% > 22 THEN Face23(23) IF n% > 23 THEN Face24(24) FOR i%= 1 to Nb% 3D_X_ROTATE i%,y+((i%-1)*Teta) 3D_Y_POSITION i%,z*(SIN(y+((i%-1)*Teta))) 3D_Z_POSITION i%,z*(COS(y+((i%-1)*Teta))) NEXT i% END_SUB ' ------------------------------------------------------------------------------ SUB Face1(n%) COLOR 1,0,0,255 2D_CIRCLE 100,100,15 IMAGE 10 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face2(n%) COLOR 1,0,255,0 2D_CIRCLE 40,40,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face3(n%) COLOR 1,0,0,0 2D_CIRCLE 40,40,15 2D_CIRCLE 100,100,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face4(n%) COLOR 1,0,255,255 2D_CIRCLE 40,40,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face5(n%) COLOR 1,255,0,0 2D_CIRCLE 40,40,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_CIRCLE 100,100,15 2D_FILL_COLOR 250,0,0 PRINT_TARGET_IS 1 FONT_NAME 1,"Times New Roman" FONT_SIZE 1,15 PRINT_LOCATE 50,175 PRINT "Marc - July 2018" 2D_FILL_COLOR 250,250,250 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face6(n%) COLOR 1,255,0,255 2D_CIRCLE 40,40,15 2D_CIRCLE 40,100,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_CIRCLE 160,100,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face7(n%) COLOR 1,255,255,0 2D_CIRCLE 40,40,15 2D_CIRCLE 40,100,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_CIRCLE 160,100,15 2D_CIRCLE 100,100,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face8(n%) COLOR 1,255,255,255 2D_CIRCLE 40,40,15 2D_CIRCLE 40,100,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_CIRCLE 160,100,15 2D_CIRCLE 100,66,15 2D_CIRCLE 100,132,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face9(n%) COLOR 1,0,0,255 2D_CIRCLE 40,40,15 2D_CIRCLE 40,100,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_CIRCLE 160,100,15 2D_CIRCLE 100,40,15 2D_CIRCLE 100,100,15 2D_CIRCLE 100,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face10(n%) COLOR 1,0,255,0 2D_CIRCLE 40,40,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face11(n%) COLOR 1,0,255,255 2D_CIRCLE 40,40,15 2D_CIRCLE 100,100,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face12(n%) COLOR 1,0,0,0 2D_CIRCLE 40,40,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face13(n%) COLOR 1,255,0,0 2D_CIRCLE 100,100,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face14(n%) COLOR 1,255,255,0 2D_CIRCLE 40,40,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face15(n%) COLOR 1,255,0,255 2D_CIRCLE 40,40,15 2D_CIRCLE 100,100,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face16(n%) COLOR 1,255,255,255 2D_CIRCLE 40,40,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face17(n%) COLOR 1,255,0,0 2D_CIRCLE 100,100,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face18(n%) COLOR 1,0,255,0 2D_CIRCLE 40,40,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face19(n%) COLOR 1,255,255,0 2D_CIRCLE 40,40,15 2D_CIRCLE 100,100,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face20(n%) COLOR 1,0,0,255 2D_CIRCLE 40,40,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face21(n%) COLOR 1,255,0,255 2D_CIRCLE 100,100,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face22(n%) COLOR 1,0,255,255 2D_CIRCLE 40,40,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face23(n%) COLOR 1,255,255,0 2D_CIRCLE 40,40,15 2D_CIRCLE 100,100,15 2D_CIRCLE 160,160,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Face24(n%) COLOR 1,255,255,255 2D_CIRCLE 40,40,15 2D_CIRCLE 40,160,15 2D_CIRCLE 160,160,15 2D_CIRCLE 160,40,15 2D_IMAGE_COPY 10,0,0,200,200 3D_PLANE n% 3D_V_TILE n%,1 3D_U_TILE n%,1 3D_IMAGE_TEXTURE n%,10 END_SUB ' ------------------------------------------------------------------------------ SUB Instructions() PICTURE 50 HEIGHT 50,40 WIDTH 50,500 TOP 50,500 COLOR 50,50,150,50 2D_TARGET_IS 50 2D_FILL_COLOR 50,150,50 PRINT_TARGET_IS 50 FONT_NAME 50,"Times New Roman" FONT_SIZE 50,18 FONT_ITALIC 50 PRINT_LOCATE 60,10 PRINT "Move the mouse / Bougez la souris" END_SUB ' ------------------------------------------------------------------------------ Move: y = WRAP_VALUE(MOUSE_Y_POSITION(100)*(-1)) FOR i%= 1 to Nb% 3D_X_ROTATE i%,y+((i%-1)*Teta) 3D_Y_POSITION i%,z*(SIN(y+((i%-1)*Teta))) 3D_Z_POSITION i%,z*(COS(y+((i%-1)*Teta))) NEXT i% RETURN ' ------------------------------------------------------------------------------ Quit: TERMINATE RETURN
EDIT : J'ai mis en ligne un exemple d'application dans la section Les jeux faits avec Panoramic. >> ICI <<2ème EDIT : autre exemple d’application >> ICI << | |
|