[BB] Mandelbulb attempt with Blitz3D

Started by Filax, March 01, 2025, 08:38:37

Previous topic - Next topic

Filax

; ----------------------------------------
; Name : Mandelbulb By Filax/CreepyCat
; Date : (C)2025
; Site : https://github.com/BlackCreepyCat
; ----------------------------------------

Graphics3D 600,600,0,2
SetBuffer BackBuffer()

; Create and set up the camera
Global camera = CreateCamera()
PositionEntity camera,0,0,-2
CameraRange camera,0.1,100

; Create and set up the light
Global light = CreateLight(1)
PositionEntity light,5,5,5
LightColor light,255,255,255

; Define a custom type for storing 3D vectors
Type Vector3D
    Field x#,y#,z#
    Field entity
End Type

; Declare an array to store the Mandelbulb points and the count
Global mandelbulb.Vector3D[1000000]
Global pointCount = 0

; Set grid size and scale
Const GRID_SIZE =  80
Const SCALE# = 1.0

; Function to generate Mandelbulb points and render them as sprites
Function GenerateMandelbulb()
    For i = 0 To GRID_SIZE-1
        For j = 0 To GRID_SIZE-1
            edge = False
            For k = 0 To GRID_SIZE-1
                ; Map the coordinates to a -1 to 1 range
                x# = Map(i, 0, GRID_SIZE, -1, 1)
                y# = Map(j, 0, GRID_SIZE, -1, 1)
                z# = Map(k, 0, GRID_SIZE, -1, 1)
               
                ; Initialize Mandelbulb calculation variables
                zx# = 0
                zy# = 0
                zz# = 0
               
                n = 8
                maxiterations = 20
                iteration = 0
               
                ; Iterate through the Mandelbulb formula
                While True
                    r# = Sqr(zx*zx + zy*zy + zz*zz)
                    theta# = ATan2(Sqr(zx*zx+zy*zy), zz)
                    phi# = ATan2(zy, zx)
                   
                    newr# = r ^ n
                    newx# = newr * Sin(theta*n) * Cos(phi*n)
                    newy# = newr * Sin(theta*n) * Sin(phi*n)
                    newz# = newr * Cos(theta*n)
                   
                    zx# = newx + x
                    zy# = newy + y
                    zz# = newz + z
                   
                    iteration = iteration + 1
                   
                    ; Exit conditions for the iteration
                    If r > 2 Then
                        If edge Then edge = False
                        Exit
                    ElseIf iteration > maxiterations Then
                        If Not edge Then
                            edge = True
                            ; Store the generated point and create a corresponding sprite
                            mandelbulb[pointCount] = New Vector3D
                            mandelbulb[pointCount]\x = x
                            mandelbulb[pointCount]\y = y
                            mandelbulb[pointCount]\z = z
                            mandelbulb[pointCount]\entity = CreateSprite()
                           
                            ; Color the sprite based on the point's position
                            r = 128 + (x * 127)
                            g = 128 + (y * 127)
                            b = 128 + (z * 127)
                            EntityColor mandelbulb[pointCount]\entity,r,g,b
                            ScaleSprite mandelbulb[pointCount]\entity,0.003,0.003
                            PositionEntity mandelbulb[pointCount]\entity,x*SCALE,y*SCALE,z*SCALE
                            EntityFX mandelbulb[pointCount]\entity,1
                            pointCount = pointCount + 1
                        EndIf
                        Exit
                    EndIf
                Wend
            Next
        Next
    Next
   
    ; Save the generated points to a file
    file = WriteFile("mandelbulb.txt")
    For i = 0 To pointCount-1
        WriteLine file, mandelbulb[i]\x + " " + mandelbulb[i]\y + " " + mandelbulb[i]\z
    Next
    CloseFile file
End Function

; Mapping function to remap values from one range to another
Function Map#(value#, in_min#, in_max#, out_min#, out_max#)
    Return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
End Function

; Start the Mandelbulb generation
Print "Generation en cours... (peut prendre quelques secondes)"
GenerateMandelbulb()
Print "Points generes: " + pointCount
Delay 2000

; Control variables for auto-rotation
Global autoRotate = True

