Switched 'intensive' functions to cpp

This commit is contained in:
MartinOpat 2025-11-11 00:23:12 +01:00
parent c92c6d4432
commit f9ec2e855d
1 changed files with 6 additions and 3 deletions

View File

@ -1,15 +1,17 @@
extends Sprite2D extends Sprite2D
var n: int = 64 var n: int = 256
var arr := [] var arr := []
var data_img: Image var data_img: Image
var data_tex: ImageTexture var data_tex: ImageTexture
var gol := GoL.new()
@onready var mat: ShaderMaterial = material as ShaderMaterial @onready var mat: ShaderMaterial = material as ShaderMaterial
# sim. consts # sim. consts
var T := 0.1 var T := 0.01
var t := 0.0 var t := 0.0
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
@ -38,7 +40,8 @@ func _process(_delta: float) -> void:
t += _delta t += _delta
if t >= T: if t >= T:
t = 0.0 t = 0.0
_game_of_life_step() #_game_of_life_step()
arr = gol.step_once(arr, n) # cpp step
_upload_arr() _upload_arr()
func _game_of_life_step() -> void: func _game_of_life_step() -> void: