Rotating Cube with textures build 2019-02-24

Post your FreeBASIC tips and tricks here. Please don’t post your code without including an explanation.
UEZ
Posts: 308
Joined: May 05, 2017 19:59
Location: Germany

Rotating Cube with textures build 2019-02-24

Postby UEZ » Feb 21, 2019 23:54

Here an additional code to rotate a cube with texture. It is not very fast with larger images and thus a lot of room for speedup improvements...

Sorry, with larger images the source code (80977 chars) is too long (exceeded 60000 chars) to post it here. :-(

Preview:
Image

Rotating cube with texture.bas

Code: Select all

'Rotating cube with texture coded by UEZ build 2019-02-24
'Original trapezoid transformation code by Ben321
'Runs "fastest" as x64 with -gen gcc -Wc -Ofast -fpmode FAST -fpu SSE at least on my system :-)

#Include "fbgfx.bi"
#include "file.bi"

Using FB

#Define Round(x) ((x * 100 + 0.5) / 100 Shr 0) '2 decimal places 10^2 = 100
#Define PixelSet(_x, _y, colour)    *CPtr(Ulong ptr, imgData_d + (_y) * pitch_d + (_x) Shl 2) = (colour)
#Define _Red(_colors)    (((_colors) Shr 16) And 255)
#Define _Green(_colors) (((_colors) Shr 8) And 255)
#Define _Blue(_colors)    ((_colors) And 255)
#Define _Min(a, b)  (Iif(a < b, a, b))
   
Dim Shared As Integer pitch_s, pitch_d
Dim Shared As Image Ptr Img_Dest, Img_Bg
Dim Shared As Any Ptr imgData_d

Type tImgInfo
   As Image Ptr img
   As Integer pitch
   As Any Ptr imgdata
End Type

Dim Shared As tImgInfo ImgInfo(5)

Const fRad = Acos(-1) / 180, scrw = 1000, scrh = 666, img_w = 250, img_h = 166, iCenterX = scrw \ 2, iCenterY = scrh \ 2, iMouseSense = 150,_
     iPersp_correction = 1000, fCube_Size = 100, fMin_brightness = fCube_Size, fZoomMinus = 0.95, fZoomPlus = 1.05

Dim Shared as Double fZoomCounter = 1.0

Type DPOINT
   As Double x, y, z
End Type

Declare Sub Calculate(fAngleX As Double, fAngleY As Double, iPos As Ubyte)
Declare Sub DrawCube(p1 As Ubyte, p2 As Ubyte, p3 As Ubyte, p4 As Ubyte, img As Ubyte)
Declare Function Transform(x As Short, y As Short, ImgWidth As Ushort, ImgHeight As Ushort, Points() As DPOINT) As DPOINT
Declare Sub Trapezoid(aPoints() As DPOINT, ww As Ushort, hh As Ushort, img As Ubyte, fBrightness As Double)
Declare Function Base91Decode(sString As String, Byref iBase91Len As Ulong) As Ubyte Ptr
Declare Function _WinAPI_LZNTDecompress(aBinary As Ubyte Ptr, iFileSize As Ulong, iCompressedSize As Ulong) As Ubyte Ptr
Declare Sub CreateFile(sFilename as String, sBase91 as String, iLines As Ulong, bCompressed As Ulong, iFileSize As Ulong, iCompressedSize As Ulong)
Declare Sub ExtractDe()
Declare Sub ExtractGb()
Declare Sub ExtractGr()
Declare Sub ExtractJa()
Declare Sub ExtractTr()
Declare Sub ExtractUs()


Screenres (scrw, scrh, 32, 2, GFX_ALPHA_PRIMITIVES Or GFX_HIGH_PRIORITY Or GFX_NO_SWITCH)
Screenset 1, 0

Windowtitle "Rotating Cube with textures coded by UEZ"

Dim as String aFiles(5) = {"De.bmp", "Tr.bmp", "Gb.bmp", "Us.bmp", "Gr.bmp", "Ja.bmp"}
For i As Ubyte = 0 To 5
   ImgInfo(i).img = Imagecreate(img_w, img_h)
    If FileExists(CurDir & "\" & aFiles(i)) = 0 Then
        select case i
            case 0
                ExtractDe()
            Case 1
                ExtractTr()
            Case 2
                ExtractGb()
            Case 3
                ExtractUs()
            Case 4
                ExtractGr()
            Case 5
                ExtractJa()
        end select
    end if
    Bload(aFiles(i), ImgInfo(i).img)
Next
Img_Dest = Imagecreate(scrw, scrh, 0, 32)
Img_Bg = Imagecreate(scrw, scrh, &h50505050, 32)

Imageinfo(ImgInfo(0).img, , , , ImgInfo(0).pitch, ImgInfo(0).imgdata)
Imageinfo(ImgInfo(1).img, , , , ImgInfo(1).pitch, ImgInfo(1).imgdata)
Imageinfo(ImgInfo(2).img, , , , ImgInfo(2).pitch, ImgInfo(2).imgdata)
Imageinfo(ImgInfo(3).img, , , , ImgInfo(3).pitch, ImgInfo(3).imgdata)
Imageinfo(ImgInfo(4).img, , , , ImgInfo(4).pitch, ImgInfo(4).imgdata)
Imageinfo(ImgInfo(5).img, , , , ImgInfo(5).pitch, ImgInfo(5).imgdata)
Imageinfo(Img_Dest, , , , pitch_d, imgData_d)



'       0 -- - - - 1
'     / |        / |
'    4 - -  - - 5  |
'    |  |       |  |
'    |  3 -- - -|- 2
'    | /        | /   
'    7 - -  - - 6

Dim Shared As DPOINT aCoords(0 To 7), aTrapezoid(0 To 3)

aCoords(0).x = -fCube_Size : aCoords(0).y = -fCube_Size : aCoords(0).z = -fCube_Size
aCoords(1).x =  fCube_Size : aCoords(1).y = -fCube_Size : aCoords(1).z = -fCube_Size
aCoords(2).x =  fCube_Size : aCoords(2).y =  fCube_Size : aCoords(2).z = -fCube_Size
aCoords(3).x = -fCube_Size : aCoords(3).y =  fCube_Size : aCoords(3).z = -fCube_Size
aCoords(4).x = -fCube_Size : aCoords(4).y = -fCube_Size : aCoords(4).z =  fCube_Size
aCoords(5).x =  fCube_Size : aCoords(5).y = -fCube_Size : aCoords(5).z =  fCube_Size
aCoords(6).x =  fCube_Size : aCoords(6).y =  fCube_Size : aCoords(6).z =  fCube_Size
aCoords(7).x = -fCube_Size : aCoords(7).y =  fCube_Size : aCoords(7).z =  fCube_Size

Dim As Integer mx, my, mw, mwo

SetMouse iCenterX, iCenterY

Dim As Ushort iFPS = 0, iFPS_current = 0
Dim as Boolean bOk

Dim As Double fTimer = Timer

Do
   'Line Img_Dest, (0, 0) - (scrw, scrh), Rgb(64, 64, 64), BF
   Put Img_Dest, (0, 0), Img_Bg, PSet
   Getmouse mx, my, mw
   
   For j As Ubyte = 0 To 7
      Calculate((iCenterY - my) / iMouseSense * fRad, (-iCenterX + mx) / iMouseSense * fRad, j)
   Next
   
   DrawCube(7, 6, 4, 5, 0) 'front
   DrawCube(1, 2, 0, 3, 1) 'back
   DrawCube(0, 3, 4, 7, 2) 'left
   DrawCube(6, 2, 5, 1, 3) 'right
   DrawCube(5, 1, 4, 0, 4) 'top
   DrawCube(3, 2, 7, 6, 5) 'bottom
   
   Put (0, 0), Img_Dest, PSet
   
    'zoom
    #Macro Zoom(fFactor)
        For j as UByte = 0 to 7
            aCoords(j).x *= fFactor
            aCoords(j).y *= fFactor
            aCoords(j).z *= fFactor
        next 
    #EndMacro
     
    mwo -= mw
    If mwo <> 0 then
        Select Case mwo
            case -1
                If fZoomCounter > 0.15 Then
                    fZoomCounter *= fZoomMinus
                    Zoom(fZoomMinus)
                End If
            Case else
                If fZoomCounter < 1.90 Then
                    fZoomCounter *= fZoomPlus
                    Zoom(fZoomPlus)
                End If
        end Select
    end if
    mwo = mw
   
   Draw String(1, 1), iFPS_current & " fps", Rgb(&hF0, &hF0, &hF0)
   Flip

   If Timer - fTimer > 0.99 Then
      iFPS_current = iFPS
      iFPS = 0
      fTimer = Timer
   Else
      iFPS += 1
   Endif
   
   Sleep (1, 1)
Loop Until Inkey = Chr(27)

For i As Ubyte = 0 To 5
   Imagedestroy(ImgInfo(i).img)
Next
Imagedestroy(Img_Dest)
Imagedestroy(Img_Bg)


Sub Calculate(fAngleX As Double, fAngleY As Double, iPos As Ubyte)
   Dim As Double py, pz
   py = aCoords(iPos).y
   pz = -aCoords(iPos).x * Sin(fAngleY) + aCoords(iPos).z * Cos(fAngleY)
   aCoords(iPos).x   = aCoords(iPos).x * Cos(fAngleY) + aCoords(iPos).z * Sin(fAngleY)
   aCoords(iPos).y   = py * Cos(fAngleX) - pz * Sin(fAngleX)
   aCoords(iPos).z   = py * Sin(fAngleX) + pz * Cos(fAngleX)
End Sub

Sub DrawCube(p1 As Ubyte, p2 As Ubyte, p3 As Ubyte, p4 As Ubyte, img As Ubyte)
   Dim As Double k1, k2, k3, k4, x1, y1, x2, y2, x3, y3, x4, y4, z1, z2, z3, cor
   
   cor = (1 + aCoords(p1).z / iPersp_correction)
   x1 = aCoords(p1).x * cor
   y1 = aCoords(p1).y * cor
   z1 = aCoords(p1).z
   
   cor = (1 + aCoords(p2).z / iPersp_correction)
   x2 = aCoords(p2).x * cor
   y2 = aCoords(p2).y * cor
   z2 = aCoords(p2).z
   
   cor = (1 + aCoords(p3).z / iPersp_correction)
   x3 = aCoords(p3).x * cor
   y3 = aCoords(p3).y * cor
   z3 = aCoords(p3).z
   
   cor = (1 + aCoords(p4).z / iPersp_correction)
   x4 = aCoords(p4).x * cor
   y4 = aCoords(p4).y * cor

   k1 = x1 - x2
   k2 = y3 - y2
   k3 = y1 - y2
   k4 = x3 - x2   
   
   If (k1 * k2 - k3 * k4) > 0.0 Then
      aTrapezoid(0).x = iCenterX + x1:     aTrapezoid(0).y = iCenterY + y1
      aTrapezoid(1).x = iCenterX + x2:     aTrapezoid(1).y = iCenterY + y2
      aTrapezoid(2).x = iCenterX + x3:     aTrapezoid(2).y = iCenterY + y3
      aTrapezoid(3).x = iCenterX + x4:     aTrapezoid(3).y = iCenterY + y4   
      Trapezoid(aTrapezoid(), img_w, img_h, img, ((aCoords(p1).z + aCoords(p2).z + aCoords(p3).z + aCoords(p4).z) shr 2) / fMin_brightness)
      /'
      Line Img_Dest, (aTrapezoid(0).x, aTrapezoid(0).y) - (aTrapezoid(1).x, aTrapezoid(1).y), Rgb(0, 0, 0)
      Line Img_Dest, (aTrapezoid(1).x, aTrapezoid(1).y) - (aTrapezoid(3).x, aTrapezoid(3).y), Rgb(0, 0, 0)
      Line Img_Dest, (aTrapezoid(3).x, aTrapezoid(3).y) - (aTrapezoid(2).x, aTrapezoid(2).y), Rgb(0, 0, 0)
      Line Img_Dest, (aTrapezoid(2).x, aTrapezoid(2).y) - (aTrapezoid(0).x, aTrapezoid(0).y), Rgb(0, 0, 0)
        '/
   Endif
End Sub

Function Transform(x As Short, y As Short, ImgWidth As Ushort, ImgHeight As Ushort, Points() As DPOINT) As DPOINT
   Dim As Ushort ww = (ImgWidth - 1), hh = (ImgHeight - 1)
   Dim As Double a, b, c, d = img_w * hh
   Dim As DPOINT Result
   'x
   b = (Points(1).x - Points(0).x) / ww
   c = (Points(2).x - Points(0).x) / hh
   a = (Points(3).x - hh * c - Points(0).x - ww * b) / d
   Result.x = x * (y * a + b) + y * c + Points(0).x
   'y
   b = (Points(2).y - Points(0).y) / hh
   c = (Points(1).y - Points(0).y) / ww
   a = (Points(3).y - hh * b - ww * c - Points(0).y) / d
   Result.y =  y * (x * a + b) + x * c + Points(0).y
   Return Result
End Function

Sub Trapezoid(aPoints() As DPOINT, ww As Ushort, hh As Ushort, img As Ubyte, fBrightness As Double)
   Dim As Ushort xx, yy
   Dim As DPOINT Points
   Dim As Ulong iCol, iCol2
   For y As Ushort = 0 To hh - 1
      For x As Ushort = 0 To ww - 1
         Points = Transform(x, y, ww, hh, aPoints())
            If Not (Points.x < 1 or Points.x > scrw - 2 or Points.y < 1 or Points.y > scrh - 2) then
                'Points.x = Iif(Points.x < 1, 1, Iif(Points.x > scrw - 2, scrw - 2, Points.x))
                'Points.y = Iif(Points.y < 1, 1, Iif(Points.y > scrh - 2, scrh - 2, Points.y))
                xx = Points.x
                yy = Points.y
                iCol = *Cptr(Ulong ptr, ImgInfo(img).imgdata + y * ImgInfo(img).pitch + x Shl 2)
                iCol2 = Rgb(_Min(255, _Red(iCol) * fBrightness), _Min(255, _Green(iCol) * fBrightness), _Min(_Blue(iCol) * fBrightness, 255))
                If fZoomCounter > 0.75 then
                    PixelSet(xx - 1, yy - 1, iCol2)
                    PixelSet(xx, yy - 1, iCol2)
                    PixelSet(xx + 1, yy - 1, iCol2)
                    PixelSet(xx - 1, yy, iCol2)
                    PixelSet(xx, yy, iCol2)
                    PixelSet(xx + 1, yy, iCol2)
                    PixelSet(xx - 1, yy + 1, iCol2)
                    PixelSet(xx, yy + 1, iCol2)
                    PixelSet(xx + 1, yy + 1, iCol2)
                Else
                    PixelSet(xx, yy, iCol2)
                End If
            End If
      Next x
   Next y   
End Sub

'Generated by FB File2Bas Code Generator v0.80 build 2019-01-05 beta by UEZ

__Grbmp:
Data 3,1,21366,1995,"Base91"
Data "?xM7e2rTH´AAbBVxWcC´´V@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uDf#|kuYV+>D´HAeA{G=,gO7`Ki>´´C´>a^,CPA8AO+HAeAdBY4#z<er´xX}ytZh6G1avgByKk_6CJV+>BACglEDwEFG^dsf2l5VW8A6CJV8A6CJVBtAAYA8WPo;1FA2!A~p?D´HA&_BtHAeA@AFBB2B.~&m_BtHAeAdBKC@Q{eBA`~wA[BXL3A"


Sub CreateFile(sFilename as String, sBase91 as String, iLines As Ulong, bCompressed As Ulong, iFileSize As Ulong, iCompressedSize As Ulong)
   Dim As Ulong l
   Dim As Ubyte Ptr aBinary = Base91Decode(sBase91, l)
   Dim As Boolean bError = False
   If bCompressed Then
      If iCompressedSize <> l Then bError = TRUE
   Else
      If iFileSize <> l Then bError = TRUE
   Endif
   If bError = TRUE Then
      ? "Something went wrong"
      End
   End If
   
   Dim As Long hFile = Freefile()
   Open Curdir & "\" & sFilename For Binary Access Write As #hFile

   If bCompressed Then
        Dim as UByte Ptr aBinaryC = _WinAPI_LZNTDecompress(aBinary, iFileSize, iCompressedSize)
        Put #hFile, 0, aBinaryC[0], iFileSize
        Close #hFile
        Deallocate (aBinaryC)
    Else
        Put #hFile, 0, aBinary[0], iFileSize
        Close #hFile
   Endif
    aBinary = 0
End Sub

Sub ExtractDe()
    Dim As String sBaseType
   Dim As Ulong iLines, bCompressed, iFileSize, iCompressedSize
   Restore __Debmp:
   Read iLines
   Read bCompressed
   Read iFileSize
   Read iCompressedSize
   Read sBaseType
    Dim As String sBase91, aB91(1)
   For i As Ushort = 0 To iLines - 1
      Read aB91(0)
      sBase91 &= aB91(0)
   Next   
    CreateFile("De.bmp", sBase91, iLines, bCompressed, iFileSize, iCompressedSize)
End Sub

Sub ExtractGb()
    Dim As String sBaseType
   Dim As Ulong iLines, bCompressed, iFileSize, iCompressedSize
   Restore __Gbbmp:
   Read iLines
   Read bCompressed
   Read iFileSize
   Read iCompressedSize
   Read sBaseType
    Dim As String sBase91, aB91(1)
   For i As Ushort = 0 To iLines - 1
      Read aB91(0)
      sBase91 &= aB91(0)
   Next   
    CreateFile("Gb.bmp", sBase91, iLines, bCompressed, iFileSize, iCompressedSize)
End Sub

Sub ExtractGr()
    Dim As String sBaseType
   Dim As Ulong iLines, bCompressed, iFileSize, iCompressedSize
   Restore __Grbmp:
   Read iLines
   Read bCompressed
   Read iFileSize
   Read iCompressedSize
   Read sBaseType
    Dim As String sBase91, aB91(1)
   For i As Ushort = 0 To iLines - 1
      Read aB91(0)
      sBase91 &= aB91(0)
   Next   
    CreateFile("Gr.bmp", sBase91, iLines, bCompressed, iFileSize, iCompressedSize)
End Sub

Sub ExtractJa()
    Dim As String sBaseType
   Dim As Ulong iLines, bCompressed, iFileSize, iCompressedSize
   Restore __Jabmp:
   Read iLines
   Read bCompressed
   Read iFileSize
   Read iCompressedSize
   Read sBaseType
    Dim As String sBase91, aB91(1)
   For i As Ushort = 0 To iLines - 1
      Read aB91(0)
      sBase91 &= aB91(0)
   Next   
    CreateFile("Ja.bmp", sBase91, iLines, bCompressed, iFileSize, iCompressedSize)
End Sub

Sub ExtractTr()
    Dim As String sBaseType
   Dim As Ulong iLines, bCompressed, iFileSize, iCompressedSize
   Restore __Trbmp:
   Read iLines
   Read bCompressed
   Read iFileSize
   Read iCompressedSize
   Read sBaseType
    Dim As String sBase91, aB91(1)
   For i As Ushort = 0 To iLines - 1
      Read aB91(0)
      sBase91 &= aB91(0)
   Next   
    CreateFile("Tr.bmp", sBase91, iLines, bCompressed, iFileSize, iCompressedSize)
End Sub

Sub ExtractUs()
    Dim As String sBaseType
   Dim As Ulong iLines, bCompressed, iFileSize, iCompressedSize
   Restore __Usbmp:
   Read iLines
   Read bCompressed
   Read iFileSize
   Read iCompressedSize
   Read sBaseType
    Dim As String sBase91, aB91(1)
   For i As Ushort = 0 To iLines - 1
      Read aB91(0)
      sBase91 &= aB91(0)
   Next   
    CreateFile("Us.bmp", sBase91, iLines, bCompressed, iFileSize, iCompressedSize)
End Sub

Function Base91Decode(sString As String, Byref iBase91Len As Ulong) As Ubyte Ptr
   Dim As String sB91, sDecoded
   sB91 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_`{|}~´" '´ instead of "
   Dim As Long i, n = 0, c, b = 0, v = -1

   Dim aChr(0 To Len(sString) - 1) As String
   For i = 0 To Ubound(aChr)             
      aChr(i) = Mid(sString, i + 1, 1)
   Next
   
   For i = 0 To Ubound(aChr)
      c = Instr(sB91, aChr(i)) - 1
      If v < 0 Then
         v = c
      Else
         v += c * 91
         b = b Or (v Shl n)
         n += 13 + (((v And 8191) <= 88) * -1)
         Do Until  (n > 7)=0
            sDecoded &= Chr(b And 255)
            b = b Shr 8
            n -= 8
         Loop
         v = -1
      Endif
    Next
    If (v + 1) Then
        sDecoded &= Chr((b Or (v Shl n)) And 255)
    End If
    iBase91Len = Len(sDecoded)
       
    'workaround for multiple embedded file other crash will occure
    Static As Ubyte aReturn(0 To iBase91Len - 1)
    Redim aReturn(0 To iBase91Len - 1) As Ubyte
     
    For i = 0 To iBase91Len - 1 'convert result String To ascii code values
        aReturn(i) = Asc(sDecoded, i + 1)
    Next
    Return @aReturn(0) 'Return Pointer To the array
End Function

Function _WinAPI_LZNTDecompress(aBinary As Ubyte Ptr, iFileSize As Ulong, iCompressedSize As Ulong) As Ubyte Ptr
   #Define COMPRESSION_FORMAT_LZNT1 2
   
   Dim As Any Ptr hLib = Dylibload("Ntdll.dll")
   Dim pRtlDecompressBuffer As Function _
                (Byval CompressionFormat As Ushort, _
                 Byval UncompressedBuffer As Ubyte Ptr, _
                 Byval UncompressedBufferSize As Ulong, _
                 Byval CompressedBuffer As Ubyte Ptr, _
                 Byval CompressedBufferSize As Ulong, _
                 Byval FinalUncompressedSize As Ulong Ptr) As Ulong
   pRtlDecompressBuffer = Dylibsymbol(hLib, "RtlDecompressBuffer") 'https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntifs/nf-ntifs-rtldecompressbuffer
 
   Dim As Ubyte Ptr pDecompress = Allocate(iFileSize)
   Dim As Ulong iUSize
   Dim As Ulong iReturn = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, _
                                    pDecompress, _
                                    iFileSize, _
                                    aBinary, _
                                    iCompressedSize, _
                                    @iUSize)
   Dylibfree(hLib)
   Return pDecompress
End Function


If you want to see it with larger images visit pastebin.com



I assume that this code will not run with other os than windows because of the decompress function in Ntdll.dll which is required to uncompress and save the bitmaps to disk.

¯\_(ツ)_/¯

Update1: added zoom option. Use mouse wheel to zoom in/out
Update2: small modification in Trapezoid sub.
Last edited by UEZ on Feb 24, 2019 17:09, edited 3 times in total.
dodicat
Posts: 5655
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Rotating Cube with textures build 2019-02-22

Postby dodicat » Feb 22, 2019 12:03

Very nice UEZ.
Turkey is the one I have not visited.
I now have six flags on my desktop, but they look OK, so I'll leave them there.
Here is similar, but for the gambler, not the tourist.

Code: Select all

Const pi=4*Atn(1)

Function Filter(Byref tim As Ulong Pointer,_
    Byval rad As Single,_
    Byval destroy As Integer=1,_
    Byval fade As Integer=0) As Ulong Pointer
    #define map(a,b,_x_,c,d) ((d)-(c))*((_x_)-(a))/((b)-(a))+(c)
    If fade<0 Then fade=0:If fade>100 Then fade=100
    Type p2
        As Integer x,y
        As Ulong col
    End Type
    #macro _ppoint(_x,_y,colour)
    pixel=row+pitch*(_y)+(_x)*4
    (colour)=*pixel
    #endmacro
    #macro ppset(_x,_y,colour)
    pixel=row+pitch*(_y)+(_x)*4
    *pixel=(colour)
    #endmacro
    #macro average()
    ar=0:ag=0:ab=0:inc=0
    xmin=x:If xmin>rad Then xmin=rad
    xmax=rad:If x>=(_x-1-rad) Then xmax=_x-1-x
    ymin=y:If ymin>rad Then ymin=rad
    ymax=rad:If y>=(_y-1-rad) Then ymax=_y-1-y
    For y1 As Integer=-ymin To ymax
        For x1 As Integer=-xmin To xmax
            inc=inc+1
            ar=ar+(NewPoints(x+x1,y+y1).col Shr 16 And 255)
            ag=ag+(NewPoints(x+x1,y+y1).col Shr 8 And 255)
            ab=ab+(NewPoints(x+x1,y+y1).col And 255)
        Next x1
    Next y1
    If fade=0 Then
        averagecolour=Rgb(ar/(inc),ag/(inc),ab/(inc))
    Else
        averagecolour=Rgb(fd*ar/(inc),fd*ag/(inc),fd*ab/(inc))
    End If
    #endmacro
    Dim As Single fd=map(0,100,fade,1,0)
    Dim As Integer _x,_y
    Imageinfo tim,_x,_y
    Dim  As Ulong Pointer im=Imagecreate(_x,_y)
    Dim As Integer pitch
    Dim  As Any Pointer row
    Dim As Ulong Pointer pixel
    Dim As Ulong col
    Imageinfo tim,,,,pitch,row
    Dim As p2 NewPoints(_x-1,_y-1)
    For y As Integer=0 To (_y)-1
        For x As Integer=0 To (_x)-1
            _ppoint(x,y,col)
            NewPoints(x,y)=Type<p2>(x,y,col)
        Next x
    Next y
    Dim As Ulong averagecolour
    Dim As Integer ar,ag,ab
    Dim As Integer xmin,xmax,ymin,ymax,inc
    Imageinfo im,,,,pitch,row
    For y As Integer=0 To _y-1
        For x As Integer=0 To _x-1 
            average()
            ppset((NewPoints(x,y).x),(NewPoints(x,y).y),averagecolour)
        Next x
    Next y
    If destroy Then Imagedestroy tim: tim = 0
    Function= im
End Function

Type v3
    As Single x,y,z
    As Ulong c
End Type

Type _float
    As Single x,y,z
End Type

Type sincos 'FLOATS for angles
    As Single sx,sy,sz
    As Single cx,cy,cz
    Declare Static Function construct(As Single,As Single,As Single) As sincos
End Type

Function distance(p1 As v3,p2 As v3) As Single
    Return Sqr((p1.x-p2.x)^2 + (p1.y-p2.y)^2)
End Function

Function map(a As Single,b As Single,x As Single,c As Single,d As Single) As Single
    Return ((d)-(c))*((x)-(a))/((b)-(a))+(c)
End Function

Function dot(v1 As v3,v2 As v3) As Single
    Dim As Single d1=Sqr(v1.x*v1.x + v1.y*v1.y + v1.z*v1.z)
    Dim As Single d2=Sqr(v2.x*v2.x + v2.y*v2.y + v2.z*v2.z)
    Dim As Single v1x=v1.x/d1,v1y=v1.y/d1,v1z=v1.z/d1 'normalize
    Dim As Single v2x=v2.x/d2,v2y=v2.y/d2,v2z=v2.z/d2 'normalize
    Return v1x*v2x+v1y*v2y+v1z*v2z  'dot product
End Function

Function sincos.construct(x As Single,y As Single,z As Single) As sincos
    Return   Type <sincos>(Sin(x),Sin(y),Sin(z), _
    Cos(x),Cos(y),Cos(z))
End Function
Dim Shared As v3 eyepoint

Sub load(im As Any Ptr,w() As V3,Byref ctr As V3,T As Long)
    Dim As Ulong c,bc=Rgb(255,0,255)
    Dim As Integer pitch
    Dim As Any Ptr row
    Dim As Ulong Ptr pixel
    Dim As Integer ddx,ddy,count
    Imageinfo im,ddx,ddy,,pitch,row
    For y As Long=0 To ddy-1
        For x As Long=0 To ddx-1
            pixel=row+pitch*(y)+(x) Shl 2
            (c)=*pixel
            count+=1
            Redim Preserve w(1 To count)
            Select Case As Const T
            Case 1 :w(count)=Type(x,y,0,c) 'front
            Case 2 :w(count)=Type(y,0,x,c)'top
            Case 3 :w(count)=Type(y,x,ddy,c)'back
            Case 4 :w(count)=Type(x,ddy,y,c)'base
            Case 5 :w(count)=Type(ddx,y,x,c)'r side
            Case 6 :w(count)=Type(0,x,y,c)'l side
            End Select
            If x=ddx\2 Andalso y=ddy\2 Then ctr=w(count):ctr.c=count
        Next x
    Next y
End Sub

Function Rotate(c As V3,p As V3,a As sincos,scale As _float=Type<_float>(1,1,1)) As V3
    Dim As Single dx=p.x-c.x,dy=p.y-c.y,dz=p.z-c.z
    Return Type<V3>((scale.x)*((a.cy*a.cz)*dx+(-a.cx*a.sz+a.sx*a.sy*a.cz)*dy+(a.sx*a.sz+a.cx*a.sy*a.cz)*dz)+c.x,_
    (scale.y)*((a.cy*a.sz)*dx+(a.cx*a.cz+a.sx*a.sy*a.sz)*dy+(-a.sx*a.cz+a.cx*a.sy*a.sz)*dz)+c.y,_
    (scale.z)*((-a.sy)*dx+(a.sx*a.cy)*dy+(a.cx*a.cy)*dz)+c.z,p.c)
End Function

Sub RotateImage(wa() As V3,angle As _float,Byref centroid As V3,ctr As V3,sc As Single=1.75,nflag As Long,n() As V3,flag As Byte)
    ' #define map(a,b,x,c,d) ((d)-(c))*((x)-(a))/((b)-(a))+(c)
    Var s=sincos.construct(angle.x,angle.y,angle.z)
    Var g=Rotate(Type(0,0,0),n(nflag),s)
    Var dt=dot(g,Type(.5,1,0))
    Var cp=map(-1,1,dt,.2,1)
    Dim As Ubyte rd,gr,bl
    Dim  As Single dx,dy,dz,w
    Dim As Single SinAX=Sin(angle.x)
    Dim As Single SinAY=Sin(angle.y)
    Dim As Single SinAZ=Sin(angle.z)
    Dim As Single CosAX=Cos(angle.x)
    Dim As Single CosAY=Cos(angle.y)
    Dim As Single CosAZ=Cos(angle.z)
    Dim As V3 centre=Type(100,100,100) '=ctr'the centre of rotation (fulcrum)
    Dim As V3 result
    Dim As Single dp=.6*sc
    Dim As Ulong cc=Rgb(255,0,255)
    For z As Long=Lbound(wa) To Ubound(wa)
        dx=wa(z).x-centre.x
        dy=wa(z).y-centre.y
        dz=wa(z).z-centre.z
        Result.x=sc*((Cosay*Cosaz)*dx+(-Cosax*Sinaz+Sinax*Sinay*Cosaz)*dy+(Sinax*Sinaz+Cosax*Sinay*Cosaz)*dz)+centre.x
        result.y=sc*((Cosay*Sinaz)*dx+(Cosax*Cosaz+Sinax*Sinay*Sinaz)*dy+(-Sinax*Cosaz+Cosax*Sinay*Sinaz)*dz)+centre.y
        result.z=sc*((-Sinay)*dx+(Sinax*Cosay)*dy+(Cosax*Cosay)*dz)+centre.z'-100
        If z=ctr.c Then  centroid=result:If flag=0 Then Exit Sub
        If flag Then
            'this bit is to add perspective ================
            w = 1 + (result.z/eyepoint.z)
            result.x = (result.x-eyepoint.x)/w+eyepoint.x +300
            result.y = (result.y-eyepoint.y)/w+eyepoint.y +200
            result.z = (result.z-eyepoint.z)/w+eyepoint.z
            rd= Cptr(Ubyte Ptr,@wa(z).c)[2]
            gr= Cptr(Ubyte Ptr,@wa(z).c)[1] 'handle the shader
            bl= Cptr(Ubyte Ptr,@wa(z).c)[0]
            rd=cp*rd:gr=cp*gr:bl=cp*bl
            Line(result.x-dp,result.y-dp)-(result.x+dp,result.y+dp),Rgb(rd,gr,bl),bf
        End If
    Next z
End Sub

'sort by .z distance
Sub sort(array() As V3,painter() As Long)
    For p1 As Long  = 1 To Ubound(array,1) - 1
        For p2 As Long  = p1 + 1 To Ubound(array,1) 
            If array(p1).z<array(p2).z Then Swap painter(p1),painter(p2):Swap array(p1),array(p2)
        Next p2
    Next p1
End Sub

Function Regulate(Byval MyFps As Long,Byref fps As Long) As Long
    Static As Double timervalue,_lastsleeptime,t3,frames
    Var t=Timer
    frames+=1
    If (t-t3)>=1 Then t3=t:fps=frames:frames=0
    Var sleeptime=_lastsleeptime+((1/myfps)-T+timervalue)*1000
    If sleeptime<1 Then sleeptime=1
    _lastsleeptime=sleeptime
    timervalue=T
    Return sleeptime
End Function

Sub setdice(i() As Any Ptr,size As Long) 'create images
    Type v
        As Long x,y
    End Type
    Dim As v p(1 To 7)
    Redim i(1 To 6)
    Dim As Long sz=size,dt=sz/12
    p(1)=Type(sz/4,sz/4)
    p(2)=Type(sz/4,sz/2)
    p(3)=Type(sz/4,3*sz/4)
    p(4)=Type(3*sz/4,sz/4)
    p(5)=Type(3*sz/4,sz/2)
    p(6)=Type(3*sz/4,3*sz/4)
    p(7)=Type(sz/2,sz/2)
   
    For n As Long=1 To 6
        i(n)=Imagecreate(sz,sz,Rgb(200,200,100))
        ''line i(n),(0,0)-(sz-1,sz-1),0,b
        Select Case n
        Case 1
            Circle i(1),(p(7).x,p(7).y),dt,0,,,,f
        Case 2
            Circle i(2),(p(1).x,p(1).y),dt,0,,,,f
            Circle i(2),(p(6).x,p(6).y),dt,0,,,,f
        Case 3
            Circle i(3),(p(1).x,p(1).y),dt,0,,,,f
            Circle i(3),(p(7).x,p(7).y),dt,0,,,,f
            Circle i(3),(p(6).x,p(6).y),dt,0,,,,f
        Case 4
            Circle i(4),(p(1).x,p(1).y),dt,0,,,,f
            Circle i(4),(p(3).x,p(3).y),dt,0,,,,f
            Circle i(4),(p(4).x,p(4).y),dt,0,,,,f
            Circle i(4),(p(6).x,p(6).y),dt,0,,,,f
        Case 5
            Circle i(5),(p(1).x,p(1).y),dt,0,,,,f
            Circle i(5),(p(3).x,p(3).y),dt,0,,,,f
            Circle i(5),(p(4).x,p(4).y),dt,0,,,,f
            Circle i(5),(p(6).x,p(6).y),dt,0,,,,f
            Circle i(5),(p(7).x,p(7).y),dt,0,,,,f
        Case 6
            For z As Long=1 To 6
                Circle i(6),(p(z).x,p(z).y),dt,0,,,,f
            Next z
        End Select
    Next
End Sub

Sub handlemouse(angle As _float,mx As Long,my As Long)
    Static As Integer dd=1000
    Var dx=map(0,dd,400-mx,0,.13)
    Var dy=map(0,dd,300-my,0,pi/2)
    angle.x+=dx+0  :If angle.x>=2*pi Then angle.x=0
    angle.y=dy
    If my=-1 Then my=300
    Var zz=300-my
    angle.z=pi/2+(map(-300,300,zz,-.2,.2))*(400-mx)/400   
End Sub


'============================ set up   ==========================================

Screen 19,32,2

Dim As Any Ptr image(),backdrop=Imagecreate(800,600)

For n As Long=0 To 800
    Line backdrop,(n,0)-(n,600),Rgb(n/4,255-n/4,n/40)
Next n

Dim As V3 norm(1 To 6)={(0,0,1),(0,1,0),(0,0,-1),(0,-1,0),(-1,0,0),(1,0,0)}

eyepoint=Type(100,100,800) 'behind image centres

setdice(image(),200)

For n As Long=1 To 6
    image(n)=filter(image(n),1)
Next

Redim As V3 w1(),w2(),w3(),w4(),w5(),w6()
Dim As V3 centroid(1 To 6),ctr(1 To 6)
load(image(1),w1(),ctr(1),1)''
load(image(2),w2(),ctr(2),2)
load(image(6),w3(),ctr(3),3)''
load(image(5),w4(),ctr(4),4)
load(image(4),w5(),ctr(5),5)
load(image(3),w6(),ctr(6),6)
'Dim As Single pi=4*Atn(1)
Var s=sincos.construct(0,pi/2,0)

#macro turn(w,k)

For n As Long=Lbound(w) To Ubound(w)
    w(n)=rotate(Type(k,k,0),w(n),s)
    w(n).x-=k
Next
#endmacro
'set initial aspect
turn(w1,200)
turn(w2,200)
turn(w3,200)
turn(w4,200)
turn(w5,200)
turn(w6,200)
turn(norm,0)

Dim As Single dx,dy,dz,dd=1000
Dim As _float angle
Dim As Long fps,mx,my
Dim As Long painter(1 To 6)
For n As Long=1 To 6:painter(n)=n:Next n
   
    angle.z=pi/2  'offset .z by 90 degrees
   
    Screenset 1,0
    Do
        Getmouse mx,my
        handlemouse(angle,mx,my)
        'sort by .z to reset painter and centroids
        sort(centroid(),painter())
       
        Cls
        Put(0,0),backdrop,Pset
        Draw String(20,20), "framerate "&fps
       
        'draw in 3D order, cull hidden faces
        For n As Long=1 To 6
            Select Case As Const painter(n)
            Case 1:RotateImage(w1(),angle,centroid(1),ctr(1),,1,norm(),n>3)
            Case 2:RotateImage(w2(),angle,centroid(2),ctr(2),,2,norm(),n>3)
            Case 3:RotateImage(w3(),angle,centroid(3),ctr(3),,3,norm(),n>3)
            Case 4:RotateImage(w4(),angle,centroid(4),ctr(4),,4,norm(),n>3)
            Case 5:RotateImage(w5(),angle,centroid(5),ctr(5),,5,norm(),n>3)
            Case 6:RotateImage(w6(),angle,centroid(6),ctr(6),,6,norm(),n>3)
            End Select
        Next n
       
        Flip
        For n As Long=1 To 6:painter(n)=n:Next n 'reset the painter
            Sleep regulate(30,fps),1
        Loop Until Len(Inkey)
        Sleep
        For n As Long=1 To 6
            Imagedestroy image(n)
        Next n
        Imagedestroy backdrop
       
       
         

Your code runs well on 32 bits (especially -O3), but the best is -gen gas.
As usual 64 bits is jumpy here.
I shall post my Euroflag doodle again just before brexit with the flag suitably adjusted to celebrate the occasion.
Tested on the new 1.06 version.
Thank you.
UEZ
Posts: 308
Joined: May 05, 2017 19:59
Location: Germany

Re: Rotating Cube with textures build 2019-02-22

Postby UEZ » Feb 22, 2019 14:16

As always, well done dodicat. Did you create it from scratch? You are usually so fast providing your example.

One question: where is the code for transformation of the image to the cube? I didn't find it yet. ^^ Can it handle small image on large objects without
perforation?

Well, on my system "-gen gcc -Wc -Ofast -fpmode FAST -fpu SSE" using x64 is the fast settings. Getting ~110 fps. With -gen gas x86 ~37 fps.

Turkey is a wonderful country but current government is not the best choice to make the country great (again).
Last edited by UEZ on Feb 22, 2019 14:47, edited 1 time in total.
Tourist Trap
Posts: 2676
Joined: Jun 02, 2015 16:24

Re: Rotating Cube with textures build 2019-02-22

Postby Tourist Trap » Feb 22, 2019 14:28

dodicat wrote:Here is similar, but for the gambler, not the tourist.

I also do gamble casually!

Both pretty examples this said.
BasicCoder2
Posts: 3348
Joined: Jan 01, 2009 7:03

Re: Rotating Cube with textures build 2019-02-22

Postby BasicCoder2 » Feb 22, 2019 19:07

Both very nice rotating cube demos.

The compression of images into the source code is interesting. UEZ do you have code to make the data statements from images?

I would see the compression and decompression of images as a separate Tips and Tricks example.

UEZ's cube rotates toward the mouse. Dodi's cube will tip up or down but only rotates around the vertical axis.

I recognise some of Dodi's functions but the maths is beyond me. Maybe someone with the knowledge can break the maths down as a tutorial?
Or even show how to use Dodi's functions with their own set of pixel points.

What would be a nice is if someone had the ability to write a program that could draw textured polygons in a walk through 3d world.

Or a walk through 3d world that uses pixels instead of polygons. That is, a 3d version of the pixel based objects I used in this example I used for the ambulance as a rotatable isometric object.
viewtopic.php?f=15&t=27052
UEZ
Posts: 308
Joined: May 05, 2017 19:59
Location: Germany

Re: Rotating Cube with textures build 2019-02-22

Postby UEZ » Feb 22, 2019 23:13

BasicCoder2 wrote:Both very nice rotating cube demos.

The compression of images into the source code is interesting. UEZ do you have code to make the data statements from images?

I would see the compression and decompression of images as a separate Tips and Tricks example.

Well, I've written the converter with AutoIt which can be found here: FB File2Bas Code Generator v0.80 build 2019-01-05 beta.zip. Just start the exe and a small GUI with FB Logo will appear. You can use the rmb to change some settings. Just drag'n'drop some file to it and it will generate the FB code. Source code is included.

If I'm too bored I will try to convert it to FB. ^^

BasicCoder2 wrote:UEZ's cube rotates toward the mouse. Dodi's cube will tip up or down but only rotates around the vertical axis.

I recognise some of Dodi's functions but the maths is beyond me. Maybe someone with the knowledge can break the maths down as a tutorial?
Or even show how to use Dodi's functions with their own set of pixel points.

Look here for some information about the math: http://petercollingridge.appspot.com/3D ... ng-objects
BasicCoder2
Posts: 3348
Joined: Jan 01, 2009 7:03

Re: Rotating Cube with textures build 2019-02-22

Postby BasicCoder2 » Feb 24, 2019 21:15

UEZ wrote:Look here for some information about the math: http://petercollingridge.appspot.com/3D ... ng-objects

I have read those kinds of basic explanations and have posted some of my efforts to the forum including the rotating textured cube demo.
None of it is like the condensed maths Dodicat uses for a fast computation for converting 3d data to 2d display.
Also getting control over the cube's rotational position, as for example you can with Blender, would be a nice addition.
Paul Doe attempted to explain it with a flying paper plane example but it was all a bit complicated.
See example in general section of forum posts on positioning the cube.

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 4 guests