; Main loop to handle user input and camera controls
While Not KeyHit(1)
    ; Camera controls using the keyboard
    If KeyDown(200) Then MoveEntity camera,0,0,0.1  ; Forward
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1 ; Backward
    If KeyDown(203) Then TurnEntity camera,0,1,0    ; Left
    If KeyDown(205) Then TurnEntity camera,0,-1,0   ; Right
    If KeyDown(30) Then MoveEntity camera,0,0.1,0   ; Up (A)
    If KeyDown(44) Then MoveEntity camera,0,-0.1,0  ; Down (Z)
    If KeyDown(16) Then TurnEntity camera,1,0,0     ; Q - Pitch +
    If KeyDown(17) Then TurnEntity camera,-1,0,0    ; W - Pitch -
   
    ; Toggle automatic rotation with the 'R' key
    If KeyHit(19) Then autoRotate = Not autoRotate
   
    ; Apply automatic rotation if enabled
    If autoRotate Then
        For i = 0 To pointCount-1
            TurnEntity mandelbulb[i]\entity,0,1,0
        Next
    EndIf
   
    ; Render the 3D world
    RenderWorld
   
    ; Display useful information on the screen
    Text 10,10,"Points: " + pointCount
    ;Text 10,20,"FPS: " + FPS()
    Text 10,30,"Camera X: " + EntityX(camera)
    Text 10,40,"Camera Y: " + EntityY(camera)
    Text 10,50,"Camera Z: " + EntityZ(camera)
    Text 10,60,"Camera Pitch: " + EntityPitch(camera)
    Text 10,70,"Camera Yaw: " + EntityYaw(camera)
    Text 10,80,"Auto Rotate: " + autoRotate + " (R to toggle)"
   
    Flip
Wend

; Free all Mandelbulb sprites after the program ends
For i = 0 To pointCount-1
    FreeEntity mandelbulb[i]\entity
Next
End

But there is a bug, when i try to increase the point number (GRID_SIZE) the program crash on the renderword, i don't know why?
Maybe the good solution is to create a mesh with addvertex...


Filax

A different test with 2D plot : 

; ----------------------------------------
; Name : Mandelbulb By Filax/CreepyCat
; Date : (C)2025
; Site : https://github.com/BlackCreepyCat
; ----------------------------------------

; Set up a 600x600 2D graphics window
Graphics 600,600,0,2
SetBuffer BackBuffer()

; Define a type to store 3D points and their colors
Type Vector3D
    Field x#,y#,z#      ; 3D coordinates
    Field r,g,b         ; RGB color values
End Type

; Declare global array for Mandelbulb points and counter
Global mandelbulb.Vector3D[1000000]
Global pointCount = 0

; Constants for grid size and scale
Const GRID_SIZE = 60
Const SCALE# = 3

; Function to generate Mandelbulb points
Function GenerateMandelbulb()
    ; Iterate through 3D grid
    For i = 0 To GRID_SIZE-1
        For j = 0 To GRID_SIZE-1
            edge = False
            For k = 0 To GRID_SIZE-1
                ; Map grid coordinates to -1 to 1 range
                x# = Map(i, 0, GRID_SIZE, -1, 1)
                y# = Map(j, 0, GRID_SIZE, -1, 1)
                z# = Map(k, 0, GRID_SIZE, -1, 1)
               
                ; Initialize iteration variables
                zx# = 0
                zy# = 0
                zz# = 0
               
                n = 8              ; Power for Mandelbulb formula
                maxiterations = 20 ; Maximum iterations
                iteration = 0
               
                ; Mandelbulb iteration loop
                While True
                    r# = Sqr(zx*zx + zy*zy + zz*zz)           ; Radius
                    theta# = ATan2(Sqr(zx*zx+zy*zy), zz)      ; Theta angle
                    phi# = ATan2(zy, zx)                      ; Phi angle
                   
                    newr# = r ^ n                            ; Power n of radius
                    newx# = newr * Sin(theta*n) * Cos(phi*n) ; New x coordinate
                    newy# = newr * Sin(theta*n) * Sin(phi*n) ; New y coordinate
                    newz# = newr * Cos(theta*n)              ; New z coordinate
                   
                    zx# = newx + x  ; Update iteration variables
                    zy# = newy + y
                    zz# = newz + z
                   
                    iteration = iteration + 1
                   
                    ; Check exit conditions
                    If r > 2 Then
                        If edge Then edge = False
                        Exit
                    ElseIf iteration > maxiterations Then
                        If Not edge Then
                            edge = True
                            ; Store new point
                            mandelbulb[pointCount] = New Vector3D
                            mandelbulb[pointCount]\x = x * SCALE
                            mandelbulb[pointCount]\y = y * SCALE
                            mandelbulb[pointCount]\z = z * SCALE
                            ; Calculate point color based on position
                            mandelbulb[pointCount]\r = 128 + (x * 127)
                            mandelbulb[pointCount]\g = 128 + (y * 127)
                            mandelbulb[pointCount]\b = 128 + (z * 127)
                            pointCount = pointCount + 1
                        EndIf
                        Exit
                    EndIf
                Wend
            Next
        Next
    Next
   
    ; Save points to file
    file = WriteFile("mandelbulb.txt")
    For i = 0 To pointCount-1
        WriteLine file, mandelbulb[i]\x + " " + mandelbulb[i]\y + " " + mandelbulb[i]\z
    Next
    CloseFile file
