Comments from iching.mmg.

This commit is contained in:
Relintai 2021-10-12 16:36:20 +02:00
parent e6d4b2b755
commit 56ebdb0ec5
2 changed files with 23 additions and 57 deletions

View File

@ -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));

View File

@ -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"
}