WinSysCompany
02.10.2011, 18:21
Moin ich weiss nicht wohin mit dem Thema PureBasic ...
also ich habe folgendes Problem ...
ich versuche für ein 128 mal 64 Pixel Schwarz / Weiss bildschirm eine 3D library hinzukriegen ...
meine Ansätze :
Procedure DrawMatrixPoint3D(x,y,z)
z = -z+100
If x > 64
x - 64
xmode = 0
Else
x = 64 - x
xmode = 1
EndIf
If y > 32
y - 32
ymode = 0
Else
y = 32 - y
ymode = 1
EndIf
x2.f = x
y2.f = y
x2 / 100
y2 / 100
x2 * z
y2 * z
x = x2
y = y2
If xmode
x = 64 - x
Else
x = 64 + x
EndIf
If ymode
y = 32 - y
Else
y = 32 + y
EndIf
SetExpandedModullCommand("SetMatrixPixel "+Str(x)+" "+Str(y)+" 1")
EndProcedure
Procedure DrawMatrixLine3D(x,y,w,h,d)
DrawMatrixPoint3D(x,y,d)
WaitForModull()
If w < 0
wmode = 1
w = -w
EndIf
If h < 0
hmode = 1
h = -h
EndIf
If w > h
sh.f = h / w
sw.f = 1
Else
sw.f = w / h
sh.f = 1
EndIf
If w = h
sh.f = 1
sw.f = 1
EndIf
DrawMatrixLine3D_loop:
If wmode
xs.f - sw
Else
xs.f + sw
EndIf
If hmode
ys.f - sh
Else
ys.f + sh
EndIf
xp = x+Round(xs,#PB_Round_Nearest)
yp = y+Round(ys,#PB_Round_Nearest)
If wmode
If -xs > w
ProcedureReturn
EndIf
Else
If xs > w
ProcedureReturn
EndIf
EndIf
If hmode
If -ys > h
ProcedureReturn
EndIf
Else
If ys > h
ProcedureReturn
EndIf
EndIf
DrawMatrixPoint3D(xp,yp,d)
WaitForModull()
Goto DrawMatrixLine3D_loop
EndProcedure
Procedure DrawMatrixBox3D(x,y,z,w,h,d)
DrawMatrixLine3D(x,y,w,0,z)
DrawMatrixLine3D(x,y,0,h,z)
DrawMatrixLine3D(x,y+h,w,0,z)
DrawMatrixLine3D(x+w,y,0,h,z)
For temp = 0 To d
DrawMatrixPoint3D(x,y,temp+z)
WaitForModull()
DrawMatrixPoint3D(x+w,y,temp+z)
WaitForModull()
DrawMatrixPoint3D(x,y+h,temp+z)
WaitForModull()
DrawMatrixPoint3D(x+w,y+h,temp+z)
WaitForModull()
Next
DrawMatrixLine3D(x,y,w,0,z+d)
DrawMatrixLine3D(x,y,0,h,z+d)
DrawMatrixLine3D(x,y+h,w,0,z+d)
DrawMatrixLine3D(x+w,y,0,h,z+d)
EndProcedureweiss jemand wie ich "richtig" 3D hinkriege
Hilfreich währen z.B. 3D Handbücher ( Berechnug und Räumliches Darstellen )
p.s. Weiss jemand wie die 3D-Lib von KolibriOS fungiert !?!
Für hilfe bin ich echt sehr dankbar ...
also ich habe folgendes Problem ...
ich versuche für ein 128 mal 64 Pixel Schwarz / Weiss bildschirm eine 3D library hinzukriegen ...
meine Ansätze :
Procedure DrawMatrixPoint3D(x,y,z)
z = -z+100
If x > 64
x - 64
xmode = 0
Else
x = 64 - x
xmode = 1
EndIf
If y > 32
y - 32
ymode = 0
Else
y = 32 - y
ymode = 1
EndIf
x2.f = x
y2.f = y
x2 / 100
y2 / 100
x2 * z
y2 * z
x = x2
y = y2
If xmode
x = 64 - x
Else
x = 64 + x
EndIf
If ymode
y = 32 - y
Else
y = 32 + y
EndIf
SetExpandedModullCommand("SetMatrixPixel "+Str(x)+" "+Str(y)+" 1")
EndProcedure
Procedure DrawMatrixLine3D(x,y,w,h,d)
DrawMatrixPoint3D(x,y,d)
WaitForModull()
If w < 0
wmode = 1
w = -w
EndIf
If h < 0
hmode = 1
h = -h
EndIf
If w > h
sh.f = h / w
sw.f = 1
Else
sw.f = w / h
sh.f = 1
EndIf
If w = h
sh.f = 1
sw.f = 1
EndIf
DrawMatrixLine3D_loop:
If wmode
xs.f - sw
Else
xs.f + sw
EndIf
If hmode
ys.f - sh
Else
ys.f + sh
EndIf
xp = x+Round(xs,#PB_Round_Nearest)
yp = y+Round(ys,#PB_Round_Nearest)
If wmode
If -xs > w
ProcedureReturn
EndIf
Else
If xs > w
ProcedureReturn
EndIf
EndIf
If hmode
If -ys > h
ProcedureReturn
EndIf
Else
If ys > h
ProcedureReturn
EndIf
EndIf
DrawMatrixPoint3D(xp,yp,d)
WaitForModull()
Goto DrawMatrixLine3D_loop
EndProcedure
Procedure DrawMatrixBox3D(x,y,z,w,h,d)
DrawMatrixLine3D(x,y,w,0,z)
DrawMatrixLine3D(x,y,0,h,z)
DrawMatrixLine3D(x,y+h,w,0,z)
DrawMatrixLine3D(x+w,y,0,h,z)
For temp = 0 To d
DrawMatrixPoint3D(x,y,temp+z)
WaitForModull()
DrawMatrixPoint3D(x+w,y,temp+z)
WaitForModull()
DrawMatrixPoint3D(x,y+h,temp+z)
WaitForModull()
DrawMatrixPoint3D(x+w,y+h,temp+z)
WaitForModull()
Next
DrawMatrixLine3D(x,y,w,0,z+d)
DrawMatrixLine3D(x,y,0,h,z+d)
DrawMatrixLine3D(x,y+h,w,0,z+d)
DrawMatrixLine3D(x+w,y,0,h,z+d)
EndProcedureweiss jemand wie ich "richtig" 3D hinkriege
Hilfreich währen z.B. 3D Handbücher ( Berechnug und Räumliches Darstellen )
p.s. Weiss jemand wie die 3D-Lib von KolibriOS fungiert !?!
Für hilfe bin ich echt sehr dankbar ...