Skip to content
0.2.0-dev Download ZIP
99 lines ·3.1 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="VisualShaderNodeColorOp" inherits="VisualShaderNode" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
3 <brief_description>
4 A [Color] operator to be used within the visual shader graph.
5 </brief_description>
6 <description>
7 Applies [member operator] to two color inputs.
8 </description>
9 <tutorials>
10 </tutorials>
11 <members>
12 <member name="operator" type="int" setter="set_operator" getter="get_operator" enum="VisualShaderNodeColorOp.Operator" default="0">
13 An operator to be applied to the inputs.
14 </member>
15 </members>
16 <constants>
17 <constant name="OP_SCREEN" value="0" enum="Operator">
18 Produce a screen effect with the following formula:
19 [codeblock]
20 result = vec3(1.0) - (vec3(1.0) - a) * (vec3(1.0) - b);
21 [/codeblock]
22 </constant>
23 <constant name="OP_DIFFERENCE" value="1" enum="Operator">
24 Produce a difference effect with the following formula:
25 [codeblock]
26 result = abs(a - b);
27 [/codeblock]
28 </constant>
29 <constant name="OP_DARKEN" value="2" enum="Operator">
30 Produce a darken effect with the following formula:
31 [codeblock]
32 result = min(a, b);
33 [/codeblock]
34 </constant>
35 <constant name="OP_LIGHTEN" value="3" enum="Operator">
36 Produce a lighten effect with the following formula:
37 [codeblock]
38 result = max(a, b);
39 [/codeblock]
40 </constant>
41 <constant name="OP_OVERLAY" value="4" enum="Operator">
42 Produce an overlay effect with the following formula:
43 [codeblock]
44 for (int i = 0; i &lt; 3; i++) {
45 float base = a[i];
46 float blend = b[i];
47 if (base &lt; 0.5) {
48 result[i] = 2.0 * base * blend;
49 } else {
50 result[i] = 1.0 - 2.0 * (1.0 - blend) * (1.0 - base);
51 }
52 }
53 [/codeblock]
54 </constant>
55 <constant name="OP_DODGE" value="5" enum="Operator">
56 Produce a dodge effect with the following formula:
57 [codeblock]
58 result = a / (vec3(1.0) - b);
59 [/codeblock]
60 </constant>
61 <constant name="OP_BURN" value="6" enum="Operator">
62 Produce a burn effect with the following formula:
63 [codeblock]
64 result = vec3(1.0) - (vec3(1.0) - a) / b;
65 [/codeblock]
66 </constant>
67 <constant name="OP_SOFT_LIGHT" value="7" enum="Operator">
68 Produce a soft light effect with the following formula:
69 [codeblock]
70 for (int i = 0; i &lt; 3; i++) {
71 float base = a[i];
72 float blend = b[i];
73 if (base &lt; 0.5) {
74 result[i] = base * (blend + 0.5);
75 } else {
76 result[i] = 1.0 - (1.0 - base) * (1.0 - (blend - 0.5));
77 }
78 }
79 [/codeblock]
80 </constant>
81 <constant name="OP_HARD_LIGHT" value="8" enum="Operator">
82 Produce a hard light effect with the following formula:
83 [codeblock]
84 for (int i = 0; i &lt; 3; i++) {
85 float base = a[i];
86 float blend = b[i];
87 if (base &lt; 0.5) {
88 result[i] = base * (2.0 * blend);
89 } else {
90 result[i] = 1.0 - (1.0 - base) * (1.0 - 2.0 * (blend - 0.5));
91 }
92 }
93 [/codeblock]
94 </constant>
95 <constant name="OP_MAX" value="9" enum="Operator">
96 Represents the size of the [enum Operator] enum.
97 </constant>
98 </constants>
99</class>