Eigene 3d-Engine(Misslungen)
Übersicht

![]() |
Devils ChildBetreff: Eigene 3d-Engine(Misslungen) |
![]() Antworten mit Zitat ![]() |
---|---|---|
hoi!
ich hab hier eine eigene 3d-engine geproggt. nur, wie kann ich einbauen, dass man die camera auch drehen kann? Code: [AUSKLAPPEN] Graphics3D 1280, 1024, 32, 1
SetBuffer BackBuffer() ;Globs Global CamX# = 0 Global CamY# = 0 Global CamZ# = -15 Global ProjX Global ProjY Global CamPitch# = 0 Global CamYaw# = 0 Global CamRoll# = 0 Global Cnt_Polys Dim x1#(1000000), y1#(1000000), z1#(1000000) Dim x2#(1000000), y2#(1000000), z2#(1000000) Dim x3#(1000000), y3#(1000000), z3#(1000000) Dim col1(1000000), col2(1000000), col3(1000000) ;Camera Global Cam = CreateCamera() PositionEntity Cam, 0, 0, -7 CameraRange Cam, .00000001, 1000000000 cnt = 0 For x = -20 To 20 For y = -20 To 20 cnt = cnt + 1 x1(cnt) = x y1(cnt) = y z1(cnt) = z x2(cnt) = x + 1 y2(cnt) = y z2(cnt) = z x3(cnt) = x y3(cnt) = y + 1 z3(cnt) = z col1(cnt) = Rand(100, 255) col2(cnt) = Rand(100, 255) col3(cnt) = Rand(100, 255) Next Next Cnt_Polys = cnt While Not KeyHit(1) Cls If KeyDown(17) Or KeyDown(200) Then MoveCam(0, 0, 1) If KeyDown(31) Or KeyDown(208) Then MoveCam(0, 0, -1) If KeyDown(30) Or KeyDown(203) Then MoveCam(-1, 0, 0) If KeyDown(32) Or KeyDown(205) Then MoveCam(1, 0, 0) ;Mausbewegung xs# = (MouseXSpeed() - xs#) / 2 + xs# ys# = (MouseYSpeed() - ys#) / 2 + ys# TurnCam(ys#, 0, 0) TurnCam(0, -xs#, 0) If CamPitch# + y_speed# < -85 pitch = -85 flipped = True ElseIf CamPitch# + y_speed# > 85 pitch = 85 fliped = True Else pitch = CamPitch# + myspeed flipped = False EndIf If flipped Then RotateCam(pitch, CamYaw# - MouseXSpeed(), 0) MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2 RotateCam(CamPitch#, CamYaw#, 0) ;Render LockBuffer() For i = 1 To Cnt_Polys ProjCam(x1(i), y1(i), z1(i)) xx1 = ProjX yy1 = ProjY ProjCam(x2(i), y2(i), z2(i)) xx2 = ProjX yy2 = ProjY ProjCam(x3(i), y3(i), z3(i)) xx3 = ProjX yy3 = ProjY If (xx1 <> 0 Or yy1 <> 0) And (xx2 <> 0 Or yy2 <> 0) And (xx3 <> 0 Or yy3 <> 0) Then Color col1(i), col2(i), col3(i) Line xx1, yy1, xx2, yy2 Line xx2, yy2, xx3, yy3 Line xx3, yy3, xx1, yy1 EndIf Next Color 255, 255, 255 UnlockBuffer() Flip ;DebugLine Locate 1, 1 Print "CamPos = " + Int(CamX#) + " " + Int(CamY#) + " " + Int(CamZ#) Print "CamAngle = " + Int(CamPitch#) + " " + Int(CamYaw#) + " " + Int(CamRoll#) Wend End Function MoveCam(x#, y#, z#) PositionEntity Cam, CamX#, CamY#, CamZ# MoveEntity Cam, x#, y#, z# CamX# = EntityX(Cam) CamY# = EntityY(Cam) CamZ# = EntityZ(Cam) End Function Function TurnCam(x#, y#, z#) RotateEntity Cam, CamPitch#, CamYaw#, CamRoll# TurnEntity Cam, x#, y#, z# CamPitch# = EntityPitch(Cam) CamYaw# = EntityYaw(Cam) CamRoll# = EntityRoll(Cam) End Function Function RotateCam(x#, y#, z#) CamPitch# = x# CamYaw# = y# CamRoll# = z# 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 bitte! kann mir jemand helfen, in projcam(x,y,z) etwas einzubauen, wo man die cam drehen kann. ps: jaja ich weiss, ist net so ganz 3d. die Camera benutze ich nur für die funktion movecam() |
||
*X-Ware Member*
Mission to Hell[Ego-Shooter] Hier Vollversion runterladen: http://patrick-sch.de/spiele/m...ersion.zip ich antworte auf jede PN |
![]() |
Devils Child |
![]() Antworten mit Zitat ![]() |
---|---|---|
das raff ich net, 135 leute haben diese thread aufgerufen, und keiner ist in der lasge mit zu helfen? | ||
*X-Ware Member*
Mission to Hell[Ego-Shooter] Hier Vollversion runterladen: http://patrick-sch.de/spiele/m...ersion.zip ich antworte auf jede PN |
![]() |
Vertex |
![]() Antworten mit Zitat ![]() |
---|---|---|
Was soll das für eine 3D-Engine sein, wo du noch nichtmal die Projektion selber machst?!
Und zum Thema Rotaion usw - Es ist es an der Reihe, ein wenig über 3D Tranformation mit Hilfe von Matrizen und Vektoren zu lernen! Gibt eigentlich schon ein Paar Threads darüber. Suche mal nach "3D-Lib" oder so, im Codearchiv. mfg olli |
||
vertex.dreamfall.at | GitHub |
![]() |
Devils Child |
![]() Antworten mit Zitat ![]() |
---|---|---|
das muss doch auch ohne matrizen gehen, oder? | ||
*X-Ware Member*
Mission to Hell[Ego-Shooter] Hier Vollversion runterladen: http://patrick-sch.de/spiele/m...ersion.zip ich antworte auf jede PN |
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Nein
Vektoren sind 3D und der Zielraum 2D und Vektorraumprojektionen gehen nur über Matrizen |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
![]() |
Devils Child |
![]() Antworten mit Zitat ![]() |
---|---|---|
ich kann keine matritzen gibt es den nit irgendeine pfusch-methode dafür? | ||
*X-Ware Member*
Mission to Hell[Ego-Shooter] Hier Vollversion runterladen: http://patrick-sch.de/spiele/m...ersion.zip ich antworte auf jede PN |
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
es gibt da ne prima Methode: Lern mit Matrizen umzugehen ![]() |
||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
![]() |
Devils Child |
![]() Antworten mit Zitat ![]() |
---|---|---|
gibt es da nit irgendwelche tuts?
und zeigt mir jetzt nicht den link zu google! |
||
*X-Ware Member*
Mission to Hell[Ego-Shooter] Hier Vollversion runterladen: http://patrick-sch.de/spiele/m...ersion.zip ich antworte auf jede PN |
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
~GESCHLOSSEN~ http://www.robsite.de sowie www.google.de konsultieren Dreamora |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group