forked from jdf/processing-py-site
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPShader_set.xml
More file actions
99 lines (80 loc) · 2.84 KB
/
PShader_set.xml
File metadata and controls
99 lines (80 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>set()</name>
<category>PShader</category>
<subcategory>Method</subcategory>
<!-- unsupported_modes>js</unsupported_modes -->
<!-- js_mode><description>This part of the Processing API is not supported in JavaScript mode</description></js_mode -->
<example>
<noimage />
<notest />
<code><![CDATA[
def setup():
size(640, 360, P2D)
global tex, deform
tex = loadImage("tex1.jpg")
deform = loadShader("deform.glsl")
deform.set("resolution", float(width), float(height))
def draw():
deform.set("time", millis() / 1000.0)
deform.set("mouse", float(mouseX), float(mouseY))
shader(deform)
image(tex, 0, 0, width, height)
]]></code>
</example>
<description><![CDATA[
Sets the uniform variables inside the shader to modify the effect while the program is running.
]]></description>
<syntax>
.set(name, x)
.set(name, x, y)
.set(name, x, y, z)
.set(name, x, y, z, w)
.set(name, vec)
.set(name, vec, ncoords)
.set(name, boolvec, ncoords)
.set(name, mat)
.set(name, mat, use3x3)
.set(name, tex)
</syntax>
<parameter>
<label>name</label>
<description><![CDATA[String: the name of the uniform variable to modify]]></description>
</parameter>
<parameter>
<label>x</label>
<description><![CDATA[boolean, float, or int: first component of the variable to modify]]></description>
</parameter>
<parameter>
<label>y</label>
<description><![CDATA[boolean, float, or int: second component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[2], vec2)]]></description>
</parameter>
<parameter>
<label>z</label>
<description><![CDATA[boolean, float, or int: third component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[3], vec3)]]></description>
</parameter>
<parameter>
<label>w</label>
<description><![CDATA[boolean, float, or int: fourth component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[4], vec4)]]></description>
</parameter>
<parameter>
<label>vec</label>
<description><![CDATA[boolean, float, int, or PVector: modifies all the components of an array/vector uniform variable. PVector can only be used if the type of the variable is vec3.]]></description>
</parameter>
<parameter>
<label>ncoords</label>
<description><![CDATA[int: number of coordinates per element, max 4]]></description>
</parameter>
<parameter>
<label>mat</label>
<description><![CDATA[PMatrix3D, or PMatrix2D: matrix of values]]></description>
</parameter>
<parameter>
<label>use3x3</label>
<description><![CDATA[boolean: enforces the matrix is 3 x 3]]></description>
</parameter>
<parameter>
<label>tex</label>
<description><![CDATA[PImage: sets the sampler uniform variable to read from this image texture]]></description>
</parameter>
</root>