End Function

; Utility function to map values between ranges
Function Map#(value#, in_min#, in_max#, out_min#, out_max#)
    Return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
End Function

; Variables for rotation and zoom control
Global rotX# = 0    ; X-axis rotation
Global rotY# = 0    ; Y-axis rotation
Global zoom# = 200  ; Zoom level

; Generate the Mandelbulb
Print "Generating... (may take a few seconds)"
GenerateMandelbulb()
Print "Generated points: " + pointCount
Delay 2000

; Main loop
While Not KeyHit(1)  ; Exit on ESC
    Cls  ; Clear screen
   
    ; Handle input controls
    If KeyDown(200) Then rotX = rotX + 1  ; Up arrow: rotate X up
    If KeyDown(208) Then rotX = rotX - 1  ; Down arrow: rotate X down
    If KeyDown(203) Then rotY = rotY + 1  ; Left arrow: rotate Y left
    If KeyDown(205) Then rotY = rotY - 1  ; Right arrow: rotate Y right
    If KeyDown(16) Then zoom = zoom + 2   ; Q: zoom in
    If KeyDown(17) Then zoom = zoom - 2   ; W: zoom out
   
    ; Render all points
    For i = 0 To pointCount-1
        ; Rotate around X axis
        y# = mandelbulb[i]\y * Cos(rotX) - mandelbulb[i]\z * Sin(rotX)
        z# = mandelbulb[i]\y * Sin(rotX) + mandelbulb[i]\z * Cos(rotX)
        x# = mandelbulb[i]\x
       
        ; Rotate around Y axis
        x2# = x * Cos(rotY) + z * Sin(rotY)
        z2# = -x * Sin(rotY) + z * Cos(rotY)
       
        ; Simple 2D projection
        If z2 > -5 Then  ; Skip points behind camera
            screenX = 300 + (x2 * zoom) / (z2 + 5)  ; Project X coordinate
            screenY = 300 - (y * zoom) / (z2 + 5)   ; Project Y coordinate
            ; Draw point if within screen bounds
            If screenX >= 0 And screenX < 600 And screenY >= 0 And screenY < 600 Then
                Color mandelbulb[i]\r, mandelbulb[i]\g, mandelbulb[i]\b
                Plot screenX, screenY
            EndIf
        EndIf
    Next
   
    ; Display information
    Color 255,255,255  ; White text
    Text 10,10,"Points: " + pointCount
    Text 10,30,"Rotation X: " + rotX
    Text 10,40,"Rotation Y: " + rotY
    Text 10,50,"Zoom: " + zoom
    Text 10,70,"Controls: Arrows=Rotate, Q/W=Zoom"
   
    Flip  ; Update screen
Wend

End

Filax

#2
And another with writepixelfast :

; ----------------------------------------
; Name : Mandelbulb By Filax/CreepyCat
; Date : (C)2025
; Site : https://github.com/BlackCreepyCat
; ----------------------------------------

; Set up a 600x600 2D graphics window
Graphics 1024,768,32,2
SetBuffer BackBuffer()

; Define a type to store 3D points and their colors
Type Vector3D
    Field x#,y#,z#      ; 3D coordinates
    Field r,g,b         ; RGB color values
End Type

; Declare global array for Mandelbulb points and counter
Global mandelbulb.Vector3D[1000000]
Global pointCount = 0

; Constants for grid size and scale
Const GRID_SIZE = 130
Const SCALE# = 4

