You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
588 B
25 lines
588 B
extends TextureRect
|
|
|
|
var image
|
|
|
|
func create_image(points):
|
|
var width = get_parent().get_parent().data.width
|
|
var height = get_parent().get_parent().data.height
|
|
image = Image.new()
|
|
image.create(width, height, false, Image.FORMAT_RGBA8)
|
|
image.fill(Color.white)
|
|
image.lock()
|
|
for i in width * height:
|
|
if(points[i]):
|
|
image.set_pixel(i % width, i / height, Color.black)
|
|
image.unlock()
|
|
|
|
func update_texture():
|
|
var texture = ImageTexture.new()
|
|
texture.create_from_image(image)
|
|
set_texture(texture)
|
|
|
|
func _on_Control_new_poisson(points):
|
|
create_image(points)
|
|
update_texture()
|
|
|
|
|