20,741
edits
m (→Usage: fix syntax highlighting (xml & glsl)) |
|||
Line 235: | Line 235: | ||
For material shaders, it is necessary to provide both <tt>gbuffer-functions.frag</tt> and <tt>gbuffer-encode.frag</tt> in the effect file, like this : | For material shaders, it is necessary to provide both <tt>gbuffer-functions.frag</tt> and <tt>gbuffer-encode.frag</tt> in the effect file, like this : | ||
< | <syntaxhighlight lang="xml"> | ||
<program> | <program> | ||
<vertex-shader>Shaders/ubershader.vert</vertex-shader> | <vertex-shader>Shaders/ubershader.vert</vertex-shader> | ||
Line 242: | Line 242: | ||
<fragment-shader>Shaders/gbuffer-encode.frag</fragment-shader> | <fragment-shader>Shaders/gbuffer-encode.frag</fragment-shader> | ||
</program> | </program> | ||
</ | </syntaxhighlight> | ||
For fullscreen passes shaders, only <tt>gbuffer-functions.frag</tt> should be provided, like this : | For fullscreen passes shaders, only <tt>gbuffer-functions.frag</tt> should be provided, like this : | ||
< | <syntaxhighlight lang="xml"> | ||
<program> | <program> | ||
<vertex-shader>Shaders/sunlight.vert</vertex-shader> | <vertex-shader>Shaders/sunlight.vert</vertex-shader> | ||
Line 252: | Line 252: | ||
<fragment-shader>Shaders/gbuffer-functions.frag</fragment-shader> | <fragment-shader>Shaders/gbuffer-functions.frag</fragment-shader> | ||
</program> | </program> | ||
</ | </syntaxhighlight> | ||
In the main function of the shader, the functions referenced need to be declared first. With no #include files, the whole function prototype needs to be typed : | In the main function of the shader, the functions referenced need to be declared first. With no #include files, the whole function prototype needs to be typed : | ||
void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); | void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); | ||
<syntaxhighlight lang="glsl"> | |||
main() { | main() { | ||
vec3 normal; | vec3 normal; | ||
Line 271: | Line 273: | ||
encode_gbuffer(normal, color, mId, specular, shininess, emission, depth); | encode_gbuffer(normal, color, mId, specular, shininess, emission, depth); | ||
} | } | ||
</ | </syntaxhighlight> | ||
=== Geometry Stage === | === Geometry Stage === |