DreiEck ausmalen

Übersicht BlitzBasic Allgemein

Gehe zu Seite 1, 2  Weiter

Neue Antwort erstellen

Devils Child

Betreff: DreiEck ausmalen

BeitragMo, Aug 22, 2005 14:40
Antworten mit Zitat
Benutzer-Profile anzeigen
hi!
also: ich suche eine funktion, mit der man ein dreieck MÖGLICHST SCHNELL ausmalen kann. ich hab keinen befehl wie PAINT oder so gefunden.

könnt ihr mir bitte helfen Very Happy

danke schonmal im vorraus.
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN
 

Mr Hopp

BeitragMo, Aug 22, 2005 14:57
Antworten mit Zitat
Benutzer-Profile anzeigen
Kann das sein, das du im falschen Forum bist (Dreieck = 2 dimensional)

Blitz3D

BeitragMo, Aug 22, 2005 15:00
Antworten mit Zitat
Benutzer-Profile anzeigen
gibt es einen Befehl für Dreicke? nie gehört
User posted image
Xware Entertainment und Forum
User posted image

Devils Child

BeitragMo, Aug 22, 2005 15:01
Antworten mit Zitat
Benutzer-Profile anzeigen
hoppla, ich hab da an ein polygon gedacht Embarassed

egal, mods: bitte nach blitz2d verschieben.

und bitte helfen!! Smile
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Blitz3D

BeitragMo, Aug 22, 2005 15:03
Antworten mit Zitat
Benutzer-Profile anzeigen
Du hast an ein Polygon gedacht und willst, dass das Thema nach Blitz2D
verschoben wird? Langsam verstehe ich das nicht
Polygone gibt's nur im 3D-Modus

[edit]EntityColor?
User posted image
Xware Entertainment und Forum
User posted image

Devils Child

BeitragMo, Aug 22, 2005 15:06
Antworten mit Zitat
Benutzer-Profile anzeigen
nein, ich will ein 2d-dreick, mir 3 punkten, und die 2dimensionale fäche will ich ausmalen, und das vllt. möglichst schnell
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Blitz3D

BeitragMo, Aug 22, 2005 15:08
Antworten mit Zitat
Benutzer-Profile anzeigen
Herrje, es gibt keine 3D-Dreiecke und diese "Dreiecke" heissen "Polygone"
Hast du's denn schon mit EntityColor versucht?
User posted image
Xware Entertainment und Forum
User posted image

Devils Child

BeitragMo, Aug 22, 2005 15:21
Antworten mit Zitat
Benutzer-Profile anzeigen
das hier ist alles
2 Dimensional
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Blitz3D

BeitragMo, Aug 22, 2005 15:23
Antworten mit Zitat
Benutzer-Profile anzeigen
na, dann mach mal erst Graphics , nicht graphics3d
User posted image
Xware Entertainment und Forum
User posted image

Devils Child

BeitragMo, Aug 22, 2005 15:25
Antworten mit Zitat
Benutzer-Profile anzeigen
omg, verstehst du was ich will?
ne, oder?

egal, ich hab ein 2d-screen, und da sind 3 punkte, die ein dreieck bilden, und ich will es ausmalen!!! Confused
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Blitz3D

BeitragMo, Aug 22, 2005 15:30
Antworten mit Zitat
Benutzer-Profile anzeigen
Zeig mal Screen vom Screen

oder mal so: was hast du da oben: graphics3d oder graphics?

Die Punkte mit Plot?
User posted image
Xware Entertainment und Forum
User posted image

Devils Child

BeitragMo, Aug 22, 2005 15:34
Antworten mit Zitat
Benutzer-Profile anzeigen
das alles hier ist mit blitz2d zu schaffen!!!

ich hab ein dreieck, und will es wie in microsoft paint auf ein mal, woom, ausgemalt haben
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Blitz3D

BeitragMo, Aug 22, 2005 15:35
Antworten mit Zitat
Benutzer-Profile anzeigen
in PAINT?!?!? Wieso sagst du das nicht gleich?!??
User posted image
Xware Entertainment und Forum
User posted image

Devils Child

BeitragMo, Aug 22, 2005 15:38
Antworten mit Zitat
Benutzer-Profile anzeigen
ich meinte, ich will in bb2d das dreieck ausmalen!!!
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Mr.Keks

BeitragMo, Aug 22, 2005 15:53
Antworten mit Zitat
Benutzer-Profile anzeigen
http://www.blitzbase.de/2c.htm vielleicht ist ja da was für dich dabei... in den codearchiven dieses und des englischen forums findet man noch eine hundertschaft solcher dreieckzeichenroutine....

des weiteren bin ich der meinung, dass alle leute mit x-ware-avatar ihre postrechte verlieren sollten... Rolling Eyes
MrKeks.net
 

MegaTefyt