; Function to generate Mandelbulb points
Function GenerateMandelbulb()
    ; Iterate through 3D grid
    For i = 0 To GRID_SIZE-1
        For j = 0 To GRID_SIZE-1
            edge = False
            For k = 0 To GRID_SIZE-1
                ; Map grid coordinates to -1 to 1 range
                x# = Map(i, 0, GRID_SIZE, -1, 1)
                y# = Map(j, 0, GRID_SIZE, -1, 1)
                z# = Map(k, 0, GRID_SIZE, -1, 1)
               
                ; Initialize iteration variables
                zx# = 0
                zy# = 0
                zz# = 0
               
                n = 8; 8              ; Power for Mandelbulb formula
                maxiterations = 20 ; Maximum iterations
                iteration = 0
               
                ; Mandelbulb iteration loop
                While True
                    r# = Sqr(zx*zx + zy*zy + zz*zz)           ; Radius
                    theta# = ATan2(Sqr(zx*zx+zy*zy), zz)      ; Theta angle
                    phi# = ATan2(zy, zx)                      ; Phi angle
                   
                    newr# = r ^ n                            ; Power n of radius
                    newx# = newr * Sin(theta*n) * Cos(phi*n) ; New x coordinate
                    newy# = newr * Sin(theta*n) * Sin(phi*n) ; New y coordinate
                    newz# = newr * Cos(theta*n)              ; New z coordinate
                   
                    zx# = newx + x  ; Update iteration variables
                    zy# = newy + y
                    zz# = newz + z
                   


                    iteration = iteration + 1
                   
                    ; Check exit conditions
                    If r > 2 Then
                        If edge Then edge = False
                        Exit
                    ElseIf iteration > maxiterations Then
                        If Not edge Then
                            edge = True
                            ; Store new point
                            mandelbulb[pointCount] = New Vector3D
                            mandelbulb[pointCount]\x = x * SCALE
                            mandelbulb[pointCount]\y = y * SCALE
                            mandelbulb[pointCount]\z = z * SCALE
                            ; Calculate point color based on position
                            mandelbulb[pointCount]\r = 128 + (x * 127)
                            mandelbulb[pointCount]\g = 128 + (y * 127)
                            mandelbulb[pointCount]\b = 128 + (z * 127)
                            pointCount = pointCount + 1
                        EndIf
                        Exit
                    EndIf
                Wend
            Next
        Next
    Next
   
    ; Save points to file
;    file = WriteFile("mandelbulb.txt")
;    For i = 0 To pointCount-1
;        WriteLine file, mandelbulb[i]\x + " " + mandelbulb[i]\y + " " + mandelbulb[i]\z
;    Next
;    CloseFile file
End Function

; Utility function to map values between ranges
Function Map#(value#, in_min#, in_max#, out_min#, out_max#)
    Return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
End Function

; Variables for rotation and zoom control
Global rotX# = 0    ; X-axis rotation
Global rotY# = 0    ; Y-axis rotation
Global zoom# = 200  ; Zoom level

; Generate the Mandelbulb
Print "Generating... (may take a few seconds)"
GenerateMandelbulb()
Print "Generated points: " + pointCount
Delay 200


; Main loop
While Not KeyHit(1)  ; Exit on ESC
    Cls  ; Clear screen

    ; Handle input controls
    If KeyDown(200) Then rotX = rotX + 1  ; Up arrow: rotate X up
    If KeyDown(208) Then rotX = rotX - 1  ; Down arrow: rotate X down
    If KeyDown(203) Then rotY = rotY + 1  ; Left arrow: rotate Y left
    If KeyDown(205) Then rotY = rotY - 1  ; Right arrow: rotate Y right
    If KeyDown(16) Then zoom = zoom + 2   ; Q: zoom in
    If KeyDown(17) Then zoom = zoom - 2   ; W: zoom out

    ; Lock the buffer for fast pixel writing
    LockBuffer BackBuffer()

    ; Render all points using WritePixelFast
    For i = 0 To pointCount-1
        ; Rotate around X axis
        y# = mandelbulb[i]\y * Cos(rotX) - mandelbulb[i]\z * Sin(rotX)
        z# = mandelbulb[i]\y * Sin(rotX) + mandelbulb[i]\z * Cos(rotX)
        x# = mandelbulb[i]\x

        ; Rotate around Y axis
        x2# = x * Cos(rotY) + z * Sin(rotY)
        z2# = -x * Sin(rotY) + z * Cos(rotY)

        ; Simple 2D projection
        If z2 > -5 Then  ; Skip points behind camera
            screenX = (GraphicsWidth()/2) + (x2 * zoom) / (z2 + 5)  ; Project X coordinate
            screenY = (GraphicsHeight()/2) - (y * zoom) / (z2 + 5)   ; Project Y coordinate
            ; Draw point if within screen bounds
            If screenX >= 0 And screenX < GraphicsWidth() And screenY >= 0 And screenY < GraphicsHeight() Then
                ARGB = ARGB(255, mandelbulb[i]\r, mandelbulb[i]\g, mandelbulb[i]\b)
                WritePixelFast screenX, screenY, ARGB, BackBuffer()
            EndIf
        EndIf
    Next

    ; Unlock the buffer
    UnlockBuffer BackBuffer()

    ; Display information
    Color 255,255,255  ; White text
    Text 10,10,"Points: " + pointCount
    Text 10,30,"Rotation X: " + rotX
    Text 10,40,"Rotation Y: " + rotY
    Text 10,50,"Zoom: " + zoom
    Text 10,70,"Controls: Arrows=Rotate, Q/W=Zoom"

    Flip False ; Update screen
