-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:ovilab/ShaderNodes into dev
- Loading branch information
Showing
12 changed files
with
160 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import QtQuick 2.0 as QQ2 | ||
|
||
import ShaderNodes 1.0 | ||
|
||
ShaderNode { | ||
id: root | ||
|
||
property var values: [0.5] | ||
property var value1: 0.0 | ||
property var value2: 0.0 | ||
property var mix: 0.5 | ||
|
||
arrayProperties: ["values"] | ||
exportedTypeName: "Add" | ||
|
||
name: "add" | ||
type: ShaderNodes.glslType(values) | ||
|
||
source: { | ||
var result = "" | ||
result += type + " $sumresult = 0.0;\n" | ||
if(values && values.length) { | ||
for(var i in values) { | ||
result += "$sumresult += $(values[" + i + "], " + type + ");\n" | ||
} | ||
} else { | ||
result += "$sumresult = $values;\n" | ||
type: { | ||
var type1 = glslType(value1) | ||
var type2 = glslType(value2) | ||
if(type1 === type2) { | ||
return type1 | ||
} | ||
|
||
return result; | ||
if(type1 === "float") { | ||
return type2 | ||
} | ||
if(type2 === "float") { | ||
return type1 | ||
} | ||
return type1 | ||
} | ||
|
||
result: "$sumresult" | ||
result: { | ||
var type1 = glslType(value1) | ||
var type2 = glslType(value2) | ||
return "$(value1, " + type + ") + $(value2, " + type + ")" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ShaderNodes 1.0 | ||
|
||
ShaderNode { | ||
property var vector: 0.0 | ||
property var alpha: 0.0 | ||
|
||
exportedTypeName: "CombineRgba" | ||
|
||
name: "combine_rgb_vector_alpha" | ||
type: "vec4" | ||
result: "vec4($(vector, vec3), $(alpha, float))" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import ShaderNodes 1.0 | ||
|
||
ShaderNode { | ||
property var red: 0.0 | ||
property var green: 0.0 | ||
property var blue: 0.0 | ||
property var alpha: 0.0 | ||
|
||
exportedTypeName: "CombineRgba" | ||
|
||
name: "combine_rgba" | ||
type: "vec4" | ||
result: "vec4($(red, float), $(green, float), $(blue, float), $(alpha, float))" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
import QtQuick 2.0 as QQ2 | ||
|
||
import ShaderNodes 1.0 | ||
|
||
ShaderNode { | ||
property list<ShaderNode> inputs | ||
id: root | ||
|
||
property var values: [0.5] | ||
|
||
arrayProperties: ["values"] | ||
exportedTypeName: "Sum" | ||
|
||
type: "float" | ||
name: "sum" | ||
type: ShaderNodes.glslType(values) | ||
|
||
source: { | ||
var output = ""; | ||
output += "float $sumresult = 0.0;\n" | ||
for(var i in inputs) { | ||
output += "$sumresult += $(inputs[" + i + "], float);\n"; | ||
var result = "" | ||
result += type + " $sumresult = 0.0;\n" | ||
if(values && values.length) { | ||
for(var i in values) { | ||
result += "$sumresult += $(values[" + i + "], " + type + ");\n" | ||
} | ||
} else { | ||
result += "$sumresult = $values;\n" | ||
} | ||
return output | ||
|
||
return result; | ||
} | ||
|
||
result: "$sumresult" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters