Bitte sehr. ![]()
Es scheint, dass die Pointer nicht stimmen!
Edit:
Code
#Include Once "win\gdiplus.bi"
Using GDIPLUS
Extern "Windows-MS"
/' Local $iDim = $iCountX * $iCountY + $iCountX + $iCountY + 1
Local Const $tagData = "struct;float x[" & $iDim & "];float y[" & $iDim & "];float z[" & $iDim & "];float fX[" & $iDim & "];float fY[" & $iDim & "];
float fZ[" & $iDim & "];int pen[" & $iDim & "];endstruct"
'/
Sub Translate3Dto2D(tData as Any Ptr, iPos As UInteger, _
fRotX As Single, fRotY As Single, fRotZ As Single, fCenterX As Single = 0, fCenterY As Single = 0.0, _
fScale As Single = 1.0, fZDeepCorrection As Single = 500.0, iCountX As UInteger, iCountY As UInteger)
Dim As Single fCosRotX, fSinRotX, fCosRotY, fSinRotY, fCosRotZ, fSinRotZ, f1, f2, f3, f4, f5, f6, fXPos, fYPos, fZPos, fZPerspCorrection
Dim As Single Ptr pX, pY, pZ, pfX, pfY, pfZ
Dim As UInteger iSingle, iUBound
iUBound = iCountX * iCountY + iCountX + iCountY + 1
iSingle = SizeOf(Single)
pX = tData
pY = tData + 1 * iUBound + iSingle
pZ = tData + 2 * iUBound + iSingle
pfX = tData + 3 * iUBound + iSingle
pfY = tData + 4 * iUBound + iSingle
pfZ = tData + 5 * iUBound + iSingle
fCosRotX = Cos(fRotX)
fSinRotX = Sin(fRotX)
fCosRotY = Cos(fRotY)
fSinRotY = Sin(fRotY)
fCosRotZ = Cos(fRotZ)
fSinRotZ = Sin(fRotZ)
f1 = fCosRotY * pX[iPos]
f2 = fSinRotX * pY[iPos]
f3 = fCosRotX * pZ[iPos]
f4 = fCosRotX * pY[iPos]
f5 = fSinRotX * pZ[iPos]
f6 = f1 - fSinRotY * (f2 + f3)
fXPos = (fCosRotZ * f6 - fSinRotZ * (f4 - f5)) * fScale
fYPos = (fSinRotZ * f6 + fCosRotZ * (f4 - f5)) * fScale
fZPos = (fSinRotY * pX[iPos] + fCosRotY * (f2 + f3)) * fScale
fZPerspCorrection = 1 / (fZPos / fZDeepCorrection + 1)
pfX[iPos] = fXPos * fZPerspCorrection + fCenterX
pfY[iPos] = fYPos * fZPerspCorrection + fCenterY
pfZ[iPos] = fZPos
End Sub
Sub Boost(ByVal hCanvas as GpGraphics Ptr, tData As Any Ptr, _
iCountX As UInteger, iCountY As UInteger, _
fX As Single, fY As Single, fZ As Single, fW As Single, fH As Single, fScale As Single) Export
Dim As UInteger c, iUBound, iSingle
Dim As Single Ptr pX, pY, pZ, pfX, pfY, pFZ
Dim As UInteger Ptr pPen
iUBound = iCountX * iCountY + iCountX + iCountY + 1
iSingle = SizeOf(Single)
For c = 0 To iUbound - 1
Translate3Dto2D(tData, c, fX, fY, fZ, fW, fH, fScale, 1000, iCountX, iCountY)
pX = tData '+ 0 * iUBound + 0 * iSingle
pY = tData + 1 * iUBound * iSingle
pZ = tData + 2 * iUBound * iSingle
pfX = tData + 3 * iUBound * iSingle
pfY = tData + 4 * iUBound * iSingle
pfZ = tData + 5 * iUBound * iSingle
pPen = tData + 6 * iUBound * iSingle
If c > 0 Then
GdipDrawLine(hCanvas, pPen[c], pfX[c - 1], pfY[c - 1], pfX[c], pfY[c])
EndIf
Next
End Sub
End Extern
Alles anzeigen
Dies hier kackt nicht ab, aber Bildschirm bleibt dunkel. ![]()