Difference between revisions of "Shader:send"
Line 87: | Line 87: | ||
{{param|string|name|Name of the boolean to send to the shader.}} | {{param|string|name|Name of the boolean to send to the shader.}} | ||
{{param|boolean|boolean|Boolean to send to store in the extern.}} | {{param|boolean|boolean|Boolean to send to store in the extern.}} | ||
− | {{param| | + | {{param|boolean|...|Additional booleans to send in case the extern is an array.}} |
=== Returns === | === Returns === | ||
Nothing. | Nothing. |
Revision as of 18:41, 29 August 2013
Available since LÖVE 0.9.0 |
It has been renamed from PixelEffect:send. |
Sends one or more values to a special (extern) variable inside the shader. Extern variables have to be marked using the extern keyword, e.g.
extern number time;
extern vec2 light_pos;
extern vec4 colors[4];
The corresponding send calls would be
shader:send("time", t)
shader:send("light_pos", {light_x, light_y})
shader:send("colors", {r1, g1, b1, a1}, {r2, g2, b2, a2}, {r3, g3, b3, a3}, {r4, g4, b4, a4})
Extern variables can be accessed in both the Vertex and Pixel components of a shader, as long as the variable is declared in each.
Contents
Function
Synopsis
Shader:send( name, number, ... )
Arguments
string name
- Name of the number to send to the shader.
number number
- Number to send to store in the extern.
number ...
- Additional numbers to send in case the extern is an array.
Returns
Nothing.
Function
Synopsis
Shader:send( name, vector, ... )
Arguments
string name
- Name of the vector to send to the shader.
table vector
- Numbers to send to the extern as a vector. The number of elements in the table determines the type of the vector (e.g. two numbers -> vec2). At least two and at most four numbers can be used.
table ...
- Additional vectors to send in case the extern is an array. All vectors need to be of the same size (e.g. only vec3's)
Returns
Nothing.
Function
Synopsis
Shader:send( name, matrix, ... )
Arguments
string name
- Name of the matrix to send to the shader.
table matrix
- 2x2, 3x3, or 4x4 matrix to send to the extern. Using table form:
{{a,b,c,d}, {e,f,g,h}, ... }
table ...
- Additional matrices of the same type as matrix to store in the extern array.
Returns
Nothing.
Function
Synopsis
Shader:send( name, image, ... )
Arguments
string name
- Name of the Image to send to the shader.
Image image
- Image to send to the extern.
Image ...
- Additional images in case the extern is an array.
Returns
Nothing.
Function
Synopsis
Shader:send( name, canvas, ... )
Arguments
string name
- Name of the Canvas to send to the shader.
Canvas canvas
- Canvas to send to the extern. The shader extern type is Image.
Canvas ...
- Additional canvases to send to the extern array.
Returns
Nothing.
Function
Synopsis
Shader:send( name, boolean, ... )
Arguments
string name
- Name of the boolean to send to the shader.
boolean boolean
- Boolean to send to store in the extern.
boolean ...
- Additional booleans to send in case the extern is an array.
Returns
Nothing.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info