Dreiecksfüllroutine
Übersicht

![]() |
TritonBetreff: Dreiecksfüllroutine |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] ;*** Dreieck-Füllroutine
;*** 4/5.10.2004 ;*** www.silizium-net.de Graphics 800,600,32,2 SetBuffer BackBuffer() SeedRnd MilliSecs() x1=Rand(0,800) y1=Rand(0,600) x3=Rand(0,800) y3=Rand(0,600) HidePointer time1 = MilliSecs() While Not KeyDown(1) filltri(x1,y1,MouseX(),MouseY(),x3,y3,0,0,255,255,255,255) loops = loops+1 If MilliSecs() - time1 > 1000 Then fps = loops:loops = 0:time1 = MilliSecs() If KeyHit(28) Then x1=Rand(0,800) y1=Rand(0,600) x3=Rand(0,800) y3=Rand(0,600) End If Color 255,255,255 Text 10,10, "Enter für neue Zufallspositionen" Text 10,30, fps+" FPS" Flip 0 Cls Wend End ;--- Function filltri(x1,y1,x2,y2,x3,y3,r,g,b,borderr,borderg,borderb) For oft = 0 To 1 If x1 > x2 Then p=x2 x2=x1 x1=p q=y2 y2=y1 y1=q End If If x1 > x3 Then p=x3 x3=x1 x1=p q=y3 y3=y1 y1=q End If If x2 > x3 Then p=x3 x3=x2 x2=p q=y3 y3=y2 y2=q End If Next Color r,g,b For bx1# = x1 To x2 m13# = (Float(y3-y1)/(x3-x1)) n13# = -m13*x1+y1 by1# = m13*bx1+n13 m12# = (Float(y2-y1)/(x2-x1)) n12# = -m12*x1+y1 by2# = m12*bx1+n12 If by2-by1 > 0 Then Rect bx1,by1,1,by2-by1 If by2-by1 < 0 Then Rect bx1,by2,1,by1-by2 Next For bx2 = x2 To x3 m13# = (Float(y3-y1)/(x3-x1)) n13# = -m13*x3+y3 by3# = m13*bx2+n13 m23# = (Float(y3-y2)/(x3-x2)) n23# = -m23*x2+y2 by4# = m23*bx2+n23 If by4-by3 > 0 Then Rect bx2,by3,1,by4-by3 If by4-by3 < 0 Then Rect bx2,by4,1,by3-by4 Next Color borderr,borderg,borderb Line x1,y1,x2,y2 Line x1,y1,x3,y3 Line x2,y2,x3,y3 Text x1,y1, "1" Text x2,y2, "2" Text x3,y3, "3" End Function Dieser Code füllt ein Dreieck mit einer Farbe. Dabei werden nur vertikale Linien durch Rect gezeichnet, was es relativ schnell macht. |
||
Coding: silizium-net.de | Portfolio: Triton.ch.vu |
- Zuletzt bearbeitet von Triton am Mo, Jan 03, 2005 3:59, insgesamt einmal bearbeitet
![]() |
Bms |
![]() Antworten mit Zitat ![]() |
---|---|---|
kann man das auch zu einer rautenfüllfunktion umproggn? | ||
Reblonce (Jump + Run + Shoot - Game; 20 Levels): Download |
![]() |
MVB |
![]() Antworten mit Zitat ![]() |
---|---|---|
Einfach die Raute in zwei Dreiecke zerlegen. ![]() |
||
aquamonit.de|BlitzMax|MaxGUI |
![]() |
Bms |
![]() Antworten mit Zitat ![]() |
---|---|---|
lol hätt ich selber drauf kommen müssen *hau an kopp mit bratpfanne* | ||
Reblonce (Jump + Run + Shoot - Game; 20 Levels): Download |
![]() |
Devils Child |
![]() Antworten mit Zitat ![]() |
---|---|---|
die auf blitzbase ist doppelt so schnell und die auf www.shadowturtle.de ist 4 mal so schnell wie die auf blitzbase. und die auf st's seite kann auch schattierungen darstellen ![]() rauten kann man hinbekommen indem man 2 dreiecke nimmt... |
||
*X-Ware Member*
Mission to Hell[Ego-Shooter] Hier Vollversion runterladen: http://patrick-sch.de/spiele/m...ersion.zip ich antworte auf jede PN |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group