Wend

; Fonction pour créer une couleur ARGB
Function ARGB(alpha, red, green, blue)
    Return (alpha * 256 * 256 * 256) + (red * 256 * 256) + (green * 256) + blue
End Function

Filax

Blitzmax version :

' ----------------------------------------
' Name : Mandelbulb By Filax/CreepyCat
' Date : (C)2025
' Site : https://github.com/BlackCreepyCat
' ----------------------------------------

SuperStrict

' Set up graphics window
Graphics(1280, 720)

' Define a type to store 3D points and their colors
Type TVector3D
    Field x:Float
    Field y:Float
    Field z:Float
    Field r:Int
    Field g:Int
    Field b:Int
End Type

' Global array for Mandelbulb points and counter
Global mandelbulb:TVector3D[] = New TVector3D[1000000]
Global pointCount:Int = 0

' Constants for grid size and scale
Const GRID_SIZE:Int = 190
Const SCALE:Float = 4

' Function to generate Mandelbulb points
Function GenerateMandelbulb()
    ' Iterate through 3D grid
    For Local i:Int = 0 Until GRID_SIZE
        For Local j:Int = 0 Until GRID_SIZE
            Local edge:Byte = False
            For Local k:Int = 0 Until GRID_SIZE
                ' Map grid coordinates to -1 to 1 range
                Local x:Float = Map(i, 0, GRID_SIZE, -1, 1)
                Local y:Float = Map(j, 0, GRID_SIZE, -1, 1)
                Local z:Float = Map(k, 0, GRID_SIZE, -1, 1)
               
                ' Initialize iteration variables
                Local zx:Float = 0
                Local zy:Float = 0
                Local zz:Float = 0
               
                Local n:Int = 8 ' Power for Mandelbulb formula
                Local maxiterations:Int = 20 ' Maximum iterations
                Local iteration:Int = 0
               
                ' Mandelbulb iteration loop
                While True
                    Local r:Float = Sqr(zx*zx + zy*zy + zz*zz) ' Radius
                    Local theta:Float = ATan2(Sqr(zx*zx+zy*zy), zz) ' Theta angle
                    Local phi:Float = ATan2(zy, zx) ' Phi angle
                   
                    Local newr:Float = r ^ n ' Power n of radius
                    Local newx:Float = newr * Sin(theta*n) * Cos(phi*n) ' New x coordinate
                    Local newy:Float = newr * Sin(theta*n) * Sin(phi*n) ' New y coordinate
                    Local newz:Float = newr * Cos(theta*n) ' New z coordinate
                   
                    zx = newx + x ' Update iteration variables
                    zy = newy + y
                    zz = newz + z
                   
                    iteration :+ 1
                   
                    ' Check exit conditions
                    If r > 2 Then
                        If edge Then edge = False
                        Exit
                    ElseIf iteration > maxiterations Then
                        If Not edge Then
                            edge = True
                            ' Store new point
                            mandelbulb[pointCount] = New TVector3D
                            mandelbulb[pointCount].x = x * SCALE
                            mandelbulb[pointCount].y = y * SCALE
                            mandelbulb[pointCount].z = z * SCALE
                            ' Calculate point color based on position
                            mandelbulb[pointCount].r = 128 + (x * 127)
                            mandelbulb[pointCount].g = 128 + (y * 127)
                            mandelbulb[pointCount].b = 128 + (z * 127)
                            pointCount :+ 1
                        End If
                        Exit
                    End If
                Wend
            Next
        Next
    Next
End Function

' Utility function to map values between ranges
Function Map:Float(value:Float, in_min:Float, in_max:Float, out_min:Float, out_max:Float)
    Return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
End Function

