From 2c38efe0518a29e3d61f50586935439e705b757e Mon Sep 17 00:00:00 2001 From: neph1 Date: Sat, 1 Nov 2014 13:27:19 +0100 Subject: [PATCH] A bunch of basic ShaderNodes --- .../MatDefs/ShaderNodes/Basic/ColorAdd.j3sn | 19 +++++++++++++++ .../ShaderNodes/Basic/ColorSplitter.j3sn | 23 +++++++++++++++++++ .../ShaderNodes/Basic/ColorToGrey.j3sn | 17 ++++++++++++++ .../ShaderNodes/Basic/ConstructColor.j3sn | 23 +++++++++++++++++++ .../MatDefs/ShaderNodes/Basic/colorAdd.frag | 4 ++++ .../ShaderNodes/Basic/colorSplitter.frag | 6 +++++ .../ShaderNodes/Basic/colorToGrey.frag | 3 +++ .../ShaderNodes/Basic/constructColor.frag | 3 +++ .../MatDefs/ShaderNodes/Math/AddVec2.j3sn | 19 +++++++++++++++ .../ShaderNodes/Math/ConstructVec2.j3sn | 19 +++++++++++++++ .../ShaderNodes/Math/ConstructVec3.j3sn | 21 +++++++++++++++++ .../Common/MatDefs/ShaderNodes/Math/Mult.j3sn | 19 +++++++++++++++ .../MatDefs/ShaderNodes/Math/MultVec2.j3sn | 19 +++++++++++++++ .../MatDefs/ShaderNodes/Math/MultVec3.j3sn | 19 +++++++++++++++ .../MatDefs/ShaderNodes/Math/OneMinus.j3sn | 17 ++++++++++++++ .../Common/MatDefs/ShaderNodes/Math/Pow.j3sn | 19 +++++++++++++++ .../MatDefs/ShaderNodes/Math/addVec2.frag | 3 +++ .../ShaderNodes/Math/constructVec2.frag | 3 +++ .../ShaderNodes/Math/constructVec3.frag | 3 +++ .../Common/MatDefs/ShaderNodes/Math/mult.frag | 3 +++ .../MatDefs/ShaderNodes/Math/multVec2.frag | 3 +++ .../MatDefs/ShaderNodes/Math/multVec3.frag | 3 +++ .../MatDefs/ShaderNodes/Math/oneMinus.frag | 3 +++ .../Common/MatDefs/ShaderNodes/Math/pow.frag | 3 +++ 24 files changed, 274 insertions(+) create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorAdd.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorSplitter.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorToGrey.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ConstructColor.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorAdd.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorSplitter.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorToGrey.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/constructColor.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/AddVec2.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec2.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec3.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Mult.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec2.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec3.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/OneMinus.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Pow.j3sn create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/addVec2.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec2.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec3.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/mult.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec2.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec3.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/oneMinus.frag create mode 100644 jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/pow.frag diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorAdd.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorAdd.j3sn new file mode 100644 index 000000000..12b732ca0 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorAdd.j3sn @@ -0,0 +1,19 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition ColorAdd { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Basic/colorAdd.frag + Documentation{ + Adds two colors + @input color1 the first color + @input color2 the second color + @output outColor the resulting color + } + Input { + vec4 color1 + vec4 color2 + } + Output { + vec4 outColor + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorSplitter.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorSplitter.j3sn new file mode 100644 index 000000000..9f202e51c --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorSplitter.j3sn @@ -0,0 +1,23 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition ColorSplitter { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Basic/colorSplitter.frag + Documentation{ + Retrives the individual color channels + @input color the color + @output red the red channel + @output green the green channel + @output blue the blue channel + @output alpha the alpha channel + } + Input { + vec4 color + } + Output { + float red + float green + float blue + float alpha + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorToGrey.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorToGrey.j3sn new file mode 100644 index 000000000..c90591c47 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ColorToGrey.j3sn @@ -0,0 +1,17 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition ColorToGrey { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Basic/colorToGrey.frag + Documentation{ + Retrives the individual color channels + @input color the color + @output greyness or lightness of the color + } + Input { + vec4 color + } + Output { + float grey + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ConstructColor.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ConstructColor.j3sn new file mode 100644 index 000000000..113876bf7 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/ConstructColor.j3sn @@ -0,0 +1,23 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition ConstructColor { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Basic/constructColor.frag + Documentation{ + Creates a new color out of 4 channels + @input red the red channel + @input green the green channel + @input blue the blue channel + @input alpha the alpha channel + @output outColor the resulting color + } + Input { + float red + float green + float blue + float alpha + } + Output { + vec4 outColor + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorAdd.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorAdd.frag new file mode 100644 index 000000000..cb27dc53d --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorAdd.frag @@ -0,0 +1,4 @@ +void main(){ + outColor = color1 + color2; + clamp(outColor, 0.0, 1.0); +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorSplitter.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorSplitter.frag new file mode 100644 index 000000000..85971b5f9 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorSplitter.frag @@ -0,0 +1,6 @@ +void main(){ + red = color.r; + green = color.g; + blue = color.b; + alpha = color.a; +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorToGrey.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorToGrey.frag new file mode 100644 index 000000000..d50d75d41 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/colorToGrey.frag @@ -0,0 +1,3 @@ +void main(){ + grey = color.r + color.g + color.b; +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/constructColor.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/constructColor.frag new file mode 100644 index 000000000..9e1268e88 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Basic/constructColor.frag @@ -0,0 +1,3 @@ +void main(){ + outColor = vec4(red, green, blue, alpha); +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/AddVec2.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/AddVec2.j3sn new file mode 100644 index 000000000..aad7b54d2 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/AddVec2.j3sn @@ -0,0 +1,19 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition AddVec2 { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/addVec2.frag + Documentation{ + Add an incoming vec2 by another supplied vec2 + @input coord1 the first vec2 + @input coord2 the second vec2 + @output outCoord the resulting coord + } + Input { + vec2 coord1 + vec2 coord2 + } + Output { + vec2 outCoord + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec2.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec2.j3sn new file mode 100644 index 000000000..ed64f41b5 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec2.j3sn @@ -0,0 +1,19 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition ConstructVec2 { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/constructVec2.frag + Documentation{ + Combines 2 floats into a vec2 + @input x the first float + @input y the second float + @output outVec the resulting vec2 + } + Input { + float x + float y + } + Output { + vec2 outVec + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec3.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec3.j3sn new file mode 100644 index 000000000..a2b5676b3 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/ConstructVec3.j3sn @@ -0,0 +1,21 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition ConstructVec3 { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/constructVec3.frag + Documentation{ + Combines 3 floats into a vec3 + @input x the first float, x + @input y the second float, y + @input z the third float, z + @output outVec the resulting vec3 + } + Input { + float x + float y + float z + } + Output { + vec3 outVec + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Mult.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Mult.j3sn new file mode 100644 index 000000000..8a44949b4 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Mult.j3sn @@ -0,0 +1,19 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition Mult { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/mult.frag + Documentation{ + Multiplies two floats + @input float1 the first float + @input float2 the second float + @output outFloat the resulting coord + } + Input { + float float1 + float float2 + } + Output { + float outFloat + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec2.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec2.j3sn new file mode 100644 index 000000000..ab30d5015 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec2.j3sn @@ -0,0 +1,19 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition MultVec2 { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/multVec2.frag + Documentation{ + Multiplies an incoming vec2 by another supplied vec2 + @input coord1 the first vec2 + @input coord2 the second vec2 + @output outCoord the resulting coord + } + Input { + vec2 coord1 + vec2 coord2 + } + Output { + vec2 outCoord + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec3.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec3.j3sn new file mode 100644 index 000000000..ab3fdb4c1 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/MultVec3.j3sn @@ -0,0 +1,19 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition MultVec3 { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/multVec3.frag + Documentation{ + Multiplies a vec3 by another vec3 + @input pos1 the first vec3 + @input pos2 the second vec3 + @output outPos the resulting position + } + Input { + vec2 pos1 + vec2 pos2 + } + Output { + vec2 outPos + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/OneMinus.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/OneMinus.j3sn new file mode 100644 index 000000000..2cad91544 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/OneMinus.j3sn @@ -0,0 +1,17 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition OneMinus { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/oneMinus.frag + Documentation{ + return 1 - value + @input value a float + @output outFloat the resulting value + } + Input { + float value + } + Output { + float outFloat + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Pow.j3sn b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Pow.j3sn new file mode 100644 index 000000000..6f59b47f8 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/Pow.j3sn @@ -0,0 +1,19 @@ +ShaderNodeDefinitions{ + ShaderNodeDefinition Pow { + Type: Fragment + Shader GLSL100: Common/MatDefs/ShaderNodes/Math/pow.frag + Documentation{ + return power of value based on factor + @input value a float + @input factor a float + @output outFloat the resulting value + } + Input { + float value + float factor + } + Output { + float outFloat + } + } +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/addVec2.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/addVec2.frag new file mode 100644 index 000000000..44ea96fa3 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/addVec2.frag @@ -0,0 +1,3 @@ +void main(){ + outCoord = coord1 + coord2; +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec2.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec2.frag new file mode 100644 index 000000000..88fb07820 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec2.frag @@ -0,0 +1,3 @@ +void main(){ + outVec = vec2(x, y); +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec3.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec3.frag new file mode 100644 index 000000000..c30f64024 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/constructVec3.frag @@ -0,0 +1,3 @@ +void main(){ + outVec = vec3(x, y, z); +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/mult.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/mult.frag new file mode 100644 index 000000000..06495851f --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/mult.frag @@ -0,0 +1,3 @@ +void main(){ + outFloat = float1 * float2; +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec2.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec2.frag new file mode 100644 index 000000000..55017ff84 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec2.frag @@ -0,0 +1,3 @@ +void main(){ + outCoord = coord1 * coord2; +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec3.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec3.frag new file mode 100644 index 000000000..c4bcb829a --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/multVec3.frag @@ -0,0 +1,3 @@ +void main(){ + outPos = pos1 * pos2; +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/oneMinus.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/oneMinus.frag new file mode 100644 index 000000000..a13d85489 --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/oneMinus.frag @@ -0,0 +1,3 @@ +void main(){ + outFloat = 1 - value; +} \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/pow.frag b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/pow.frag new file mode 100644 index 000000000..85996286e --- /dev/null +++ b/jme3-core/src/main/resources/Common/MatDefs/ShaderNodes/Math/pow.frag @@ -0,0 +1,3 @@ +void main(){ + outFloat = pow(value, factor); +} \ No newline at end of file