BeitragMo, Aug 22, 2005 15:55
Antworten mit Zitat
Benutzer-Profile anzeigen
Jo, ich hätte auch vorgeschlagen, das Dreieck mit Lines auszufüllen (die Punkte, die du verbinden kannst liegen ja alle auf den Seitelinien des Dreiecks, die kannst du also einfach ausrechnen lassen). Aber in dem Archiv (Link vom Vorposter) ist ein solche Funktion enthalten.

Ansonsten schließ ich mich dem Vorredner an. Wink

Devils Child

BeitragMo, Aug 22, 2005 16:03
Antworten mit Zitat
Benutzer-Profile anzeigen
jo, thx for sample, genau das hab ich gesucht.
danke!!!
ehm, warum posting-verbot??
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Blitz3D

BeitragMo, Aug 22, 2005 16:06
Antworten mit Zitat
Benutzer-Profile anzeigen
weil er sich für wichtiger hält, weil er ein Moderator ist
User posted image
Xware Entertainment und Forum
User posted image

Mr.Keks

BeitragMo, Aug 22, 2005 16:07
Antworten mit Zitat
Benutzer-Profile anzeigen
weil ich bei zu vielen "wenn man keine ahnung hat..."-fällen diesen billigpaintavatar neben dem post sehe ^^.

und heute irgendwie sehr leicht zu reizen bin.
MrKeks.net

Devils Child

BeitragMo, Aug 22, 2005 16:08
Antworten mit Zitat
Benutzer-Profile anzeigen
ok, in 20 min haben wir alle einen schöneren, das schwör ich dir!!!

edit: da hätt ich noch ne frage:

ich hab das alles hier gebraucht, um polygone in meiner render engine auszufüllen.

nun: in welcher reihenfolge soll ich die polys rendern? natürlich nach abstand, aber wie ist der abstand von einem 3d-object mit 3 punkten zur kamera??

Code: [AUSKLAPPEN]
Function Distance#(x1#, y1#, z1#, x2#, y2#, z2#)
Return Sqr((x1 - x2) ^ 2 + (y1 - y2) ^ 2 + (z1 - z2) ^ 2)
End Function


aber wie ist der abstand von einer kamera zu einem polygon, ich meine: ein polygon hat doch drei punkte?!?!

edit2: hier ist der code:

Code: [AUSKLAPPEN]
Graphics3D 1024, 768, 32, 2
SetBuffer BackBuffer()
SeedRnd MilliSecs()

;Globs
Dim xval(20)
Dim yval(20)

Global CamX# = .5
Global CamY# = .5
Global CamZ# = -1

Global ProjX
Global ProjY

;Types
Type Polygon
  Field x1#, y1#, z1#
  Field x2#, y2#, z2#
  Field x3#, y3#, z3#
  Field col1, col2, col3
  Field distance
End Type

;Camera
Global Cam = CreateCamera()
PositionEntity Cam, 0, 0, -7
CameraRange Cam, .00000001, 1000000000

;Model
;Vorne(bei der Camera)
CreatePolygon(0, 0, 0,   1, 0, 0,   1, 1, 0)
CreatePolygon(0, 0, 0,   0, 1, 0,   1, 1, 0)
;Hintern(von der camera Weg)
CreatePolygon(0, 0, 1,   1, 0, 1,   1, 1, 1)
CreatePolygon(0, 0, 1,   0, 1, 1,   1, 1, 1)
;Links
CreatePolygon(0, 0, 0,   0, 0, 1,   0, 1, 1)
CreatePolygon(0, 0, 0,   0, 1, 0,   0, 1, 1)
;Rechts
CreatePolygon(1, 0, 0,   1, 0, 1,   1, 1, 1)
CreatePolygon(1, 0, 0,   1, 1, 0,   1, 1, 1)
;Unten
CreatePolygon(0, 0, 1,   1, 0, 1,   1, 0, 0)
CreatePolygon(0, 0, 1,   0, 0, 0,   1, 0, 0)
;Oben
CreatePolygon(0, 1, 1,   1, 1, 1,   1, 1, 0)
CreatePolygon(0, 1, 1,   0, 1, 0,   1, 1, 0)

While Not KeyHit(1)
  If KeyDown(17) Or KeyDown(200) Then CamZ# = CamZ# + .05
  If KeyDown(31) Or KeyDown(208) Then CamZ# = CamZ# - .05
  If KeyDown(30) Or KeyDown(203) Then CamX# = CamX# - .05
  If KeyDown(32) Or KeyDown(205) Then CamX# = CamX# + .05
  Render()
  Flip
Wend
End