' Variables for rotation and zoom control
Global rotX:Float = 0    ' X-axis rotation
Global rotY:Float = 0    ' Y-axis rotation
Global zoom:Float = 200  ' Zoom level

' Generate the Mandelbulb
Print "Generating... (may take a few seconds)"
GenerateMandelbulb()
Print "Generated points: " + pointCount
Delay(200)

' Main loop
While Not KeyHit(KEY_ESCAPE)  ' Exit on ESC
    Cls  ' Clear screen
   
    ' Handle input controls
    If KeyDown(KEY_UP) Then rotX :+ 1     ' Up arrow: rotate X up
    If KeyDown(KEY_DOWN) Then rotX :- 1   ' Down arrow: rotate X down
    If KeyDown(KEY_LEFT) Then rotY :+ 1   ' Left arrow: rotate Y left
    If KeyDown(KEY_RIGHT) Then rotY :- 1  ' Right arrow: rotate Y right
    If KeyDown(KEY_Q) Then zoom :+ 2      ' Q: zoom in
    If KeyDown(KEY_W) Then zoom :- 2      ' W: zoom out
   
    ' Render all points
    For Local i:Int = 0 Until pointCount
        ' Rotate around X axis
        Local y:Float = mandelbulb[i].y * Cos(rotX) - mandelbulb[i].z * Sin(rotX)
        Local z:Float = mandelbulb[i].y * Sin(rotX) + mandelbulb[i].z * Cos(rotX)
        Local x:Float = mandelbulb[i].x
       
        ' Rotate around Y axis
        Local x2:Float = x * Cos(rotY) + z * Sin(rotY)
        Local z2:Float = -x * Sin(rotY) + z * Cos(rotY)
       
        ' Simple 2D projection
        If z2 > -5 Then  ' Skip points behind camera
            Local screenX:Int = (GraphicsWidth()/2) + (x2 * zoom) / (z2 + 5)  ' Project X coordinate
            Local screenY:Int = (GraphicsHeight()/2) - (y * zoom) / (z2 + 5)   ' Project Y coordinate
           
            ' Draw point if within screen bounds
            If screenX >= 0 And screenX < GraphicsWidth() And screenY >= 0 And screenY < GraphicsHeight() Then
                SetColor(mandelbulb[i].r, mandelbulb[i].g, mandelbulb[i].b)
                Plot(screenX, screenY)
            End If
        End If
    Next
   
    ' Display information
    SetColor(255, 255, 255)  ' White text
    DrawText("Points: " + pointCount, 10, 10)
    DrawText("Rotation X: " + rotX, 10, 30)
    DrawText("Rotation Y: " + rotY, 10, 40)
    DrawText("Zoom: " + zoom, 10, 50)
    DrawText("Controls: Arrows=Rotate, Q/W=Zoom", 10, 70)
   
    Flip(False) ' Update screen
Wend

Dan

QuoteBut there is a bug, when i try to increase the point number (GRID_SIZE) the program crash on the renderword, i don't know why?
Looks like the limit on the sprite objects is 16128

You can test it with this code:
Graphics3D 640,480,32,2

cam = CreateCamera()
MoveEntity cam,0,0,-5

Dim Sp(20002)

For x=0 To 16127
Sp(x) = CreateSprite()
RotateSprite Sp(x),Rand(360)
Next


RenderWorld:Flip
WaitKey
End 
65536 GOTO Back2Basic

Filax

#5
Quote from: Dan on March 01, 2025, 12:48:19
QuoteBut there is a bug, when i try to increase the point number (GRID_SIZE) the program crash on the renderword, i don't know why?
Looks like the limit on the sprite objects is 16128

Oh! Ok! : I think the good solution is to build a mesh instead... Thanks!

Filax

Screenshot :

PixelOutlaw

That's looking nice! Very cool!
Don't know if you follow "The Coding Train" (a recreational programming Youtube channel based on "The Nature of Code") but it also has fun things like this.
https://www.youtube.com/watch?v=NJCiUVGiNyA
One DEFUN to rule them all, One DEFUN to find them, One DEFUN to RETURN them all, and in the darkness MULTIPLE-VALUE-BIND them.

Filax

Quote from: PixelOutlaw on March 11, 2025, 08:34:44That's looking nice! Very cool!
Don't know if you follow "The Coding Train" (a recreational programming Youtube channel based on "The Nature of Code") but it also has fun things like this.
https://www.youtube.com/watch?v=NJCiUVGiNyA

Yeah i know!  One of my sources is inspired by one of those video :)