From 56ebdb0ec5aa446623e1d67ff5749b59708d5f19 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 12 Oct 2021 16:36:20 +0200 Subject: [PATCH] Comments from iching.mmg. --- .../mat_maker_gd/nodes/common/patterns.gd | 23 ++++++++ .../nodes/material_maker_nodes/iching.mmg | 57 ------------------- 2 files changed, 23 insertions(+), 57 deletions(-) delete mode 100644 game/addons/mat_maker_gd/nodes/material_maker_nodes/iching.mmg diff --git a/game/addons/mat_maker_gd/nodes/common/patterns.gd b/game/addons/mat_maker_gd/nodes/common/patterns.gd index 251fc21f..0ac37025 100644 --- a/game/addons/mat_maker_gd/nodes/common/patterns.gd +++ b/game/addons/mat_maker_gd/nodes/common/patterns.gd @@ -123,9 +123,12 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") #Inputs: #size, vector2, default: 4, min: 2, max: 32, step: 1 +#---------------------- #scratches.mmg #Draws white scratches on a black background +#Outputs: + #Output (float) - Shows white scratches on a black background #scratches($uv, int($layers), vec2($length, $width), $waviness, $angle, $randomness, vec2(float($seed), 0.0)) @@ -137,6 +140,18 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") #angle, float, min: -180, max: 180, default: 0, step:1 #randomness, float, min: 0, max: 1, default: 0.5, step:0.01 +#---------------------- +#iching.mmg +#This node generates a grid of random I Ching hexagrams. + +#Outputs: + +#Output (float) - A greyscale image showing random I Ching hexagrams. +#IChing(vec2($columns, $rows)*$uv, float($seed)) + +#Inputs: +#size, vector2, default: 2, min: 2, max: 32, step: 1 + enum CombinerAxisType { @@ -425,6 +440,14 @@ static func IChingc(uv : Vector2, row_col : Vector2, pseed : int) -> Color: return Color(f, f, f, 1) +#float IChing(vec2 uv, float seed) { +# int value = int(32.0*rand(floor(uv)+vec2(seed))); +# float base = step(0.5, fract(fract(uv.y)*6.5))*step(0.04, fract(uv.y+0.02))*step(0.2, fract(uv.x+0.1)); +# int bit = int(fract(uv.y)*6.5); +# +# return base*step(0.1*step(float(bit & value), 0.5), fract(uv.x+0.55)); +#} + static func IChing(uv : Vector2, pseed : float) -> float: var value : int = int(32.0 * Commons.rand(Commons.floorv2(uv) + Vector2(pseed, pseed))); var base : float = Commons.step(0.5, Commons.fract(Commons.fract(uv.y)*6.5))*Commons.step(0.04, Commons.fract(uv.y+0.02)) * Commons.step(0.2, Commons.fract(uv.x+0.1)); diff --git a/game/addons/mat_maker_gd/nodes/material_maker_nodes/iching.mmg b/game/addons/mat_maker_gd/nodes/material_maker_nodes/iching.mmg deleted file mode 100644 index 4a5fafd2..00000000 --- a/game/addons/mat_maker_gd/nodes/material_maker_nodes/iching.mmg +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "iching", - "node_position": { - "x": 0, - "y": 0 - }, - "parameters": { - "columns": 4, - "rows": 4 - }, - "shader_model": { - "code": "", - "global": "float IChing(vec2 uv, float seed) {\n\tint value = int(32.0*rand(floor(uv)+vec2(seed)));\n\tfloat base = step(0.5, fract(fract(uv.y)*6.5))*step(0.04, fract(uv.y+0.02))*step(0.2, fract(uv.x+0.1));\n\tint bit = int(fract(uv.y)*6.5);\n\treturn base*step(0.1*step(float(bit & value), 0.5), fract(uv.x+0.55));\n}\n\n\n", - "inputs": [ - - ], - "instance": "", - "longdesc": "This node generates a grid of random I Ching hexagrams.", - "name": "I Ching", - "outputs": [ - { - "f": "IChing(vec2($columns, $rows)*$uv, float($seed))", - "longdesc": "A greyscale image showing random I Ching hexagrams.", - "shortdesc": "Output", - "type": "f" - } - ], - "parameters": [ - { - "control": "None", - "default": 0, - "label": "Size X", - "longdesc": "The number of columns of the grid", - "max": 32, - "min": 2, - "name": "columns", - "shortdesc": "Size.x", - "step": 1, - "type": "float" - }, - { - "control": "None", - "default": 0, - "label": "Size Y", - "longdesc": "The number of rows of the grid", - "max": 32, - "min": 2, - "name": "rows", - "shortdesc": "Size.y", - "step": 1, - "type": "float" - } - ], - "shortdesc": "I Ching hexagrams generator" - }, - "type": "shader" -} \ No newline at end of file