MapTriangle (3D) demos
#1
I'm going through old discs, a lot of my work doesn't work due to the need to fix many functions (it was written in QB64 1.3 where the functions were taken incorrectly - but the programs took this into account), I will gradually add ONLY things directly related to _MAPTRIANGLE in the 3D version to this thread.

The first thing I managed to bring to life, it's even in a video on my youtube channel, is a demonstration of how to project some movement into the hardware layer used by _MapTriangle 3D.

Here is a program that, on the Software layer, projects a 3D hardware layer on which the circle runs.


Tested in QB64PE 3.6.0

Code: (Select All)
Screen _NewImage(1024, 768, 32)
im& = _ScreenImage
img& = _CopyImage(im&, 33)
_FreeImage im&
SX0 = 0: SY0 = 0: SX1 = 0: SY1 = _Height: sx2 = _Width: sy2 = 0: sx3 = _Width: sy3 = _Height
DX0 = -2: DY0 = 2: DX1 = -2: DY1 = -2: DX2 = 2: DY2 = 2: DX3 = 2: DY3 = -2

'    SX0             SX2                                                                    y
'    dx0                                   X left = -   right = +                 - x      -z       +x
'                                          Y dole = -   nahore = +                         -y
'                                          Z vzadu = max - 10, normalne ale -1
'    SX1             SX3
tt = .01: t = .1
Do
    e& = ell&
    While _MouseInput: Wend
    Mx = _MouseX: My = _MouseY
    StredX = Mx
    t = t + tt: If t > _Pi(2) Or t < -_Pi(2) Then tt = tt * -1
    RR = Sin(t) - 4
    SS = Cos(t) - 10
    R = -Sin(t) * -2
    s = -Cos(t) * 2

    _MapTriangle (SX0, SY0)-(sx3, sy3)-(SX1, SY1), e& To(DX0 * R, DY0 * s, RR)-(DX3 * R, DY3 * s, SS)-(DX1 * R, DY1 * s, RR), 0, _Smooth
    _MapTriangle (SX0, SY0)-(sx3, sy3)-(sx2, sy2), e& To(DX0 * R, DY0 * s, RR)-(DX3 * R, DY3 * s, SS)-(DX2 * R, DY2 * s, SS), 0, _Smooth
    _Display
    _Limit 30
Loop



Function ell&
    Shared vx, vy, Mxx, Myy
    Locate 1, 1: Print "This is Software Screen."
    V& = _NewImage(1024, 768, 32)
    _Dest V&
    W = 1024: H = 768
    If Mxx = 0 Then Mxx = 10: Myy = 10
    vx = vx + Mxx: If vx > W Or vx < 0 Then Mxx = Mxx * -1
    vy = vy + Myy: If vy > H Or vy < 0 Then Myy = Myy * -1
    Cls , _RGB32(1, 55, 132)
    _PrintMode _KeepBackground
    Locate 11, 30: Print "This is Hardware Screen"
    For d = 0 To _Pi / 2 Step .2
        Line (vx - Sin(d) * 50, vy - Cos(d) * 50)-(vx + Sin(d) * 50, vy + Cos(d) * 50), , BF
    Next d
    _Dest 0
    ell& = _CopyImage(V&, 33)
    _FreeImage V&
End Function


Lets look the start and end of the ell& function. For each progression (!) a new software screen must be created, copied as a static hardware texture (33) and applied to the 3D environment. This solution is very CPU intensive and completely stupid. But it would be far more reasonable, in the case of the same animation running round and round, to take the individual frames of the animation, copy them as hardware images into the array, and then just paste the individual frames. This does not load the processor almost at all.

   


Reply


Messages In This Thread
MapTriangle (3D) demos - by Petr - 03-21-2023, 03:58 PM
RE: MapTriangle (3D) demos - by Petr - 03-21-2023, 05:47 PM
RE: MapTriangle (3D) demos - by mnrvovrfc - 03-24-2023, 04:33 AM
RE: MapTriangle (3D) demos - by bplus - 03-24-2023, 05:16 AM
RE: MapTriangle (3D) demos - by Petr - 03-24-2023, 10:58 PM
RE: MapTriangle (3D) demos - by mnrvovrfc - 03-24-2023, 11:32 PM
RE: MapTriangle (3D) demos - by bplus - 03-24-2023, 11:54 PM
RE: MapTriangle (3D) demos - by Petr - 03-26-2023, 04:53 PM
RE: MapTriangle (3D) demos - by MasterGy - 03-28-2023, 05:05 PM
RE: MapTriangle (3D) demos - by Petr - 03-28-2023, 07:42 PM



Users browsing this thread: 4 Guest(s)