mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
10ea905090
- shader updates are delayed by .25 seconds to avouid UI freeze - fixed GraphNode initialization upon loading - started obsoleting get_source_rgb and get_source_f functions - updated colorize node to use gradient - image node can now be loaded/saved - removed iqnoise node - rewrote perlin shader to support a seed parameter (seed is calculated from the node's position, so just move it to reseed) - Added voronoi noise node - updated code to use % formats instead of concatenating strings (should solve type problems in shaders) - reworked the context menu (now has submenus) - fixes in the gradient editor
27 lines
731 B
GDScript
27 lines
731 B
GDScript
tool
|
|
extends "res://addons/procedural_material/node_base.gd"
|
|
|
|
var rotate = 0.0
|
|
var scale = 0.0
|
|
|
|
func _ready():
|
|
set_slot(0, true, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
|
|
initialize_properties([ $GridContainer/rotate, $GridContainer/scale ])
|
|
|
|
func _get_shader_code(uv):
|
|
var rv = { defs="", code="" }
|
|
var src = get_source()
|
|
if src == null:
|
|
return rv
|
|
rv.uv = name+"_uv("+uv+")"
|
|
var src_code = src.get_shader_code(rv.uv)
|
|
if !generated:
|
|
rv.defs = src_code.defs+"vec2 "+name+"_uv(vec2 uv) { return transform(uv, %.9f, %.9f); }\n" % [ 3.1415928*rotate/180.0, scale ]
|
|
generated = true
|
|
rv.code = src_code.code;
|
|
if src_code.has("f"):
|
|
rv.f = src_code.f
|
|
if src_code.has("rgb"):
|
|
rv.rgb = src_code.rgb
|
|
return rv
|