website logo
Auteur
avatar
artblink

Forum » » Création-Développement » » Surprise 3D


Posté : 04-12-2010 15:20 icone du post

Coucou à tous,

Me voila encore une fois, et encore heureux

Voici mes pitis prg avec hollywood:

Vous pouvez les testers et comme d'hab me dire si sa tourne bien?

Merci les gens, voici les liens:

http://jeannoel.roueste.free.fr/starship3d6800x0.exe
http://jeannoel.roueste.free.fr/starship3dAOS4.exe
http://jeannoel.roueste.free.fr/starship3dMorphos.exe
http://jeannoel.roueste.free.fr/starship3dWarpos.exe

Et maintenant, le code



@SCREEN?{Mode?=?"ask",?Width?=?640,?Height?=?400}

FC=200
CX=160
CY=100
CZ=200
Function?Controle()
????If?IsKeyDown("Left")=True?Then?Gauche()?;?Vers?la?gauche
????If?IsKeyDown("Right")=True?Then?Droite()?;?Vers?la?droite
????If?IsKeyDown("Up")=True?Then?Haut()?;?Vers?le?Haut
????If?IsKeyDown("Down")=True?Then?Bas()?;?Vers?le?bas
????If?IsKeyDown("a")=True?Then?Zoomin()?;?Zoom?in
????If?IsKeyDown("z")=True?Then?Zoomout()?;?Zoom?Out
????If?IsKeyDown("e")=True?Then?SetFormStyle(#ANTIALIAS);?Antialiasing?sur?le ?starship
????If?IsKeyDown("r")=True?Then?SetFormStyle(#NORMAL);?Enlève?l'Antial iasing?sur?le?starship

EndFunction

Function?Gauche()
????AY=AY+1
????If?AY>359?Then?AY=0
EndFunction

Function?Droite()
????AY=AY-1
????If?AY<0?Then?AY=359
EndFunction

Function?Haut()
????AX=AX+1
????If?AX>359?Then?AX=0
EndFunction
????
Function?Bas()
????AX=AX-1
????If?AX<0?Then?AX=359
EndFunction

Function?Zoomin()
????CZ=CZ+10
????If?CZ>500?Then?CZ=500
EndFunction

Function?Zoomout()
????CZ=CZ-10
????If?CZ<80?Then?CZ=80
EndFunction

Function?PRG()
????
????Controle()?;?Exécution?de?la?fonction?Controle
????;?Réservation?mémoire?et?création?des?tableaux
????Dim?CO[360]?;?360?cases?réservé?car?une?rotation?c'est?360? ?pour?le?Cosinus
????Dim?SI[360]?;?360?cases?réservé?car?une?rotation?c'est?360? ?pour?le?Sinus
????Dim?X[8]?;?Un?cube,?c'est?8?points?en?X
????Dim?Y[8]?;?Un?cube,?c'est?8?points?en?Y
????Dim?Z[8]?;?Un?cube,?c'est?8?points?en?Z
????Dim?XE[8]?;?Point?final?du?cube?a?dessiner?en?X
????Dim?YE[8]?;?Point?final?du?cube?a?dessiner?en?Y
????Dim?ZZ[8]?;?Point?final?du?cube?a?dessiner?en?Z
????Dim?P1[12]?;?Un?cube,?c'est?12?lignes?(point?de?départ?de?la?ligne )
????Dim?P2[12]?;?Un?cube,?c'est?12?lignes?(point?final?de?la?ligne)
????
Flip?;?Flip?d'écran?pour?le?double?buffer
Cls?;?Effacement?de?l'écran?sinon?on?verrait?des?starship?partout?lol< br />TextOut(#CENTER,0,"LA?GUERRE?DES?ETOILES")
TextOut(#CENTER,10,"A?Hollywood")
TextOut(0,20,"Touche?fléché?pour?la?rotation?de?l'objet")
TextOut(0,30,"touche?a?=?Zoom?Arrière")
TextOut(0,40,"touche?z?=?Zoom?Avant")
TextOut(0,50,"touche?e?=?SURPRISE!!!")
TextOut(0,60,"touche?r?=?Enlève?la?surprise")
TextOut(0,70,"ctrl?+?c?=?QUITTER")
For?I=0?To?359
????CO[I]=Cos(I*0.1)*256?;?Mise?en?mémoire?de?360?calcule?du?Cosinus?d es?angles?sur?360?
????SI[I]=Sin(I*0.1)*256?;?Mise?en?mémoire?de?360?calcule?du?Sinus?des ?angles?sur?360?
Next?

;Coordonnée?de?l'objet?à?dessiner,?objet?donnée?gratieus ement?par?l'ami?Thellier,?grand?programmeur?3D?
;J'ai?créé?un?tableau?unique?avec?les?coordonnèes?U?et?V ?pour?les?textures,?mais?je?ma?trise?pas,?et?les?
;coordonnées?X,?Y?et?Z,?le?tableau?est?donc?sous?le?format?coord[U,V,X ,Y,Z]?et?surtout?pas?coord[U][V][X][Y][Z]?
;coord[]?est?un?tableau?à?1?colonne?ou?1?ligne?(selon?comment?vous?l'i maginer?sous?excel?par?exemple)
????
????
????For?I=0?To?95
????????;?il?y?a?96?lignes?de?coordonnées,?donc?0?à?95,?sa?fait ?96?graduations
????????;?tous?les?tableaux?Hollywood?commence?à?l'adresse?0
????coord={
????0.647059,0.545455,-0.013836,-0.009224,-0.039999,
????0.588235,0.309091,0.076100,0.046121,-0.536000,
????0.686275,0.309091,0.076100,-0.046121,-0.536000,
????0.852941,0.545455,-0.013836,-0.202934,-0.039999,
????0.647059,0.600000,-0.034591,-0.009224,-0.039999,
????0.852941,0.600000,-0.034591,-0.202934,-0.039999,
????0.686275,0.363636,0.055346,-0.046121,-0.536000,
????0.588235,0.363636,0.055346,0.046121,-0.536000,
????0.852941,0.545455,-0.013836,-0.202934,0.039999,
????0.686275,0.309091,0.076100,-0.046121,0.536001,
????0.588235,0.309091,0.076100,0.046121,0.536001,
????0.647059,0.545455,-0.013836,-0.009224,0.039999,
????0.588235,0.363636,0.055346,0.046121,0.536001,
????0.686275,0.363636,0.055346,-0.046121,0.536001,
????0.852941,0.600000,-0.034591,-0.202934,0.039999,
????0.647059,0.600000,-0.034591,-0.009224,0.039999,
????1.000000,0.400000,0.041509,-0.341298,0.007999,
????0.901961,0.400000,0.041509,-0.249055,0.007999,
????0.901961,0.109091,0.152200,-0.249055,0.007999,
????0.970588,0.054545,0.172955,-0.313625,0.007999,
????0.901961,0.400000,0.041509,-0.249055,0.000000,
????1.000000,0.400000,0.041509,-0.341298,0.000000,
????0.970588,0.054545,0.172955,-0.313625,0.000000,
????0.901961,0.109091,0.152200,-0.249055,0.000000,
????0.852941,0.054545,0.172955,-0.202934,0.000000,
????0.852941,0.054545,0.172955,-0.202934,0.007999,
????0.666667,0.054545,0.172955,-0.027673,0.000000,
????0.666667,0.054545,0.172955,-0.027673,0.007999,
????0.666667,0.000000,0.193710,-0.027673,0.000000,
????0.666667,0.000000,0.193710,-0.027673,0.007999,
????0.941176,0.000000,0.193710,-0.285952,0.000000,
????0.941176,0.000000,0.193710,-0.285952,0.007999,
????0.156863,0.636364,-0.048427,0.451989,0.039999,
????0.156863,0.545455,-0.013836,0.451989,0.016000,
????0.274510,0.472727,0.013836,0.341298,0.023999,
????0.274510,0.636364,-0.048427,0.341298,0.072000,
????0.558824,0.472727,0.013836,0.073794,0.023999,
????0.558824,0.636364,-0.048427,0.073794,0.072000,
????0.156863,0.545455,-0.013836,0.451989,-0.008000,
????0.274510,0.472727,0.013836,0.341298,-0.016000,
????0.558824,0.472727,0.013836,0.073794,-0.016000,
????0.156863,0.636364,-0.048427,0.451989,-0.039999,
????0.274510,0.636364,-0.048427,0.341298,-0.056000,
????0.558824,0.636364,-0.048427,0.073794,-0.056000,
????0.009804,0.636364,-0.048427,0.590353,0.000000,
????0.156863,0.690909,-0.069182,0.451989,0.023999,
????0.274510,0.727273,-0.083018,0.341298,0.039999,
????0.343137,0.727273,-0.083018,0.276728,0.023999,
????0.343137,0.727273,-0.083018,0.276728,-0.016000,
????0.274510,0.727273,-0.083018,0.341298,-0.024000,
????0.156863,0.690909,-0.069182,0.451989,-0.016000,
????0.000000,0.636364,-0.048427,0.599577,0.000000,
????0.558824,0.727273,-0.083018,0.073794,-0.016000,
????0.558824,0.727273,-0.083018,0.073794,0.023999,
????0.549020,0.818182,-0.117609,0.083018,0.112000,
????0.549020,0.945455,-0.166037,0.083018,0.056000,
????0.549020,1.000000,-0.186791,0.083018,0.007999,
????0.549020,1.000000,-0.186791,0.083018,-0.008000,
????0.549020,0.945455,-0.166037,0.083018,-0.056000,
????0.549020,0.818182,-0.117609,0.083018,-0.112000,
????0.549020,0.472727,0.013836,0.083018,-0.056000,
????0.549020,0.363636,0.055346,0.083018,-0.008000,
????0.549020,0.363636,0.055346,0.083018,0.007999,
????0.549020,0.472727,0.013836,0.083018,0.056000,
????1.000000,0.472727,0.013836,-0.341298,0.056000,
????1.000000,0.709091,-0.076100,-0.341298,0.088000,
????0.921569,0.818182,-0.117609,-0.267504,0.112000,
????1.000000,0.363636,0.055346,-0.341298,0.007999,
????1.000000,0.363636,0.055346,-0.341298,-0.008000,
????1.000000,0.472727,0.013836,-0.341298,-0.056000,
????0.921569,0.818182,-0.117609,-0.267504,-0.112000,
????1.000000,0.709091,-0.076100,-0.341298,-0.088000,
????0.813725,1.000000,-0.186791,-0.166037,0.007999,
????0.813725,1.000000,-0.186791,-0.166037,-0.008000,
????0.843137,0.945455,-0.166037,-0.193710,-0.056000,
????0.843137,0.945455,-0.166037,-0.193710,0.056000,
????0.441176,0.363636,0.055346,0.184485,0.488000,
????0.441176,0.181818,0.124528,0.184485,0.488000,
????0.441176,0.181818,0.124528,0.184485,0.552001,
????0.441176,0.363636,0.055346,0.184485,0.696001,
????0.441176,0.509091,0.000000,0.184485,0.552001,
????0.745098,0.127273,0.145282,-0.101467,0.552001,
????0.745098,0.127273,0.145282,-0.101467,0.488000,
????0.745098,0.363636,0.055346,-0.101467,0.488000,
????0.745098,0.600000,-0.034591,-0.101467,0.552001,
????0.745098,0.363636,0.055346,-0.101467,0.696001,
????0.441176,0.509091,0.000000,0.184485,-0.552000,
????0.441176,0.363636,0.055346,0.184485,-0.696000,
????0.441176,0.181818,0.124528,0.184485,-0.552000,
????0.441176,0.181818,0.124528,0.184485,-0.488000,
????0.441176,0.363636,0.055346,0.184485,-0.488000,
????0.764706,0.363636,0.055346,-0.119915,-0.696000,
????0.764706,0.600000,-0.034591,-0.119915,-0.552000,
????0.764706,0.363636,0.055346,-0.119915,-0.488000,
????0.764706,0.127273,0.145282,-0.119915,-0.488000,
????0.764706,0.127273,0.145282,-0.119915,-0.552000
????}
;?J'ai?du?rajouter?une?ligne?de?trois?0?qui?ne?sont?pas?des?coordonnée s?du?vaisseau,?on?verra?plus?tard?pourquoi?
;?P1?c'est?3?chiffres?formant?1?triangle
P1={
????0,0,0,
????0,1,2,
????0,2,3,
????4,5,6,
????4,6,7,
????7,1,0,
????7,0,4,
????2,1,7,
????2,7,6,
????3,2,6,
????3,6,5,
????0,3,5,
????0,5,4,
????8,9,10,
????8,10,11,
????12,13,14,
????12,14,15,
????15,11,10,
????15,10,12,
????13,12,10,
????13,10,9,
????14,13,9,
????14,9,8,
????15,14,8,
????15,8,11,
????16,17,18,
????16,18,19,
????20,21,22,
????20,22,23,
????23,18,17,
????23,17,20,
????24,25,18,
????24,18,23,
????26,27,25,
????26,25,24,
????28,29,27,
????28,27,26,
????30,31,29,
????30,29,28,
????22,19,31,
????22,31,30,
????21,16,19,
????21,19,22,
????20,17,16,
????20,16,21,
????18,25,31,
????18,31,19,
????22,30,24,
????22,24,23,
????24,30,28,
????24,28,26,
????31,25,27,
????31,27,29,
????32,33,34,
????32,34,35,
????35,34,36,
????35,36,37,
????33,38,39,
????33,39,34,
????34,39,40,
????34,40,36,
????38,41,42,
????38,42,39,
????39,42,43,
????39,43,40,
????44,44,45,
????44,45,46,
????44,46,47,
????44,47,48,
????44,48,49,
????44,49,50,
????44,50,44,
????44,44,51,
????44,51,51,
????51,51,38,
????51,38,33,
????51,44,41,
????51,41,38,
????41,44,50,
????50,49,42,
????50,42,41,
????49,48,52,
????49,52,43,
????49,43,42,
????48,47,53,
????48,53,52,
????46,35,37,
????46,37,53,
????46,53,47,
????46,45,32,
????46,32,35,
????32,45,44,
????44,51,33,
????44,33,32,
????36,40,43,
????36,43,52,
????36,52,53,
????36,53,37,
????36,37,37,
????54,55,56,
????54,56,57,
????54,57,58,
????54,58,59,
????54,59,60,
????54,60,61,
????54,61,62,
????54,62,63,
????64,65,66,
????64,66,54,
????64,54,63,
????63,62,67,
????63,67,64,
????62,61,68,
????62,68,67,
????61,60,69,
????61,69,68,
????59,70,71,
????59,71,69,
????59,69,60,
????56,72,73,
????56,73,57,
????57,73,74,
????57,74,58,
????58,74,70,
????58,70,59,
????54,66,75,
????54,75,55,
????55,75,72,
????55,72,56,
????69,71,65,
????69,65,64,
????69,64,67,
????69,67,68,
????75,66,65,
????75,65,71,
????75,71,70,
????75,70,74,
????75,74,73,
????75,73,72,
????76,77,78,
????76,78,79,
????76,79,80,
????81,82,83,
????81,83,84,
????81,84,85,
????78,85,79,
????77,81,78,
????76,82,77,
????80,83,76,
????79,84,80,
????85,84,79,
????84,83,80,
????83,82,76,
????82,81,77,
????81,85,78,
????86,87,88,
????86,88,89,
????86,89,90,
????91,92,93,
????91,93,94,
????91,94,95,
????87,91,88,
????88,95,89,
????89,94,90,
????90,93,86,
????86,92,87,
????87,92,91,
????86,93,92,
????90,94,93,
????89,95,94,
????88,91,95,
}

????????;Calcule?3D?grâce?au?magazine?Dream?N?27?de?Mars?1996?que?j'ai? modifié?pour?le?Starship
????????Y1=(coord[I*5+3]*100*CO[AX]+coord[I*5+4]*100*SI[AX])/256?
????????;?I*5+3,?faite?le?calcule?sur?une?feuille?blanche,?le?résultat ?sera?l'adresse?de?la?donnée?dans?le?tableau?coord[],?vous?allez?vite?co mprendre?(c'est?la?valeur?en?X)
????????Z1=(-coord[I*5+3]*100*SI[AX]+coord[I*5+4]*100*CO[AX])/256
????????X1=(coord[I*5+2]*100*CO[AY]+Z1*SI[AY])/256
????????ZZ[I]=(-coord[I*5+2]*100*SI[AY]+Z1*CO[AY])/256
????????X=(X1*CO[AZ]+Y1*SI[AZ])/256
????????Y=(-X1*SI[AZ]+Y1*CO[AZ])/256
????????D=FC/(Sqrt(X^2+Y^2+(CZ+ZZ[I])^2))
????????XE[I]=320+X*D
????????YE[I]=200+Y*D
????Next
????;?Calcule?final
????For?I=0?To?169
????????GP1=P1[I*3+3]
????????GP2=P1[I*3+4]
????????GP3=P1[I*3+5]
????????X=XE[GP1]
????????Y=YE[GP1]
????????X1=XE[GP2]
????????Y1=YE[GP2]
????????X2=XE[GP3]
????????Y2=YE[GP3]
????????;un?triangle?c'est?3?côtés?donc?3?traçage?de?lign es
????????Line?(X,Y,X1,Y1,#WHITE)?;?Traçage?des?lignes?du?premier?c&ocir c;tés?de?chaque?triangle
????????Line?(X1,Y1,X2,Y2,#WHITE)?;?Traçage?des?lignes?du?deuxiè ;me?côtés?de?chaque?triangle
????????Line?(X2,Y2,X,Y,#WHITE)?;?Traçage?des?lignes?du?troisiè me?côtés?de?chaque?triangle

????Next
EndFunction

BeginDoubleBuffer

SetInterval(1,PRG,1000/50)

Repeat
WaitEvent
Forever



Respect
Message édité par : artblink / 04-12-2010 15:21
Message édité par : artblink / 04-12-2010 15:22

Cet article provient de Le site des utilisateurs francophones actuels et futurs d'AmigaOS 4.x
https://amiga-ng.org/viewtopic.php?topic=927&forum=14