Function Render()
  SortPolys()
  Cls
  For p.Polygon = Each Polygon
    ProjCam(p\x1#, p\y1#, p\z1#): xx1 = ProjX: yy1 = ProjY
    ProjCam(p\x2#, p\y2#, p\z2#): xx2 = ProjX: yy2 = ProjY
    ProjCam(p\x3#, p\y3#, p\z3#): xx3 = ProjX: yy3 = ProjY
    If (xx1 <> 0 Or yy1 <> 0) And (xx2 <> 0 Or yy2 <> 0) And (xx3 <> 0 Or yy3 <> 0) Then
      Color p\col1, p\col2, p\col3
      DrawTriangle(xx1, yy1, xx2, yy2, xx3, yy3)
      DrawTriangle(xx1, yy1, xx3, yy3, xx2, yy2)
      DrawTriangle(xx2, yy2, xx1, yy1, xx3, yy3)
      DrawTriangle(xx2, yy2, xx3, yy3, xx1, yy1)
      DrawTriangle(xx3, yy3, xx1, yy1, xx2, yy2)
      DrawTriangle(xx3, yy3, xx2, yy2, xx1, yy1)
    EndIf
  Next
  Color 255, 255, 255
End Function

Function SortPolys()
For p.Polygon = Each Polygon
  xm# = (p\x1# + p\x2# + p\x3#) / 3
  ym# = (p\y1# + p\y2# + p\y3#) / 3
  zm# = (p\z1# + p\z2# + p\z3#) / 3
  p\distance = Distance(CamX#, CamY#, CamZ#, xm#, ym#, zm#)
Next
SortType()
End Function

Function ProjCam(x#, y#, z#)
tx# = x# - CamX#
ty# = y# - CamY#
tz# = z# - CamZ#
ProjX = GraphicsWidth() / 2 * tx# / tz# + GraphicsWidth() / 2
ProjY = GraphicsHeight() / 2 - GraphicsWidth() / 2 * ty# / tz#
End Function

Function CreatePolygon(x1#, y1#, z1#, x2#, y2#, z2#, x3#, y3#, z3#)
p.Polygon = New Polygon
p\x1# = x1#
p\y1# = y1#
p\z1# = z1#
p\x2# = x2#
p\y2# = y2#
p\z2# = z2#
p\x3# = x3#
p\y3# = y3#
p\z3# = z3#
p\col1 = Rand(50, 255)
p\col2 = Rand(50, 255)
p\col3 = Rand(50, 255)
End Function

Function DrawTriangle(x0, y0, x1, y1, x2, y2)
xval(0) = x0
yval(0) = y0
xval(1) = x1
yval(1) = y1
xval(2) = x2
yval(2) = y2
width = GraphicsWidth()
height = GraphicsHeight()
b = 3 - 1
y = yval(0)
While c <> b
  c = c + 1
  yy = yval(c)
  If yy < y And y = yy Then d = c
Wend
c = d
t = c
While y < height
  If y = yval(c)
    While y = yval(c)
      x0 = xval(c) Shl 16
      c = c + 1
      If c > b Then c = a
      If c = t Then Return
      If y > yval(c) Then Return
    Wend
    h = yval(c) - y
    g0 = ((xval(c) Shl 16) - x0) / h
  EndIf
  If y = yval(d) Then
    While y = yval(d)
      x1 = xval(d) Shl 16
      d = d - 1
      If d < a Then d = b
      If y > yval(d) Then Return
    Wend
    h = yval(d) - y
    g1 = ((xval(d) Shl 16) - x1) / h
  EndIf
  x = x1 Sar 16
  w = ((x0 Sar 16) - x) + 1
  If (w > 0 And y > -1 And x < width And x + w > 0) Then
    If x < 0 w = w + x x = 0
    If x + w > width w = width - x
    Rect x, y, w, 1
  EndIf
  x0 = x0 + g0
  x1 = x1 + g1
  y = y + 1
Wend
End Function

Function SortType()
For Liste.Polygon = Each Polygon: gs = gs + 1 : Next
bs = 1
Repeat
  Liste.Polygon = Last Polygon
  Insert Liste Before First Polygon
  Liste.Polygon = First Polygon
  points_1 = Liste\distance
  X = 1
  bs = bs + 1
  Repeat
    If bs = x Then Exit
    Liste.Polygon = After Liste
    X = X + 1
    If points_1 < Liste\distance Then
      Insert Liste Before Before Liste
      Liste.Polygon = After Liste
    Else
      Exit
    End If
  Forever
Until gs = bs
End Function


Function Distance#(x1#, y1#, z1#, x2#, y2#, z2#)
Return Sqr((x1 - x2) ^ 2 + (y1 - y2) ^ 2 + (z1 - z2) ^ 2)
End Function
*X-Ware Member*

Mission to Hell[Ego-Shooter]
Hier Vollversion runterladen:
http://patrick-sch.de/spiele/m...ersion.zip

ich antworte auf jede PN

Gehe zu Seite 1, 2  Weiter

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group